From 7ceef94922277b3962cb8f61572983ff503e4819 Mon Sep 17 00:00:00 2001 From: vandan rohatgi <43648786+vandanrohatgi@users.noreply.github.com> Date: Sun, 20 Aug 2023 18:21:27 +0530 Subject: [PATCH 001/145] Add support for enable/disable private vulnerability reporting on repositories (#2887) Fixes: #2883. --- github/repos.go | 40 ++++++++++++++++++++++++++++++++++ github/repos_test.go | 52 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+) diff --git a/github/repos.go b/github/repos.go index 2309d927a29..83fc3f8e734 100644 --- a/github/repos.go +++ b/github/repos.go @@ -2069,3 +2069,43 @@ func isBranchNotProtected(err error) bool { errorResponse, ok := err.(*ErrorResponse) return ok && errorResponse.Message == githubBranchNotProtected } + +// EnablePrivateReporting enables private reporting of vulnerabilities for a +// repository. +// +// GitHub API docs: https://docs.github.com/en/rest/repos/repos#enable-private-vulnerability-reporting-for-a-repository +func (s *RepositoriesService) EnablePrivateReporting(ctx context.Context, owner, repo string) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/private-vulnerability-reporting", owner, repo) + + req, err := s.client.NewRequest("PUT", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// DisablePrivateReporting disables private reporting of vulnerabilities for a +// repository. +// +// GitHub API docs: https://docs.github.com/en/rest/repos/repos#disable-private-vulnerability-reporting-for-a-repository +func (s *RepositoriesService) DisablePrivateReporting(ctx context.Context, owner, repo string) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/private-vulnerability-reporting", owner, repo) + + req, err := s.client.NewRequest("DELETE", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} diff --git a/github/repos_test.go b/github/repos_test.go index c2abf6da4f1..a3164edf554 100644 --- a/github/repos_test.go +++ b/github/repos_test.go @@ -3569,3 +3569,55 @@ func TestRepositoryTag_Marshal(t *testing.T) { testJSONMarshal(t, u, want) } + +func TestRepositoriesService_EnablePrivateReporting(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/repos/owner/repo/private-vulnerability-reporting", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "PUT") + w.WriteHeader(http.StatusNoContent) + }) + + ctx := context.Background() + _, err := client.Repositories.EnablePrivateReporting(ctx, "owner", "repo") + if err != nil { + t.Errorf("Repositories.EnablePrivateReporting returned error: %v", err) + } + + const methodName = "EnablePrivateReporting" + testBadOptions(t, methodName, func() (err error) { + _, err = client.Repositories.EnablePrivateReporting(ctx, "\n", "\n") + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + return client.Repositories.EnablePrivateReporting(ctx, "owner", "repo") + }) +} + +func TestRepositoriesService_DisablePrivateReporting(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/repos/owner/repo/private-vulnerability-reporting", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "DELETE") + w.WriteHeader(http.StatusNoContent) + }) + + ctx := context.Background() + _, err := client.Repositories.DisablePrivateReporting(ctx, "owner", "repo") + if err != nil { + t.Errorf("Repositories.DisablePrivateReporting returned error: %v", err) + } + + const methodName = "DisablePrivateReporting" + testBadOptions(t, methodName, func() (err error) { + _, err = client.Repositories.DisablePrivateReporting(ctx, "\n", "\n") + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + return client.Repositories.DisablePrivateReporting(ctx, "owner", "repo") + }) +} From 505b7eae3643ed09845192120308becf7ddafedc Mon Sep 17 00:00:00 2001 From: Mohammed Nafees Date: Mon, 21 Aug 2023 19:48:00 +0530 Subject: [PATCH 002/145] Add support for organization, repository webhook configuration (#2885) Fixes: #2884. --- github/orgs_hooks_configuration.go | 49 +++++++++ github/orgs_hooks_configuration_test.go | 123 +++++++++++++++++++++++ github/repos_hooks_configuration.go | 49 +++++++++ github/repos_hooks_configuration_test.go | 123 +++++++++++++++++++++++ 4 files changed, 344 insertions(+) create mode 100644 github/orgs_hooks_configuration.go create mode 100644 github/orgs_hooks_configuration_test.go create mode 100644 github/repos_hooks_configuration.go create mode 100644 github/repos_hooks_configuration_test.go diff --git a/github/orgs_hooks_configuration.go b/github/orgs_hooks_configuration.go new file mode 100644 index 00000000000..953a2329c36 --- /dev/null +++ b/github/orgs_hooks_configuration.go @@ -0,0 +1,49 @@ +// Copyright 2023 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// GetHookConfiguration returns the configuration for the specified organization webhook. +// +// GitHub API docs: https://docs.github.com/en/rest/orgs/webhooks?apiVersion=2022-11-28#get-a-webhook-configuration-for-an-organization +func (s *OrganizationsService) GetHookConfiguration(ctx context.Context, org string, id int64) (*HookConfig, *Response, error) { + u := fmt.Sprintf("orgs/%v/hooks/%v/config", org, id) + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + config := new(HookConfig) + resp, err := s.client.Do(ctx, req, config) + if err != nil { + return nil, resp, err + } + + return config, resp, nil +} + +// EditHookConfiguration updates the configuration for the specified organization webhook. +// +// GitHub API docs: https://docs.github.com/en/rest/orgs/webhooks?apiVersion=2022-11-28#update-a-webhook-configuration-for-an-organization +func (s *OrganizationsService) EditHookConfiguration(ctx context.Context, org string, id int64, config *HookConfig) (*HookConfig, *Response, error) { + u := fmt.Sprintf("orgs/%v/hooks/%v/config", org, id) + req, err := s.client.NewRequest("PATCH", u, config) + if err != nil { + return nil, nil, err + } + + c := new(HookConfig) + resp, err := s.client.Do(ctx, req, c) + if err != nil { + return nil, resp, err + } + + return c, resp, nil +} diff --git a/github/orgs_hooks_configuration_test.go b/github/orgs_hooks_configuration_test.go new file mode 100644 index 00000000000..a79f8a56c57 --- /dev/null +++ b/github/orgs_hooks_configuration_test.go @@ -0,0 +1,123 @@ +// Copyright 2023 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + "testing" + + "github.com/google/go-cmp/cmp" +) + +func TestOrganizationsService_GetHookConfiguration(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/orgs/o/hooks/1/config", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + fmt.Fprint(w, `{"content_type": "json", "insecure_ssl": "0", "secret": "********", "url": "https://example.com/webhook"}`) + }) + + ctx := context.Background() + config, _, err := client.Organizations.GetHookConfiguration(ctx, "o", 1) + if err != nil { + t.Errorf("Organizations.GetHookConfiguration returned error: %v", err) + } + + want := &HookConfig{ + ContentType: String("json"), + InsecureSSL: String("0"), + Secret: String("********"), + URL: String("https://example.com/webhook"), + } + if !cmp.Equal(config, want) { + t.Errorf("Organizations.GetHookConfiguration returned %+v, want %+v", config, want) + } + + const methodName = "GetHookConfiguration" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Organizations.GetHookConfiguration(ctx, "\n", -1) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Organizations.GetHookConfiguration(ctx, "o", 1) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestOrganizationsService_GetHookConfiguration_invalidOrg(t *testing.T) { + client, _, _, teardown := setup() + defer teardown() + + ctx := context.Background() + _, _, err := client.Organizations.GetHookConfiguration(ctx, "%", 1) + testURLParseError(t, err) +} + +func TestOrganizationsService_EditHookConfiguration(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + input := &HookConfig{} + + mux.HandleFunc("/orgs/o/hooks/1/config", func(w http.ResponseWriter, r *http.Request) { + v := new(HookConfig) + json.NewDecoder(r.Body).Decode(v) + + testMethod(t, r, "PATCH") + if !cmp.Equal(v, input) { + t.Errorf("Request body = %+v, want %+v", v, input) + } + + fmt.Fprint(w, `{"content_type": "json", "insecure_ssl": "0", "secret": "********", "url": "https://example.com/webhook"}`) + }) + + ctx := context.Background() + config, _, err := client.Organizations.EditHookConfiguration(ctx, "o", 1, input) + if err != nil { + t.Errorf("Organizations.EditHookConfiguration returned error: %v", err) + } + + want := &HookConfig{ + ContentType: String("json"), + InsecureSSL: String("0"), + Secret: String("********"), + URL: String("https://example.com/webhook"), + } + if !cmp.Equal(config, want) { + t.Errorf("Organizations.EditHookConfiguration returned %+v, want %+v", config, want) + } + + const methodName = "EditHookConfiguration" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Organizations.EditHookConfiguration(ctx, "\n", -1, input) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Organizations.EditHookConfiguration(ctx, "o", 1, input) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestOrganizationsService_EditHookConfiguration_invalidOrg(t *testing.T) { + client, _, _, teardown := setup() + defer teardown() + + ctx := context.Background() + _, _, err := client.Organizations.EditHookConfiguration(ctx, "%", 1, nil) + testURLParseError(t, err) +} diff --git a/github/repos_hooks_configuration.go b/github/repos_hooks_configuration.go new file mode 100644 index 00000000000..5aadfb645e1 --- /dev/null +++ b/github/repos_hooks_configuration.go @@ -0,0 +1,49 @@ +// Copyright 2023 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// GetHookConfiguration returns the configuration for the specified repository webhook. +// +// GitHub API docs: https://docs.github.com/en/rest/webhooks/repo-config?apiVersion=2022-11-28#get-a-webhook-configuration-for-a-repository +func (s *RepositoriesService) GetHookConfiguration(ctx context.Context, owner, repo string, id int64) (*HookConfig, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/hooks/%v/config", owner, repo, id) + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + config := new(HookConfig) + resp, err := s.client.Do(ctx, req, config) + if err != nil { + return nil, resp, err + } + + return config, resp, nil +} + +// EditHookConfiguration updates the configuration for the specified repository webhook. +// +// GitHub API docs: https://docs.github.com/en/rest/webhooks/repo-config?apiVersion=2022-11-28#update-a-webhook-configuration-for-a-repository +func (s *RepositoriesService) EditHookConfiguration(ctx context.Context, owner, repo string, id int64, config *HookConfig) (*HookConfig, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/hooks/%v/config", owner, repo, id) + req, err := s.client.NewRequest("PATCH", u, config) + if err != nil { + return nil, nil, err + } + + c := new(HookConfig) + resp, err := s.client.Do(ctx, req, c) + if err != nil { + return nil, resp, err + } + + return c, resp, nil +} diff --git a/github/repos_hooks_configuration_test.go b/github/repos_hooks_configuration_test.go new file mode 100644 index 00000000000..0bdf5cbe9e2 --- /dev/null +++ b/github/repos_hooks_configuration_test.go @@ -0,0 +1,123 @@ +// Copyright 2023 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + "testing" + + "github.com/google/go-cmp/cmp" +) + +func TestRepositoriesService_GetHookConfiguration(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/repos/o/r/hooks/1/config", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + fmt.Fprint(w, `{"content_type": "json", "insecure_ssl": "0", "secret": "********", "url": "https://example.com/webhook"}`) + }) + + ctx := context.Background() + config, _, err := client.Repositories.GetHookConfiguration(ctx, "o", "r", 1) + if err != nil { + t.Errorf("Repositories.GetHookConfiguration returned error: %v", err) + } + + want := &HookConfig{ + ContentType: String("json"), + InsecureSSL: String("0"), + Secret: String("********"), + URL: String("https://example.com/webhook"), + } + if !cmp.Equal(config, want) { + t.Errorf("Repositories.GetHookConfiguration returned %+v, want %+v", config, want) + } + + const methodName = "GetHookConfiguration" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Repositories.GetHookConfiguration(ctx, "\n", "\n", -1) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Repositories.GetHookConfiguration(ctx, "o", "r", 1) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestRepositoriesService_GetHookConfiguration_invalidOrg(t *testing.T) { + client, _, _, teardown := setup() + defer teardown() + + ctx := context.Background() + _, _, err := client.Repositories.GetHookConfiguration(ctx, "%", "%", 1) + testURLParseError(t, err) +} + +func TestRepositoriesService_EditHookConfiguration(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + input := &HookConfig{} + + mux.HandleFunc("/repos/o/r/hooks/1/config", func(w http.ResponseWriter, r *http.Request) { + v := new(HookConfig) + json.NewDecoder(r.Body).Decode(v) + + testMethod(t, r, "PATCH") + if !cmp.Equal(v, input) { + t.Errorf("Request body = %+v, want %+v", v, input) + } + + fmt.Fprint(w, `{"content_type": "json", "insecure_ssl": "0", "secret": "********", "url": "https://example.com/webhook"}`) + }) + + ctx := context.Background() + config, _, err := client.Repositories.EditHookConfiguration(ctx, "o", "r", 1, input) + if err != nil { + t.Errorf("Repositories.EditHookConfiguration returned error: %v", err) + } + + want := &HookConfig{ + ContentType: String("json"), + InsecureSSL: String("0"), + Secret: String("********"), + URL: String("https://example.com/webhook"), + } + if !cmp.Equal(config, want) { + t.Errorf("Repositories.EditHookConfiguration returned %+v, want %+v", config, want) + } + + const methodName = "EditHookConfiguration" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Repositories.EditHookConfiguration(ctx, "\n", "\n", -1, input) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Repositories.EditHookConfiguration(ctx, "o", "r", 1, input) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestRepositoriesService_EditHookConfiguration_invalidOrg(t *testing.T) { + client, _, _, teardown := setup() + defer teardown() + + ctx := context.Background() + _, _, err := client.Repositories.EditHookConfiguration(ctx, "%", "%", 1, nil) + testURLParseError(t, err) +} From 38ca69f37f8597421ceb02e08f2dd225cfaeb1a9 Mon Sep 17 00:00:00 2001 From: Nikita Pivkin Date: Tue, 22 Aug 2023 19:26:27 +0700 Subject: [PATCH 003/145] Return json.Unmarshal error when importing issues deferred (#2892) --- github/issue_import.go | 9 ++-- github/issue_import_test.go | 88 ++++++++++++++++++++++++++++++++++++- 2 files changed, 90 insertions(+), 7 deletions(-) diff --git a/github/issue_import.go b/github/issue_import.go index 4bc8d5f1d23..04899772bd1 100644 --- a/github/issue_import.go +++ b/github/issue_import.go @@ -86,14 +86,11 @@ func (s *IssueImportService) Create(ctx context.Context, owner, repo string, iss if err != nil { aerr, ok := err.(*AcceptedError) if ok { - decErr := json.Unmarshal(aerr.Raw, i) - if decErr != nil { - err = decErr + if err := json.Unmarshal(aerr.Raw, i); err != nil { + return i, resp, err } - - return i, resp, nil + return i, resp, err } - return nil, resp, err } diff --git a/github/issue_import_test.go b/github/issue_import_test.go index a86ead898b4..48f96ab3a5c 100644 --- a/github/issue_import_test.go +++ b/github/issue_import_test.go @@ -45,7 +45,6 @@ func TestIssueImportService_Create(t *testing.T) { t.Errorf("Request body = %+v, want %+v", v, input) } - w.WriteHeader(http.StatusAccepted) w.Write(issueImportResponseJSON) }) @@ -75,6 +74,93 @@ func TestIssueImportService_Create(t *testing.T) { }) } +func TestIssueImportService_Create_defered(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + createdAt := time.Date(2020, time.August, 11, 15, 30, 0, 0, time.UTC) + input := &IssueImportRequest{ + IssueImport: IssueImport{ + Assignee: String("developer"), + Body: "Dummy description", + CreatedAt: &Timestamp{createdAt}, + Labels: []string{"l1", "l2"}, + Milestone: Int(1), + Title: "Dummy Issue", + }, + Comments: []*Comment{{ + CreatedAt: &Timestamp{createdAt}, + Body: "Comment body", + }}, + } + + mux.HandleFunc("/repos/o/r/import/issues", func(w http.ResponseWriter, r *http.Request) { + v := new(IssueImportRequest) + json.NewDecoder(r.Body).Decode(v) + testMethod(t, r, "POST") + testHeader(t, r, "Accept", mediaTypeIssueImportAPI) + if !cmp.Equal(v, input) { + t.Errorf("Request body = %+v, want %+v", v, input) + } + + w.WriteHeader(http.StatusAccepted) + w.Write(issueImportResponseJSON) + }) + + ctx := context.Background() + got, _, err := client.IssueImport.Create(ctx, "o", "r", input) + + if _, ok := err.(*AcceptedError); !ok { + t.Errorf("Create returned error: %v (want AcceptedError)", err) + } + + want := wantIssueImportResponse + if !cmp.Equal(got, want) { + t.Errorf("Create = %+v, want %+v", got, want) + } +} + +func TestIssueImportService_Create_badResponse(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + createdAt := time.Date(2020, time.August, 11, 15, 30, 0, 0, time.UTC) + input := &IssueImportRequest{ + IssueImport: IssueImport{ + Assignee: String("developer"), + Body: "Dummy description", + CreatedAt: &Timestamp{createdAt}, + Labels: []string{"l1", "l2"}, + Milestone: Int(1), + Title: "Dummy Issue", + }, + Comments: []*Comment{{ + CreatedAt: &Timestamp{createdAt}, + Body: "Comment body", + }}, + } + + mux.HandleFunc("/repos/o/r/import/issues", func(w http.ResponseWriter, r *http.Request) { + v := new(IssueImportRequest) + json.NewDecoder(r.Body).Decode(v) + testMethod(t, r, "POST") + testHeader(t, r, "Accept", mediaTypeIssueImportAPI) + if !cmp.Equal(v, input) { + t.Errorf("Request body = %+v, want %+v", v, input) + } + + w.WriteHeader(http.StatusAccepted) + w.Write([]byte("{[}")) + }) + + ctx := context.Background() + _, _, err := client.IssueImport.Create(ctx, "o", "r", input) + + if err == nil || err.Error() != "invalid character '[' looking for beginning of object key string" { + t.Errorf("unexpected error: %v", err) + } +} + func TestIssueImportService_Create_invalidOwner(t *testing.T) { client, _, _, teardown := setup() defer teardown() From c36edbde82966ce8107ea8cc8085a164f33721a5 Mon Sep 17 00:00:00 2001 From: WillAbides <233500+WillAbides@users.noreply.github.com> Date: Sun, 27 Aug 2023 11:22:57 -0500 Subject: [PATCH 004/145] Remove dependency on "golang.org/x/oauth2" (#2895) Fixes: #2893. --- example/go.mod | 11 +- example/go.sum | 49 ++- example/newreposecretwithlibsodium/go.mod | 1 - example/newreposecretwithlibsodium/go.sum | 394 +++------------------- example/tokenauth/main.go | 3 +- github/github.go | 23 +- github/github_test.go | 24 +- go.mod | 5 - go.sum | 50 ++- 9 files changed, 146 insertions(+), 414 deletions(-) diff --git a/example/go.mod b/example/go.mod index 081ce56d129..aa04906aa9c 100644 --- a/example/go.mod +++ b/example/go.mod @@ -6,19 +6,22 @@ require ( github.com/bradleyfalzon/ghinstallation/v2 v2.0.4 github.com/gofri/go-github-ratelimit v1.0.3 github.com/google/go-github/v54 v54.0.0 - golang.org/x/crypto v0.7.0 + golang.org/x/crypto v0.12.0 golang.org/x/oauth2 v0.7.0 + golang.org/x/term v0.11.0 google.golang.org/appengine v1.6.7 ) require ( + github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 // indirect + github.com/cloudflare/circl v1.3.3 // indirect github.com/golang-jwt/jwt/v4 v4.0.0 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/google/go-github/v41 v41.0.0 // indirect github.com/google/go-querystring v1.1.0 // indirect - golang.org/x/net v0.9.0 // indirect - golang.org/x/sys v0.7.0 // indirect - golang.org/x/term v0.7.0 // indirect + golang.org/x/net v0.10.0 // indirect + golang.org/x/sys v0.11.0 // indirect + google.golang.org/protobuf v1.28.0 // indirect ) // Use version at HEAD, not the latest published. diff --git a/example/go.sum b/example/go.sum index f231e169888..1151ab7548d 100644 --- a/example/go.sum +++ b/example/go.sum @@ -1,19 +1,26 @@ +cloud.google.com/go/compute/metadata v0.2.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= +github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 h1:wPbRQzjjwFc0ih8puEVAOFGELsn1zoIIYdxvML7mDxA= +github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8/go.mod h1:I0gYDMZ6Z5GRU7l58bNFSkPTFN6Yl12dsUlAZ8xy98g= github.com/bradleyfalzon/ghinstallation/v2 v2.0.4 h1:tXKVfhE7FcSkhkv0UwkLvPDeZ4kz6OXd0PKPlFqf81M= github.com/bradleyfalzon/ghinstallation/v2 v2.0.4/go.mod h1:B40qPqJxWE0jDZgOR1JmaMy+4AY1eBP+IByOvqyAKp0= -github.com/gofri/go-github-ratelimit v1.0.1 h1:sgefSzxhnvwZ+wR9uZ4l9TnjgLuNiwipJVzJL4YLj9A= -github.com/gofri/go-github-ratelimit v1.0.1/go.mod h1:OnCi5gV+hAG/LMR7llGhU7yHt44se9sYgKPnafoL7RY= +github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= +github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= +github.com/cloudflare/circl v1.1.0/go.mod h1:prBCrKB9DV4poKZY1l9zBXg2QJY7mvgRvtMxxK7fi4I= +github.com/cloudflare/circl v1.3.3 h1:fE/Qz0QdIGqeWfnwq0RE0R7MI51s0M2E4Ga9kq5AEMs= +github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= github.com/gofri/go-github-ratelimit v1.0.3 h1:Ocs2jaYokZDzgvqaajX+g04dqFyVqL0JQzoO7d2wmlk= github.com/gofri/go-github-ratelimit v1.0.3/go.mod h1:OnCi5gV+hAG/LMR7llGhU7yHt44se9sYgKPnafoL7RY= github.com/golang-jwt/jwt/v4 v4.0.0 h1:RAqyYixv1p7uEnocuy8P1nru5wprCh/MH2BIlW5z5/o= github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-github/v41 v41.0.0 h1:HseJrM2JFf2vfiZJ8anY2hqBjdfY1Vlj/K27ueww4gg= @@ -24,50 +31,64 @@ github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5t golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU= -golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= -golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= +golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= +golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= +golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs= +golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.7.0 h1:qe6s0zUXlPX80/dITx3440hWZ7GwMwgDDyrSGTPJG/g= golang.org/x/oauth2 v0.7.0/go.mod h1:hPLQkd9LyjfXTiRohC/41GhcFqxisoUQ99sCUOHO9x4= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY= +golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0= +golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= diff --git a/example/newreposecretwithlibsodium/go.mod b/example/newreposecretwithlibsodium/go.mod index 95dbcc9d52d..98684c1c1d9 100644 --- a/example/newreposecretwithlibsodium/go.mod +++ b/example/newreposecretwithlibsodium/go.mod @@ -5,7 +5,6 @@ go 1.15 require ( github.com/GoKillers/libsodium-go v0.0.0-20171022220152-dd733721c3cb github.com/google/go-github/v54 v54.0.0 - golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43 ) // Use version at HEAD, not the latest published. diff --git a/example/newreposecretwithlibsodium/go.sum b/example/newreposecretwithlibsodium/go.sum index dfbf7641b99..236b1e435bd 100644 --- a/example/newreposecretwithlibsodium/go.sum +++ b/example/newreposecretwithlibsodium/go.sum @@ -1,374 +1,62 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= -cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= -cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= -cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= -cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= -cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= -cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= -cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= -cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= -cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= -cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= -cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= -cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= -cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= -cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= -cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/GoKillers/libsodium-go v0.0.0-20171022220152-dd733721c3cb h1:ilqSFSbR1fq6x88heeHrvAqlg+ES+tZk2ZcaCmiH1gI= github.com/GoKillers/libsodium-go v0.0.0-20171022220152-dd733721c3cb/go.mod h1:72TQeEkiDH9QMXZa5nJJvZre0UjqqO67X2QEIoOwCRU= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 h1:wPbRQzjjwFc0ih8puEVAOFGELsn1zoIIYdxvML7mDxA= +github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8/go.mod h1:I0gYDMZ6Z5GRU7l58bNFSkPTFN6Yl12dsUlAZ8xy98g= +github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= +github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= +github.com/cloudflare/circl v1.1.0/go.mod h1:prBCrKB9DV4poKZY1l9zBXg2QJY7mvgRvtMxxK7fi4I= +github.com/cloudflare/circl v1.3.3 h1:fE/Qz0QdIGqeWfnwq0RE0R7MI51s0M2E4Ga9kq5AEMs= +github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 h1:HWj/xjIHfjYU5nVXpTM0s39J9CbLn7Cc5a7IC5rwsMQ= -golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= -golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= -golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= +golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= +golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43 h1:ld7aEMNHoBnnDAX15v1T6z31v8HwR2A9FYOuAhWqkwc= -golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= -google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= -google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= -google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= -google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= -rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/example/tokenauth/main.go b/example/tokenauth/main.go index a9e845bed30..564db2663e6 100644 --- a/example/tokenauth/main.go +++ b/example/tokenauth/main.go @@ -3,7 +3,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// The tokenauth command demonstrates using the oauth2.StaticTokenSource. +// The tokenauth command demonstrates using a Personal Access Token (PAT) to +// authenticate with GitHub. // You can test out a GitHub Personal Access Token using this simple example. // You can generate them here: https://github.com/settings/tokens package main diff --git a/github/github.go b/github/github.go index aad4a7335d6..a7031ffd65a 100644 --- a/github/github.go +++ b/github/github.go @@ -24,7 +24,6 @@ import ( "time" "github.com/google/go-querystring/query" - "golang.org/x/oauth2" ) const ( @@ -306,8 +305,9 @@ func addOptions(s string, opts interface{}) (string, error) { // NewClient returns a new GitHub API client. If a nil httpClient is // provided, a new http.Client will be used. To use API methods which require -// authentication, provide an http.Client that will perform the authentication -// for you (such as that provided by the golang.org/x/oauth2 library). +// authentication, either use NewTokenClient instead or provide NewClient with +// an http.Client that will perform the authentication for you (such as that +// provided by the golang.org/x/oauth2 library). func NewClient(httpClient *http.Client) *Client { if httpClient == nil { httpClient = &http.Client{} @@ -358,8 +358,14 @@ func NewClientWithEnvProxy() *Client { } // NewTokenClient returns a new GitHub API client authenticated with the provided token. -func NewTokenClient(ctx context.Context, token string) *Client { - return NewClient(oauth2.NewClient(ctx, oauth2.StaticTokenSource(&oauth2.Token{AccessToken: token}))) +func NewTokenClient(_ context.Context, token string) *Client { + return NewClient(&http.Client{ + Transport: roundTripperFunc(func(req *http.Request) (*http.Response, error) { + req = req.Clone(req.Context()) + req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", token)) + return http.DefaultTransport.RoundTrip(req) + }), + }) } // NewEnterpriseClient returns a new GitHub API client with provided @@ -1539,3 +1545,10 @@ func Int64(v int64) *int64 { return &v } // String is a helper routine that allocates a new string value // to store v and returns a pointer to it. func String(v string) *string { return &v } + +// roundTripperFunc creates a RoundTripper (transport) +type roundTripperFunc func(*http.Request) (*http.Response, error) + +func (fn roundTripperFunc) RoundTrip(r *http.Request) (*http.Response, error) { + return fn(r) +} diff --git a/github/github_test.go b/github/github_test.go index 94606edd72b..982e1fe7498 100644 --- a/github/github_test.go +++ b/github/github_test.go @@ -23,7 +23,6 @@ import ( "time" "github.com/google/go-cmp/cmp" - "golang.org/x/oauth2" ) const ( @@ -310,13 +309,17 @@ func TestClient(t *testing.T) { func TestNewTokenClient(t *testing.T) { token := "gh_test_token" ctx := context.Background() - c := NewTokenClient(ctx, token) - tr, ok := c.Client().Transport.(*oauth2.Transport) - if !ok { - t.Error("Client transport is not oauth2.Transport") + var gotAuthHeaderVals []string + wantAuthHeaderVals := []string{"Bearer " + token} + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + gotAuthHeaderVals = r.Header["Authorization"] + })) + _, err := NewTokenClient(ctx, token).Client().Get(srv.URL) + if err != nil { + t.Fatalf("Get returned unexpected error: %v", err) } - if tok, err := tr.Source.Token(); err != nil || tok.AccessToken != token { - t.Errorf("Client not using correct token") + if diff := cmp.Diff(wantAuthHeaderVals, gotAuthHeaderVals); diff != "" { + t.Errorf("Authorization header values mismatch (-want +got):\n%s", diff) } } @@ -2705,13 +2708,6 @@ func TestBareDo_returnsOpenBody(t *testing.T) { } } -// roundTripperFunc creates a mock RoundTripper (transport) -type roundTripperFunc func(*http.Request) (*http.Response, error) - -func (fn roundTripperFunc) RoundTrip(r *http.Request) (*http.Response, error) { - return fn(r) -} - func TestErrorResponse_Marshal(t *testing.T) { testJSONMarshal(t, &ErrorResponse{}, "{}") diff --git a/go.mod b/go.mod index 2ea4636dfbb..fa43a0aa5ff 100644 --- a/go.mod +++ b/go.mod @@ -4,17 +4,12 @@ require ( github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 github.com/google/go-cmp v0.5.9 github.com/google/go-querystring v1.1.0 - golang.org/x/oauth2 v0.11.0 ) require ( github.com/cloudflare/circl v1.3.3 // indirect - github.com/golang/protobuf v1.5.3 // indirect golang.org/x/crypto v0.12.0 // indirect - golang.org/x/net v0.14.0 // indirect golang.org/x/sys v0.11.0 // indirect - google.golang.org/appengine v1.6.7 // indirect - google.golang.org/protobuf v1.31.0 // indirect ) go 1.17 diff --git a/go.sum b/go.sum index 1b24aa6b96a..68e49aed424 100644 --- a/go.sum +++ b/go.sum @@ -1,44 +1,60 @@ github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 h1:wPbRQzjjwFc0ih8puEVAOFGELsn1zoIIYdxvML7mDxA= github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8/go.mod h1:I0gYDMZ6Z5GRU7l58bNFSkPTFN6Yl12dsUlAZ8xy98g= github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= +github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/cloudflare/circl v1.1.0/go.mod h1:prBCrKB9DV4poKZY1l9zBXg2QJY7mvgRvtMxxK7fi4I= github.com/cloudflare/circl v1.3.3 h1:fE/Qz0QdIGqeWfnwq0RE0R7MI51s0M2E4Ga9kq5AEMs= github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14= -golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= -golang.org/x/oauth2 v0.11.0 h1:vPL4xzxBM4niKCW6g9whtaWVXTJf1U5e4aZxxFx/gbU= -golang.org/x/oauth2 v0.11.0/go.mod h1:LdF7O/8bLR/qWK9DrpXmbHLTouvRHK0SgJl0GmDBchk= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= -google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= From 8596515296f0104b3930c136fecda8f53049aa36 Mon Sep 17 00:00:00 2001 From: Nikita Pivkin Date: Wed, 30 Aug 2023 01:08:47 +0700 Subject: [PATCH 005/145] Add support for dependabot_alert webhook event (#2888) Fixes: #2790. --- github/dependabot_alerts.go | 4 +- github/event_types.go | 19 ++ github/event_types_test.go | 461 ++++++++++++++++++++++++++ github/github-accessors.go | 64 ++++ github/github-accessors_test.go | 62 ++++ github/messages.go | 1 + github/messages_test.go | 4 + github/repos_hooks_deliveries_test.go | 1 + 8 files changed, 615 insertions(+), 1 deletion(-) diff --git a/github/dependabot_alerts.go b/github/dependabot_alerts.go index a55f540f1be..e39ed277caf 100644 --- a/github/dependabot_alerts.go +++ b/github/dependabot_alerts.go @@ -62,7 +62,9 @@ type DependabotAlert struct { DismissedReason *string `json:"dismissed_reason,omitempty"` DismissedComment *string `json:"dismissed_comment,omitempty"` FixedAt *Timestamp `json:"fixed_at,omitempty"` - Repository *Repository `json:"repository,omitempty"` + AutoDismissedAt *Timestamp `json:"auto_dismissed_at,omitempty"` + // The repository is always empty for events + Repository *Repository `json:"repository,omitempty"` } // ListAlertsOptions specifies the optional parameters to the DependabotService.ListRepoAlerts diff --git a/github/event_types.go b/github/event_types.go index 64bbde122a3..d402e872463 100644 --- a/github/event_types.go +++ b/github/event_types.go @@ -134,6 +134,25 @@ type DeleteEvent struct { Installation *Installation `json:"installation,omitempty"` } +// DependabotAlertEvent is triggered when there is activity relating to Dependabot alerts. +// The Webhook event name is "dependabot_alert". +// +// GitHub API docs: https://docs.github.com/en/webhooks-and-events/webhooks/webhook-events-and-payloads#dependabot_alert +type DependabotAlertEvent struct { + Action *string `json:"action,omitempty"` + Alert *DependabotAlert `json:"alert,omitempty"` + + // The following fields are only populated by Webhook events. + Installation *Installation `json:"installation,omitempty"` + Enterprise *Enterprise `json:"enterprise,omitempty"` + Repo *Repository `json:"repository,omitempty"` + Sender *User `json:"sender,omitempty"` + + // The following field is only present when the webhook is triggered on + // a repository belonging to an organization. + Organization *Organization `json:"organization,omitempty"` +} + // DeployKeyEvent is triggered when a deploy key is added or removed from a repository. // The Webhook event name is "deploy_key". // diff --git a/github/event_types_test.go b/github/event_types_test.go index 653671b8685..485b1953d19 100644 --- a/github/event_types_test.go +++ b/github/event_types_test.go @@ -12700,6 +12700,467 @@ func TestDeleteEvent_Marshal(t *testing.T) { testJSONMarshal(t, r, want) } +func TestDependabotAlertEvent_Marshal(t *testing.T) { + testJSONMarshal(t, &DependabotAlertEvent{}, "{}") + + e := &DependabotAlertEvent{ + Action: String("a"), + Alert: &DependabotAlert{ + Number: Int(1), + State: String("s"), + Dependency: &Dependency{ + Package: &VulnerabilityPackage{ + Ecosystem: String("e"), + Name: String("n"), + }, + ManifestPath: String("mp"), + Scope: String("s"), + }, + SecurityAdvisory: &DependabotSecurityAdvisory{ + GHSAID: String("ghsaid"), + CVEID: String("cveid"), + Summary: String("s"), + Description: String("d"), + Vulnerabilities: []*AdvisoryVulnerability{ + { + Package: &VulnerabilityPackage{ + Ecosystem: String("e"), + Name: String("n"), + }, + Severity: String("s"), + }, + }, + Severity: String("s"), + CVSs: &AdvisoryCVSs{ + Score: Float64(1.0), + VectorString: String("vs"), + }, + CWEs: []*AdvisoryCWEs{ + { + CWEID: String("cweid"), + Name: String("n"), + }, + }, + Identifiers: []*AdvisoryIdentifier{ + { + Value: String("v"), + Type: String("t"), + }, + }, + References: []*AdvisoryReference{ + { + URL: String("u"), + }, + }, + PublishedAt: &Timestamp{referenceTime}, + UpdatedAt: &Timestamp{referenceTime}, + WithdrawnAt: &Timestamp{referenceTime}, + }, + SecurityVulnerability: &AdvisoryVulnerability{ + Package: &VulnerabilityPackage{ + Ecosystem: String("e"), + Name: String("n"), + }, + Severity: String("s"), + VulnerableVersionRange: String("vvr"), + FirstPatchedVersion: &FirstPatchedVersion{ + Identifier: String("i"), + }, + }, + URL: String("u"), + HTMLURL: String("hu"), + CreatedAt: &Timestamp{referenceTime}, + UpdatedAt: &Timestamp{referenceTime}, + DismissedAt: &Timestamp{referenceTime}, + DismissedBy: &User{ + Login: String("l"), + ID: Int64(1), + NodeID: String("n"), + URL: String("u"), + ReposURL: String("r"), + EventsURL: String("e"), + AvatarURL: String("a"), + }, + DismissedReason: String("dr"), + DismissedComment: String("dc"), + FixedAt: &Timestamp{referenceTime}, + AutoDismissedAt: &Timestamp{referenceTime}, + }, + Repo: &Repository{ + ID: Int64(1), + URL: String("s"), + Name: String("n"), + }, + Organization: &Organization{ + BillingEmail: String("be"), + Blog: String("b"), + Company: String("c"), + Email: String("e"), + TwitterUsername: String("tu"), + Location: String("loc"), + Name: String("n"), + Description: String("d"), + IsVerified: Bool(true), + HasOrganizationProjects: Bool(true), + HasRepositoryProjects: Bool(true), + DefaultRepoPermission: String("drp"), + MembersCanCreateRepos: Bool(true), + MembersCanCreateInternalRepos: Bool(true), + MembersCanCreatePrivateRepos: Bool(true), + MembersCanCreatePublicRepos: Bool(false), + MembersAllowedRepositoryCreationType: String("marct"), + MembersCanCreatePages: Bool(true), + MembersCanCreatePublicPages: Bool(false), + MembersCanCreatePrivatePages: Bool(true), + }, + Enterprise: &Enterprise{ + ID: Int(1), + Slug: String("s"), + Name: String("n"), + NodeID: String("nid"), + AvatarURL: String("au"), + Description: String("d"), + WebsiteURL: String("wu"), + HTMLURL: String("hu"), + CreatedAt: &Timestamp{referenceTime}, + UpdatedAt: &Timestamp{referenceTime}, + }, + Sender: &User{ + Login: String("l"), + ID: Int64(1), + NodeID: String("n"), + URL: String("u"), + ReposURL: String("r"), + EventsURL: String("e"), + AvatarURL: String("a"), + }, + Installation: &Installation{ + ID: Int64(1), + NodeID: String("nid"), + AppID: Int64(1), + AppSlug: String("as"), + TargetID: Int64(1), + Account: &User{ + Login: String("l"), + ID: Int64(1), + URL: String("u"), + AvatarURL: String("a"), + GravatarID: String("g"), + Name: String("n"), + Company: String("c"), + Blog: String("b"), + Location: String("l"), + Email: String("e"), + Hireable: Bool(true), + Bio: String("b"), + TwitterUsername: String("t"), + PublicRepos: Int(1), + Followers: Int(1), + Following: Int(1), + CreatedAt: &Timestamp{referenceTime}, + SuspendedAt: &Timestamp{referenceTime}, + }, + AccessTokensURL: String("atu"), + RepositoriesURL: String("ru"), + HTMLURL: String("hu"), + TargetType: String("tt"), + SingleFileName: String("sfn"), + RepositorySelection: String("rs"), + Events: []string{"e"}, + SingleFilePaths: []string{"s"}, + Permissions: &InstallationPermissions{ + Actions: String("a"), + Administration: String("ad"), + Checks: String("c"), + Contents: String("co"), + ContentReferences: String("cr"), + Deployments: String("d"), + Environments: String("e"), + Issues: String("i"), + Metadata: String("md"), + Members: String("m"), + OrganizationAdministration: String("oa"), + OrganizationHooks: String("oh"), + OrganizationPlan: String("op"), + OrganizationPreReceiveHooks: String("opr"), + OrganizationProjects: String("op"), + OrganizationSecrets: String("os"), + OrganizationSelfHostedRunners: String("osh"), + OrganizationUserBlocking: String("oub"), + Packages: String("pkg"), + Pages: String("pg"), + PullRequests: String("pr"), + RepositoryHooks: String("rh"), + RepositoryProjects: String("rp"), + RepositoryPreReceiveHooks: String("rprh"), + Secrets: String("s"), + SecretScanningAlerts: String("ssa"), + SecurityEvents: String("se"), + SingleFile: String("sf"), + Statuses: String("s"), + TeamDiscussions: String("td"), + VulnerabilityAlerts: String("va"), + Workflows: String("w"), + }, + CreatedAt: &Timestamp{referenceTime}, + UpdatedAt: &Timestamp{referenceTime}, + HasMultipleSingleFiles: Bool(false), + SuspendedBy: &User{ + Login: String("l"), + ID: Int64(1), + URL: String("u"), + AvatarURL: String("a"), + GravatarID: String("g"), + Name: String("n"), + Company: String("c"), + Blog: String("b"), + Location: String("l"), + Email: String("e"), + Hireable: Bool(true), + Bio: String("b"), + TwitterUsername: String("t"), + PublicRepos: Int(1), + Followers: Int(1), + Following: Int(1), + CreatedAt: &Timestamp{referenceTime}, + SuspendedAt: &Timestamp{referenceTime}, + }, + SuspendedAt: &Timestamp{referenceTime}, + }, + } + want := `{ + "action": "a", + "alert": { + "number": 1, + "state": "s", + "dependency": { + "package": { + "ecosystem": "e", + "name": "n" + }, + "manifest_path": "mp", + "scope": "s" + }, + "security_advisory": { + "ghsa_id": "ghsaid", + "cve_id": "cveid", + "summary": "s", + "description": "d", + "vulnerabilities": [ + { + "package": { + "ecosystem": "e", + "name": "n" + }, + "severity": "s" + } + ], + "severity": "s", + "cvss": { + "score": 1.0, + "vector_string": "vs" + }, + "cwes": [ + { + "cwe_id": "cweid", + "name": "n" + } + ], + "identifiers": [ + { + "value": "v", + "type": "t" + } + ], + "references": [ + { + "url": "u" + } + ], + "published_at": ` + referenceTimeStr + `, + "updated_at": ` + referenceTimeStr + `, + "withdrawn_at": ` + referenceTimeStr + ` + }, + "security_vulnerability": { + "package": { + "ecosystem": "e", + "name": "n" + }, + "severity": "s", + "vulnerable_version_range": "vvr", + "first_patched_version": { + "identifier": "i" + } + }, + "url": "u", + "html_url": "hu", + "created_at": ` + referenceTimeStr + `, + "updated_at": ` + referenceTimeStr + `, + "dismissed_at": ` + referenceTimeStr + `, + "dismissed_by": { + "login": "l", + "id": 1, + "node_id": "n", + "avatar_url": "a", + "url": "u", + "events_url": "e", + "repos_url": "r" + }, + "dismissed_reason": "dr", + "dismissed_comment": "dc", + "fixed_at": ` + referenceTimeStr + `, + "auto_dismissed_at": ` + referenceTimeStr + ` + }, + "repository": { + "id": 1, + "name": "n", + "url": "s" + }, + "organization": { + "name": "n", + "company": "c", + "blog": "b", + "location": "loc", + "email": "e", + "twitter_username": "tu", + "description": "d", + "billing_email": "be", + "is_verified": true, + "has_organization_projects": true, + "has_repository_projects": true, + "default_repository_permission": "drp", + "members_can_create_repositories": true, + "members_can_create_public_repositories": false, + "members_can_create_private_repositories": true, + "members_can_create_internal_repositories": true, + "members_allowed_repository_creation_type": "marct", + "members_can_create_pages": true, + "members_can_create_public_pages": false, + "members_can_create_private_pages": true + }, + "enterprise": { + "id": 1, + "slug": "s", + "name": "n", + "node_id": "nid", + "avatar_url": "au", + "description": "d", + "website_url": "wu", + "html_url": "hu", + "created_at": ` + referenceTimeStr + `, + "updated_at": ` + referenceTimeStr + ` + }, + "sender": { + "login": "l", + "id": 1, + "node_id": "n", + "avatar_url": "a", + "url": "u", + "events_url": "e", + "repos_url": "r" + }, + "installation": { + "id": 1, + "node_id": "nid", + "app_id": 1, + "app_slug": "as", + "target_id": 1, + "account": { + "login": "l", + "id": 1, + "avatar_url": "a", + "gravatar_id": "g", + "name": "n", + "company": "c", + "blog": "b", + "location": "l", + "email": "e", + "hireable": true, + "bio": "b", + "twitter_username": "t", + "public_repos": 1, + "followers": 1, + "following": 1, + "created_at": ` + referenceTimeStr + `, + "suspended_at": ` + referenceTimeStr + `, + "url": "u" + }, + "access_tokens_url": "atu", + "repositories_url": "ru", + "html_url": "hu", + "target_type": "tt", + "single_file_name": "sfn", + "repository_selection": "rs", + "events": [ + "e" + ], + "single_file_paths": [ + "s" + ], + "permissions": { + "actions": "a", + "administration": "ad", + "checks": "c", + "contents": "co", + "content_references": "cr", + "deployments": "d", + "environments": "e", + "issues": "i", + "metadata": "md", + "members": "m", + "organization_administration": "oa", + "organization_hooks": "oh", + "organization_plan": "op", + "organization_pre_receive_hooks": "opr", + "organization_projects": "op", + "organization_secrets": "os", + "organization_self_hosted_runners": "osh", + "organization_user_blocking": "oub", + "packages": "pkg", + "pages": "pg", + "pull_requests": "pr", + "repository_hooks": "rh", + "repository_projects": "rp", + "repository_pre_receive_hooks": "rprh", + "secrets": "s", + "secret_scanning_alerts": "ssa", + "security_events": "se", + "single_file": "sf", + "statuses": "s", + "team_discussions": "td", + "vulnerability_alerts": "va", + "workflows": "w" + }, + "created_at": ` + referenceTimeStr + `, + "updated_at": ` + referenceTimeStr + `, + "has_multiple_single_files": false, + "suspended_by": { + "login": "l", + "id": 1, + "avatar_url": "a", + "gravatar_id": "g", + "name": "n", + "company": "c", + "blog": "b", + "location": "l", + "email": "e", + "hireable": true, + "bio": "b", + "twitter_username": "t", + "public_repos": 1, + "followers": 1, + "following": 1, + "created_at": ` + referenceTimeStr + `, + "suspended_at": ` + referenceTimeStr + `, + "url": "u" + }, + "suspended_at": ` + referenceTimeStr + ` + } + }` + + testJSONMarshal(t, e, want) +} + func TestForkEvent_Marshal(t *testing.T) { testJSONMarshal(t, &ForkEvent{}, "{}") diff --git a/github/github-accessors.go b/github/github-accessors.go index 562ad734562..113053627c0 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -4926,6 +4926,14 @@ func (d *DeleteEvent) GetSender() *User { return d.Sender } +// GetAutoDismissedAt returns the AutoDismissedAt field if it's non-nil, zero value otherwise. +func (d *DependabotAlert) GetAutoDismissedAt() Timestamp { + if d == nil || d.AutoDismissedAt == nil { + return Timestamp{} + } + return *d.AutoDismissedAt +} + // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. func (d *DependabotAlert) GetCreatedAt() Timestamp { if d == nil || d.CreatedAt == nil { @@ -5046,6 +5054,62 @@ func (d *DependabotAlert) GetURL() string { return *d.URL } +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (d *DependabotAlertEvent) GetAction() string { + if d == nil || d.Action == nil { + return "" + } + return *d.Action +} + +// GetAlert returns the Alert field. +func (d *DependabotAlertEvent) GetAlert() *DependabotAlert { + if d == nil { + return nil + } + return d.Alert +} + +// GetEnterprise returns the Enterprise field. +func (d *DependabotAlertEvent) GetEnterprise() *Enterprise { + if d == nil { + return nil + } + return d.Enterprise +} + +// GetInstallation returns the Installation field. +func (d *DependabotAlertEvent) GetInstallation() *Installation { + if d == nil { + return nil + } + return d.Installation +} + +// GetOrganization returns the Organization field. +func (d *DependabotAlertEvent) GetOrganization() *Organization { + if d == nil { + return nil + } + return d.Organization +} + +// GetRepo returns the Repo field. +func (d *DependabotAlertEvent) GetRepo() *Repository { + if d == nil { + return nil + } + return d.Repo +} + +// GetSender returns the Sender field. +func (d *DependabotAlertEvent) GetSender() *User { + if d == nil { + return nil + } + return d.Sender +} + // GetCVEID returns the CVEID field if it's non-nil, zero value otherwise. func (d *DependabotSecurityAdvisory) GetCVEID() string { if d == nil || d.CVEID == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 0a6b5271e8b..7ced903790e 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -5816,6 +5816,16 @@ func TestDeleteEvent_GetSender(tt *testing.T) { d.GetSender() } +func TestDependabotAlert_GetAutoDismissedAt(tt *testing.T) { + var zeroValue Timestamp + d := &DependabotAlert{AutoDismissedAt: &zeroValue} + d.GetAutoDismissedAt() + d = &DependabotAlert{} + d.GetAutoDismissedAt() + d = nil + d.GetAutoDismissedAt() +} + func TestDependabotAlert_GetCreatedAt(tt *testing.T) { var zeroValue Timestamp d := &DependabotAlert{CreatedAt: &zeroValue} @@ -5951,6 +5961,58 @@ func TestDependabotAlert_GetURL(tt *testing.T) { d.GetURL() } +func TestDependabotAlertEvent_GetAction(tt *testing.T) { + var zeroValue string + d := &DependabotAlertEvent{Action: &zeroValue} + d.GetAction() + d = &DependabotAlertEvent{} + d.GetAction() + d = nil + d.GetAction() +} + +func TestDependabotAlertEvent_GetAlert(tt *testing.T) { + d := &DependabotAlertEvent{} + d.GetAlert() + d = nil + d.GetAlert() +} + +func TestDependabotAlertEvent_GetEnterprise(tt *testing.T) { + d := &DependabotAlertEvent{} + d.GetEnterprise() + d = nil + d.GetEnterprise() +} + +func TestDependabotAlertEvent_GetInstallation(tt *testing.T) { + d := &DependabotAlertEvent{} + d.GetInstallation() + d = nil + d.GetInstallation() +} + +func TestDependabotAlertEvent_GetOrganization(tt *testing.T) { + d := &DependabotAlertEvent{} + d.GetOrganization() + d = nil + d.GetOrganization() +} + +func TestDependabotAlertEvent_GetRepo(tt *testing.T) { + d := &DependabotAlertEvent{} + d.GetRepo() + d = nil + d.GetRepo() +} + +func TestDependabotAlertEvent_GetSender(tt *testing.T) { + d := &DependabotAlertEvent{} + d.GetSender() + d = nil + d.GetSender() +} + func TestDependabotSecurityAdvisory_GetCVEID(tt *testing.T) { var zeroValue string d := &DependabotSecurityAdvisory{CVEID: &zeroValue} diff --git a/github/messages.go b/github/messages.go index e4fa6f6aa01..c16b6015284 100644 --- a/github/messages.go +++ b/github/messages.go @@ -54,6 +54,7 @@ var ( "content_reference": &ContentReferenceEvent{}, "create": &CreateEvent{}, "delete": &DeleteEvent{}, + "dependabot_alert": &DependabotAlertEvent{}, "deploy_key": &DeployKeyEvent{}, "deployment": &DeploymentEvent{}, "deployment_status": &DeploymentStatusEvent{}, diff --git a/github/messages_test.go b/github/messages_test.go index 193501f90b1..1243d755be8 100644 --- a/github/messages_test.go +++ b/github/messages_test.go @@ -284,6 +284,10 @@ func TestParseWebHook(t *testing.T) { payload: &DeleteEvent{}, messageType: "delete", }, + { + payload: &DependabotAlertEvent{}, + messageType: "dependabot_alert", + }, { payload: &DeployKeyEvent{}, messageType: "deploy_key", diff --git a/github/repos_hooks_deliveries_test.go b/github/repos_hooks_deliveries_test.go index d5e1a383796..057d7121df4 100644 --- a/github/repos_hooks_deliveries_test.go +++ b/github/repos_hooks_deliveries_test.go @@ -150,6 +150,7 @@ var hookDeliveryPayloadTypeToStruct = map[string]interface{}{ "content_reference": &ContentReferenceEvent{}, "create": &CreateEvent{}, "delete": &DeleteEvent{}, + "dependabot_alert": &DependabotAlertEvent{}, "deploy_key": &DeployKeyEvent{}, "deployment": &DeploymentEvent{}, "deployment_status": &DeploymentStatusEvent{}, From b9774adb40c5af048ef3fd1a777cc2b918d7af27 Mon Sep 17 00:00:00 2001 From: Nikita Pivkin Date: Wed, 30 Aug 2023 01:14:11 +0700 Subject: [PATCH 006/145] Add missing fields to SecurityAdvisoryEvent and rename others (#2889) --- github/dependabot_alerts.go | 6 +- github/event_types.go | 9 + github/event_types_test.go | 306 ++++++++++++++++++++++++++++++++ github/github-accessors.go | 58 +++++- github/github-accessors_test.go | 58 +++++- 5 files changed, 421 insertions(+), 16 deletions(-) diff --git a/github/dependabot_alerts.go b/github/dependabot_alerts.go index e39ed277caf..177316b1dc8 100644 --- a/github/dependabot_alerts.go +++ b/github/dependabot_alerts.go @@ -17,8 +17,8 @@ type Dependency struct { Scope *string `json:"scope,omitempty"` } -// AdvisoryCVSs represents the advisory pertaining to the Common Vulnerability Scoring System. -type AdvisoryCVSs struct { +// AdvisoryCVSS represents the advisory pertaining to the Common Vulnerability Scoring System. +type AdvisoryCVSS struct { Score *float64 `json:"score,omitempty"` VectorString *string `json:"vector_string,omitempty"` } @@ -37,7 +37,7 @@ type DependabotSecurityAdvisory struct { Description *string `json:"description,omitempty"` Vulnerabilities []*AdvisoryVulnerability `json:"vulnerabilities,omitempty"` Severity *string `json:"severity,omitempty"` - CVSs *AdvisoryCVSs `json:"cvss,omitempty"` + CVSS *AdvisoryCVSS `json:"cvss,omitempty"` CWEs []*AdvisoryCWEs `json:"cwes,omitempty"` Identifiers []*AdvisoryIdentifier `json:"identifiers,omitempty"` References []*AdvisoryReference `json:"references,omitempty"` diff --git a/github/event_types.go b/github/event_types.go index d402e872463..1a403da9b9d 100644 --- a/github/event_types.go +++ b/github/event_types.go @@ -1610,6 +1610,8 @@ type WorkflowRunEvent struct { // // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#security_advisory type SecurityAdvisory struct { + CVSS *AdvisoryCVSS `json:"cvss,omitempty"` + CWEs []*AdvisoryCWEs `json:"cwes,omitempty"` GHSAID *string `json:"ghsa_id,omitempty"` Summary *string `json:"summary,omitempty"` Description *string `json:"description,omitempty"` @@ -1658,6 +1660,13 @@ type FirstPatchedVersion struct { type SecurityAdvisoryEvent struct { Action *string `json:"action,omitempty"` SecurityAdvisory *SecurityAdvisory `json:"security_advisory,omitempty"` + + // The following fields are only populated by Webhook events. + Enterprise *Enterprise `json:"enterprise,omitempty"` + Installation *Installation `json:"installation,omitempty"` + Organization *Organization `json:"organization,omitempty"` + Repository *Repository `json:"repository,omitempty"` + Sender *User `json:"sender,omitempty"` } // CodeScanningAlertEvent is triggered when a code scanning finds a potential vulnerability or error in your code. diff --git a/github/event_types_test.go b/github/event_types_test.go index 485b1953d19..cd8b64e5a99 100644 --- a/github/event_types_test.go +++ b/github/event_types_test.go @@ -16769,6 +16769,16 @@ func TestSecurityAdvisoryEvent_Marshal(t *testing.T) { u := &SecurityAdvisoryEvent{ Action: String("published"), SecurityAdvisory: &SecurityAdvisory{ + CVSS: &AdvisoryCVSS{ + Score: Float64(1.0), + VectorString: String("vs"), + }, + CWEs: []*AdvisoryCWEs{ + { + CWEID: String("cweid"), + Name: String("n"), + }, + }, GHSAID: String("GHSA-rf4j-j272-some"), Summary: String("Siuuuuuuuuu"), Description: String("desc"), @@ -16801,6 +16811,147 @@ func TestSecurityAdvisoryEvent_Marshal(t *testing.T) { }, }, }, + Enterprise: &Enterprise{ + ID: Int(1), + Slug: String("s"), + Name: String("n"), + NodeID: String("nid"), + AvatarURL: String("au"), + Description: String("d"), + WebsiteURL: String("wu"), + HTMLURL: String("hu"), + CreatedAt: &Timestamp{referenceTime}, + UpdatedAt: &Timestamp{referenceTime}, + }, + Installation: &Installation{ + ID: Int64(1), + NodeID: String("nid"), + AppID: Int64(1), + AppSlug: String("as"), + TargetID: Int64(1), + Account: &User{ + Login: String("l"), + ID: Int64(1), + URL: String("u"), + AvatarURL: String("a"), + GravatarID: String("g"), + Name: String("n"), + Company: String("c"), + Blog: String("b"), + Location: String("l"), + Email: String("e"), + Hireable: Bool(true), + Bio: String("b"), + TwitterUsername: String("t"), + PublicRepos: Int(1), + Followers: Int(1), + Following: Int(1), + CreatedAt: &Timestamp{referenceTime}, + SuspendedAt: &Timestamp{referenceTime}, + }, + AccessTokensURL: String("atu"), + RepositoriesURL: String("ru"), + HTMLURL: String("hu"), + TargetType: String("tt"), + SingleFileName: String("sfn"), + RepositorySelection: String("rs"), + Events: []string{"e"}, + SingleFilePaths: []string{"s"}, + Permissions: &InstallationPermissions{ + Actions: String("a"), + Administration: String("ad"), + Checks: String("c"), + Contents: String("co"), + ContentReferences: String("cr"), + Deployments: String("d"), + Environments: String("e"), + Issues: String("i"), + Metadata: String("md"), + Members: String("m"), + OrganizationAdministration: String("oa"), + OrganizationHooks: String("oh"), + OrganizationPlan: String("op"), + OrganizationPreReceiveHooks: String("opr"), + OrganizationProjects: String("op"), + OrganizationSecrets: String("os"), + OrganizationSelfHostedRunners: String("osh"), + OrganizationUserBlocking: String("oub"), + Packages: String("pkg"), + Pages: String("pg"), + PullRequests: String("pr"), + RepositoryHooks: String("rh"), + RepositoryProjects: String("rp"), + RepositoryPreReceiveHooks: String("rprh"), + Secrets: String("s"), + SecretScanningAlerts: String("ssa"), + SecurityEvents: String("se"), + SingleFile: String("sf"), + Statuses: String("s"), + TeamDiscussions: String("td"), + VulnerabilityAlerts: String("va"), + Workflows: String("w"), + }, + CreatedAt: &Timestamp{referenceTime}, + UpdatedAt: &Timestamp{referenceTime}, + HasMultipleSingleFiles: Bool(false), + SuspendedBy: &User{ + Login: String("l"), + ID: Int64(1), + URL: String("u"), + AvatarURL: String("a"), + GravatarID: String("g"), + Name: String("n"), + Company: String("c"), + Blog: String("b"), + Location: String("l"), + Email: String("e"), + Hireable: Bool(true), + Bio: String("b"), + TwitterUsername: String("t"), + PublicRepos: Int(1), + Followers: Int(1), + Following: Int(1), + CreatedAt: &Timestamp{referenceTime}, + SuspendedAt: &Timestamp{referenceTime}, + }, + SuspendedAt: &Timestamp{referenceTime}, + }, + Organization: &Organization{ + BillingEmail: String("be"), + Blog: String("b"), + Company: String("c"), + Email: String("e"), + TwitterUsername: String("tu"), + Location: String("loc"), + Name: String("n"), + Description: String("d"), + IsVerified: Bool(true), + HasOrganizationProjects: Bool(true), + HasRepositoryProjects: Bool(true), + DefaultRepoPermission: String("drp"), + MembersCanCreateRepos: Bool(true), + MembersCanCreateInternalRepos: Bool(true), + MembersCanCreatePrivateRepos: Bool(true), + MembersCanCreatePublicRepos: Bool(false), + MembersAllowedRepositoryCreationType: String("marct"), + MembersCanCreatePages: Bool(true), + MembersCanCreatePublicPages: Bool(false), + MembersCanCreatePrivatePages: Bool(true), + }, + Repository: &Repository{ + ID: Int64(1), + URL: String("s"), + Name: String("n"), + }, + Sender: &User{ + Login: String("l"), + ID: Int64(1), + NodeID: String("n"), + URL: String("u"), + ReposURL: String("r"), + EventsURL: String("e"), + AvatarURL: String("a"), + }, } want := `{ @@ -16808,6 +16959,16 @@ func TestSecurityAdvisoryEvent_Marshal(t *testing.T) { "security_advisory": { "ghsa_id": "GHSA-rf4j-j272-some", "summary": "Siuuuuuuuuu", + "cvss": { + "score": 1.0, + "vector_string": "vs" + }, + "cwes": [ + { + "cwe_id": "cweid", + "name": "n" + } + ], "description": "desc", "severity": "moderate", "identifiers": [ @@ -16837,6 +16998,151 @@ func TestSecurityAdvisoryEvent_Marshal(t *testing.T) { } } ] + }, + "enterprise": { + "id": 1, + "slug": "s", + "name": "n", + "node_id": "nid", + "avatar_url": "au", + "description": "d", + "website_url": "wu", + "html_url": "hu", + "created_at": ` + referenceTimeStr + `, + "updated_at": ` + referenceTimeStr + ` + }, + "installation": { + "id": 1, + "node_id": "nid", + "app_id": 1, + "app_slug": "as", + "target_id": 1, + "account": { + "login": "l", + "id": 1, + "avatar_url": "a", + "gravatar_id": "g", + "name": "n", + "company": "c", + "blog": "b", + "location": "l", + "email": "e", + "hireable": true, + "bio": "b", + "twitter_username": "t", + "public_repos": 1, + "followers": 1, + "following": 1, + "created_at": ` + referenceTimeStr + `, + "suspended_at": ` + referenceTimeStr + `, + "url": "u" + }, + "access_tokens_url": "atu", + "repositories_url": "ru", + "html_url": "hu", + "target_type": "tt", + "single_file_name": "sfn", + "repository_selection": "rs", + "events": [ + "e" + ], + "single_file_paths": [ + "s" + ], + "permissions": { + "actions": "a", + "administration": "ad", + "checks": "c", + "contents": "co", + "content_references": "cr", + "deployments": "d", + "environments": "e", + "issues": "i", + "metadata": "md", + "members": "m", + "organization_administration": "oa", + "organization_hooks": "oh", + "organization_plan": "op", + "organization_pre_receive_hooks": "opr", + "organization_projects": "op", + "organization_secrets": "os", + "organization_self_hosted_runners": "osh", + "organization_user_blocking": "oub", + "packages": "pkg", + "pages": "pg", + "pull_requests": "pr", + "repository_hooks": "rh", + "repository_projects": "rp", + "repository_pre_receive_hooks": "rprh", + "secrets": "s", + "secret_scanning_alerts": "ssa", + "security_events": "se", + "single_file": "sf", + "statuses": "s", + "team_discussions": "td", + "vulnerability_alerts": "va", + "workflows": "w" + }, + "created_at": ` + referenceTimeStr + `, + "updated_at": ` + referenceTimeStr + `, + "has_multiple_single_files": false, + "suspended_by": { + "login": "l", + "id": 1, + "avatar_url": "a", + "gravatar_id": "g", + "name": "n", + "company": "c", + "blog": "b", + "location": "l", + "email": "e", + "hireable": true, + "bio": "b", + "twitter_username": "t", + "public_repos": 1, + "followers": 1, + "following": 1, + "created_at": ` + referenceTimeStr + `, + "suspended_at": ` + referenceTimeStr + `, + "url": "u" + }, + "suspended_at": ` + referenceTimeStr + ` + }, + "organization": { + "name": "n", + "company": "c", + "blog": "b", + "location": "loc", + "email": "e", + "twitter_username": "tu", + "description": "d", + "billing_email": "be", + "is_verified": true, + "has_organization_projects": true, + "has_repository_projects": true, + "default_repository_permission": "drp", + "members_can_create_repositories": true, + "members_can_create_public_repositories": false, + "members_can_create_private_repositories": true, + "members_can_create_internal_repositories": true, + "members_allowed_repository_creation_type": "marct", + "members_can_create_pages": true, + "members_can_create_public_pages": false, + "members_can_create_private_pages": true + }, + "repository": { + "id": 1, + "url": "s", + "name": "n" + }, + "sender": { + "login": "l", + "id": 1, + "node_id": "n", + "avatar_url": "a", + "url": "u", + "events_url": "e", + "repos_url": "r" } }` diff --git a/github/github-accessors.go b/github/github-accessors.go index 113053627c0..d9b730396ff 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -343,7 +343,7 @@ func (a *AdvancedSecurityCommittersBreakdown) GetUserLogin() string { } // GetScore returns the Score field. -func (a *AdvisoryCVSs) GetScore() *float64 { +func (a *AdvisoryCVSS) GetScore() *float64 { if a == nil { return nil } @@ -351,7 +351,7 @@ func (a *AdvisoryCVSs) GetScore() *float64 { } // GetVectorString returns the VectorString field if it's non-nil, zero value otherwise. -func (a *AdvisoryCVSs) GetVectorString() string { +func (a *AdvisoryCVSS) GetVectorString() string { if a == nil || a.VectorString == nil { return "" } @@ -5118,12 +5118,12 @@ func (d *DependabotSecurityAdvisory) GetCVEID() string { return *d.CVEID } -// GetCVSs returns the CVSs field. -func (d *DependabotSecurityAdvisory) GetCVSs() *AdvisoryCVSs { +// GetCVSS returns the CVSS field. +func (d *DependabotSecurityAdvisory) GetCVSS() *AdvisoryCVSS { if d == nil { return nil } - return d.CVSs + return d.CVSS } // GetDescription returns the Description field if it's non-nil, zero value otherwise. @@ -20694,6 +20694,14 @@ func (s *SecretScanningPushProtection) GetStatus() string { return *s.Status } +// GetCVSS returns the CVSS field. +func (s *SecurityAdvisory) GetCVSS() *AdvisoryCVSS { + if s == nil { + return nil + } + return s.CVSS +} + // GetDescription returns the Description field if it's non-nil, zero value otherwise. func (s *SecurityAdvisory) GetDescription() string { if s == nil || s.Description == nil { @@ -20758,6 +20766,38 @@ func (s *SecurityAdvisoryEvent) GetAction() string { return *s.Action } +// GetEnterprise returns the Enterprise field. +func (s *SecurityAdvisoryEvent) GetEnterprise() *Enterprise { + if s == nil { + return nil + } + return s.Enterprise +} + +// GetInstallation returns the Installation field. +func (s *SecurityAdvisoryEvent) GetInstallation() *Installation { + if s == nil { + return nil + } + return s.Installation +} + +// GetOrganization returns the Organization field. +func (s *SecurityAdvisoryEvent) GetOrganization() *Organization { + if s == nil { + return nil + } + return s.Organization +} + +// GetRepository returns the Repository field. +func (s *SecurityAdvisoryEvent) GetRepository() *Repository { + if s == nil { + return nil + } + return s.Repository +} + // GetSecurityAdvisory returns the SecurityAdvisory field. func (s *SecurityAdvisoryEvent) GetSecurityAdvisory() *SecurityAdvisory { if s == nil { @@ -20766,6 +20806,14 @@ func (s *SecurityAdvisoryEvent) GetSecurityAdvisory() *SecurityAdvisory { return s.SecurityAdvisory } +// GetSender returns the Sender field. +func (s *SecurityAdvisoryEvent) GetSender() *User { + if s == nil { + return nil + } + return s.Sender +} + // GetAdvancedSecurity returns the AdvancedSecurity field. func (s *SecurityAndAnalysis) GetAdvancedSecurity() *AdvancedSecurity { if s == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 7ced903790e..6abb7fea56a 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -392,18 +392,18 @@ func TestAdvancedSecurityCommittersBreakdown_GetUserLogin(tt *testing.T) { a.GetUserLogin() } -func TestAdvisoryCVSs_GetScore(tt *testing.T) { - a := &AdvisoryCVSs{} +func TestAdvisoryCVSS_GetScore(tt *testing.T) { + a := &AdvisoryCVSS{} a.GetScore() a = nil a.GetScore() } -func TestAdvisoryCVSs_GetVectorString(tt *testing.T) { +func TestAdvisoryCVSS_GetVectorString(tt *testing.T) { var zeroValue string - a := &AdvisoryCVSs{VectorString: &zeroValue} + a := &AdvisoryCVSS{VectorString: &zeroValue} a.GetVectorString() - a = &AdvisoryCVSs{} + a = &AdvisoryCVSS{} a.GetVectorString() a = nil a.GetVectorString() @@ -6023,11 +6023,11 @@ func TestDependabotSecurityAdvisory_GetCVEID(tt *testing.T) { d.GetCVEID() } -func TestDependabotSecurityAdvisory_GetCVSs(tt *testing.T) { +func TestDependabotSecurityAdvisory_GetCVSS(tt *testing.T) { d := &DependabotSecurityAdvisory{} - d.GetCVSs() + d.GetCVSS() d = nil - d.GetCVSs() + d.GetCVSS() } func TestDependabotSecurityAdvisory_GetDescription(tt *testing.T) { @@ -24116,6 +24116,13 @@ func TestSecretScanningPushProtection_GetStatus(tt *testing.T) { s.GetStatus() } +func TestSecurityAdvisory_GetCVSS(tt *testing.T) { + s := &SecurityAdvisory{} + s.GetCVSS() + s = nil + s.GetCVSS() +} + func TestSecurityAdvisory_GetDescription(tt *testing.T) { var zeroValue string s := &SecurityAdvisory{Description: &zeroValue} @@ -24196,6 +24203,34 @@ func TestSecurityAdvisoryEvent_GetAction(tt *testing.T) { s.GetAction() } +func TestSecurityAdvisoryEvent_GetEnterprise(tt *testing.T) { + s := &SecurityAdvisoryEvent{} + s.GetEnterprise() + s = nil + s.GetEnterprise() +} + +func TestSecurityAdvisoryEvent_GetInstallation(tt *testing.T) { + s := &SecurityAdvisoryEvent{} + s.GetInstallation() + s = nil + s.GetInstallation() +} + +func TestSecurityAdvisoryEvent_GetOrganization(tt *testing.T) { + s := &SecurityAdvisoryEvent{} + s.GetOrganization() + s = nil + s.GetOrganization() +} + +func TestSecurityAdvisoryEvent_GetRepository(tt *testing.T) { + s := &SecurityAdvisoryEvent{} + s.GetRepository() + s = nil + s.GetRepository() +} + func TestSecurityAdvisoryEvent_GetSecurityAdvisory(tt *testing.T) { s := &SecurityAdvisoryEvent{} s.GetSecurityAdvisory() @@ -24203,6 +24238,13 @@ func TestSecurityAdvisoryEvent_GetSecurityAdvisory(tt *testing.T) { s.GetSecurityAdvisory() } +func TestSecurityAdvisoryEvent_GetSender(tt *testing.T) { + s := &SecurityAdvisoryEvent{} + s.GetSender() + s = nil + s.GetSender() +} + func TestSecurityAndAnalysis_GetAdvancedSecurity(tt *testing.T) { s := &SecurityAndAnalysis{} s.GetAdvancedSecurity() From 68ffeb7dbf9902052e441db4ec83d828534de84a Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Tue, 29 Aug 2023 14:25:56 -0400 Subject: [PATCH 007/145] Fix merge issue from field renaming (#2906) Fixes: #2905. --- github/event_types_test.go | 2 +- go.sum | 36 ------------------------------------ 2 files changed, 1 insertion(+), 37 deletions(-) diff --git a/github/event_types_test.go b/github/event_types_test.go index cd8b64e5a99..31b94479f3b 100644 --- a/github/event_types_test.go +++ b/github/event_types_test.go @@ -12731,7 +12731,7 @@ func TestDependabotAlertEvent_Marshal(t *testing.T) { }, }, Severity: String("s"), - CVSs: &AdvisoryCVSs{ + CVSS: &AdvisoryCVSS{ Score: Float64(1.0), VectorString: String("vs"), }, diff --git a/go.sum b/go.sum index 68e49aed424..3317d0c67b7 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,6 @@ github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 h1:wPbRQzjjwFc0ih8puEVAOFGELsn1zoIIYdxvML7mDxA= github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8/go.mod h1:I0gYDMZ6Z5GRU7l58bNFSkPTFN6Yl12dsUlAZ8xy98g= github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= -github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/cloudflare/circl v1.1.0/go.mod h1:prBCrKB9DV4poKZY1l9zBXg2QJY7mvgRvtMxxK7fi4I= github.com/cloudflare/circl v1.3.3 h1:fE/Qz0QdIGqeWfnwq0RE0R7MI51s0M2E4Ga9kq5AEMs= github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= @@ -10,51 +9,16 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= -golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= From e3cda7864bceb2bbbed07fb2f353446bdc13590d Mon Sep 17 00:00:00 2001 From: Jarek Porzucek <17789797+jporzucek@users.noreply.github.com> Date: Wed, 30 Aug 2023 16:41:29 +0200 Subject: [PATCH 008/145] Add missing CodeScanning endpoints (#2900) Fixes: #2899. --- github/code-scanning.go | 189 +++++++++++++- github/code-scanning_test.go | 433 +++++++++++++++++++++++++++++--- github/github-accessors.go | 120 +++++++++ github/github-accessors_test.go | 147 +++++++++++ 4 files changed, 839 insertions(+), 50 deletions(-) diff --git a/github/code-scanning.go b/github/code-scanning.go index 09c03647876..0ae269be676 100644 --- a/github/code-scanning.go +++ b/github/code-scanning.go @@ -48,11 +48,13 @@ type Message struct { type MostRecentInstance struct { Ref *string `json:"ref,omitempty"` AnalysisKey *string `json:"analysis_key,omitempty"` + Category *string `json:"category,omitempty"` Environment *string `json:"environment,omitempty"` State *string `json:"state,omitempty"` CommitSHA *string `json:"commit_sha,omitempty"` Message *Message `json:"message,omitempty"` Location *Location `json:"location,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` Classifications []string `json:"classifications,omitempty"` } @@ -113,13 +115,22 @@ func (a *Alert) ID() int64 { return id } -// AlertListOptions specifies optional parameters to the CodeScanningService.ListAlerts -// method. +// AlertInstancesListOptions specifies optional parameters to the CodeScanningService.ListAlertInstances method. +type AlertInstancesListOptions struct { + // Return code scanning alert instances for a specific branch reference. + // The ref can be formatted as refs/heads/ or simply . To reference a pull request use refs/pull//merge + Ref string `url:"ref,omitempty"` + + ListOptions +} + +// AlertListOptions specifies optional parameters to the CodeScanningService.ListAlerts method. type AlertListOptions struct { // State of the code scanning alerts to list. Set to closed to list only closed code scanning alerts. Default: open State string `url:"state,omitempty"` - // Return code scanning alerts for a specific branch reference. The ref must be formatted as heads/. + // Return code scanning alerts for a specific branch reference. + // The ref can be formatted as refs/heads/ or simply . To reference a pull request use refs/pull//merge Ref string `url:"ref,omitempty"` // If specified, only code scanning alerts with this severity will be returned. Possible values are: critical, high, medium, low, warning, note, error. @@ -140,12 +151,28 @@ type AnalysesListOptions struct { // Return code scanning analyses belonging to the same SARIF upload. SarifID *string `url:"sarif_id,omitempty"` - // Return code scanning analyses for a specific branch reference. The ref can be formatted as refs/heads/ or simply . + // Return code scanning analyses for a specific branch reference. + // The ref can be formatted as refs/heads/ or simply . To reference a pull request use refs/pull//merge Ref *string `url:"ref,omitempty"` ListOptions } +// CodeQLDatabase represents a metadata about the CodeQL database. +// +// GitHub API docs: https://docs.github.com/en/rest/code-scanning +type CodeQLDatabase struct { + ID *int64 `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Language *string `json:"language,omitempty"` + Uploader *User `json:"uploader,omitempty"` + ContentType *string `json:"content_type,omitempty"` + Size *int64 `json:"size,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + URL *string `json:"url,omitempty"` +} + // ScanningAnalysis represents an individual GitHub Code Scanning ScanningAnalysis on a single repository. // // GitHub API docs: https://docs.github.com/en/rest/code-scanning @@ -208,7 +235,7 @@ type SarifID struct { // You must use an access token with the security_events scope to use this endpoint. GitHub Apps must have the security_events // read permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/code-scanning#list-code-scanning-alerts-for-an-organization +// GitHub API docs: https://docs.github.com/en/rest/code-scanning/code-scanning#list-code-scanning-alerts-for-an-organization func (s *CodeScanningService) ListAlertsForOrg(ctx context.Context, org string, opts *AlertListOptions) ([]*Alert, *Response, error) { u := fmt.Sprintf("orgs/%v/code-scanning/alerts", org) u, err := addOptions(u, opts) @@ -236,7 +263,7 @@ func (s *CodeScanningService) ListAlertsForOrg(ctx context.Context, org string, // You must use an access token with the security_events scope to use this endpoint. GitHub Apps must have the security_events // read permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/code-scanning#list-code-scanning-alerts-for-a-repository +// GitHub API docs: https://docs.github.com/en/rest/code-scanning/code-scanning#list-code-scanning-alerts-for-a-repository func (s *CodeScanningService) ListAlertsForRepo(ctx context.Context, owner, repo string, opts *AlertListOptions) ([]*Alert, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/alerts", owner, repo) u, err := addOptions(u, opts) @@ -265,7 +292,7 @@ func (s *CodeScanningService) ListAlertsForRepo(ctx context.Context, owner, repo // // The security alert_id is the number at the end of the security alert's URL. // -// GitHub API docs: https://docs.github.com/en/rest/code-scanning#get-a-code-scanning-alert +// GitHub API docs: https://docs.github.com/en/rest/code-scanning/code-scanning#get-a-code-scanning-alert func (s *CodeScanningService) GetAlert(ctx context.Context, owner, repo string, id int64) (*Alert, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/alerts/%v", owner, repo, id) @@ -308,13 +335,40 @@ func (s *CodeScanningService) UpdateAlert(ctx context.Context, owner, repo strin return a, resp, nil } +// ListAlertInstances lists instances of a code scanning alert. +// +// You must use an access token with the security_events scope to use this endpoint. +// GitHub Apps must have the security_events read permission to use this endpoint. +// +// GitHub API docs: https://docs.github.com/en/rest/code-scanning/code-scanning#list-instances-of-a-code-scanning-alert +func (s *CodeScanningService) ListAlertInstances(ctx context.Context, owner, repo string, id int64, opts *AlertInstancesListOptions) ([]*MostRecentInstance, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/code-scanning/alerts/%v/instances", owner, repo, id) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var alertInstances []*MostRecentInstance + resp, err := s.client.Do(ctx, req, &alertInstances) + if err != nil { + return nil, resp, err + } + + return alertInstances, resp, nil +} + // UploadSarif uploads the result of code scanning job to GitHub. // // For the parameter sarif, you must first compress your SARIF file using gzip and then translate the contents of the file into a Base64 encoding string. // You must use an access token with the security_events scope to use this endpoint. GitHub Apps must have the security_events // write permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/code-scanning#upload-an-analysis-as-sarif-data +// GitHub API docs: https://docs.github.com/en/rest/code-scanning/code-scanning#upload-an-analysis-as-sarif-data func (s *CodeScanningService) UploadSarif(ctx context.Context, owner, repo string, sarif *SarifAnalysis) (*SarifID, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/sarifs", owner, repo) @@ -332,13 +386,45 @@ func (s *CodeScanningService) UploadSarif(ctx context.Context, owner, repo strin return sarifID, resp, nil } +// SARIFUpload represents information about a SARIF upload. +type SARIFUpload struct { + // `pending` files have not yet been processed, while `complete` means results from the SARIF have been stored. + // `failed` files have either not been processed at all, or could only be partially processed. + ProcessingStatus *string `json:"processing_status,omitempty"` + // The REST API URL for getting the analyses associated with the upload. + AnalysesURL *string `json:"analyses_url,omitempty"` +} + +// GetSARIF gets information about a SARIF upload. +// +// You must use an access token with the security_events scope to use this endpoint. +// GitHub Apps must have the security_events read permission to use this endpoint. +// +// GitHub API docs: https://docs.github.com/en/rest/code-scanning/code-scanning#get-information-about-a-sarif-upload +func (s *CodeScanningService) GetSARIF(ctx context.Context, owner, repo, sarifID string) (*SARIFUpload, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/code-scanning/sarifs/%v", owner, repo, sarifID) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + sarifUpload := new(SARIFUpload) + resp, err := s.client.Do(ctx, req, sarifUpload) + if err != nil { + return nil, resp, err + } + + return sarifUpload, resp, nil +} + // ListAnalysesForRepo lists code scanning analyses for a repository. // // Lists the details of all code scanning analyses for a repository, starting with the most recent. // You must use an access token with the security_events scope to use this endpoint. // GitHub Apps must have the security_events read permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/code-scanning#list-code-scanning-analyses-for-a-repository +// GitHub API docs: https://docs.github.com/en/rest/code-scanning/code-scanning#list-code-scanning-analyses-for-a-repository func (s *CodeScanningService) ListAnalysesForRepo(ctx context.Context, owner, repo string, opts *AnalysesListOptions) ([]*ScanningAnalysis, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/analyses", owner, repo) u, err := addOptions(u, opts) @@ -367,7 +453,7 @@ func (s *CodeScanningService) ListAnalysesForRepo(ctx context.Context, owner, re // // The security analysis_id is the ID of the analysis, as returned from the ListAnalysesForRepo operation. // -// GitHub API docs: https://docs.github.com/en/rest/code-scanning#get-a-code-scanning-analysis-for-a-repository +// GitHub API docs: https://docs.github.com/en/rest/code-scanning/code-scanning#get-a-code-scanning-analysis-for-a-repository func (s *CodeScanningService) GetAnalysis(ctx context.Context, owner, repo string, id int64) (*ScanningAnalysis, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/analyses/%v", owner, repo, id) @@ -385,6 +471,85 @@ func (s *CodeScanningService) GetAnalysis(ctx context.Context, owner, repo strin return analysis, resp, nil } +// DeleteAnalysis represents a successful deletion of a code scanning analysis. +type DeleteAnalysis struct { + // Next deletable analysis in chain, without last analysis deletion confirmation + NextAnalysisURL *string `json:"next_analysis_url,omitempty"` + // Next deletable analysis in chain, with last analysis deletion confirmation + ConfirmDeleteURL *string `json:"confirm_delete_url,omitempty"` +} + +// DeleteAnalysis deletes a single code scanning analysis from a repository. +// +// You must use an access token with the repo scope to use this endpoint. +// GitHub Apps must have the security_events read permission to use this endpoint. +// +// The security analysis_id is the ID of the analysis, as returned from the ListAnalysesForRepo operation. +// +// GitHub API docs: https://docs.github.com/en/rest/code-scanning/code-scanning#delete-a-code-scanning-analysis-from-a-repository +func (s *CodeScanningService) DeleteAnalysis(ctx context.Context, owner, repo string, id int64) (*DeleteAnalysis, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/code-scanning/analyses/%v", owner, repo, id) + + req, err := s.client.NewRequest("DELETE", u, nil) + if err != nil { + return nil, nil, err + } + + deleteAnalysis := new(DeleteAnalysis) + resp, err := s.client.Do(ctx, req, deleteAnalysis) + if err != nil { + return nil, resp, err + } + + return deleteAnalysis, resp, nil +} + +// ListCodeQLDatabases lists the CodeQL databases that are available in a repository. +// +// You must use an access token with the security_events scope to use this endpoint. +// GitHub Apps must have the contents read permission to use this endpoint. +// +// GitHub API docs: https://docs.github.com/en/rest/code-scanning/code-scanning#list-codeql-databases-for-a-repository +func (s *CodeScanningService) ListCodeQLDatabases(ctx context.Context, owner, repo string) ([]*CodeQLDatabase, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/code-scanning/codeql/databases", owner, repo) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var codeqlDatabases []*CodeQLDatabase + resp, err := s.client.Do(ctx, req, &codeqlDatabases) + if err != nil { + return nil, resp, err + } + + return codeqlDatabases, resp, nil +} + +// GetCodeQLDatabase gets a CodeQL database for a language in a repository. +// +// You must use an access token with the security_events scope to use this endpoint. +// GitHub Apps must have the contents read permission to use this endpoint. +// +// GitHub API docs: https://docs.github.com/en/rest/code-scanning/code-scanning#get-a-codeql-database-for-a-repository +func (s *CodeScanningService) GetCodeQLDatabase(ctx context.Context, owner, repo, language string) (*CodeQLDatabase, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/code-scanning/codeql/databases/%v", owner, repo, language) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + codeqlDatabase := new(CodeQLDatabase) + resp, err := s.client.Do(ctx, req, codeqlDatabase) + if err != nil { + return nil, resp, err + } + + return codeqlDatabase, resp, nil +} + // DefaultSetupConfiguration represents a code scanning default setup configuration. type DefaultSetupConfiguration struct { State *string `json:"state,omitempty"` @@ -399,7 +564,7 @@ type DefaultSetupConfiguration struct { // endpoint with private repos or the public_repo scope for public repos. GitHub Apps must have the repo write // permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/code-scanning#get-a-code-scanning-default-setup-configuration +// GitHub API docs: https://docs.github.com/en/rest/code-scanning/code-scanning#get-a-code-scanning-default-setup-configuration func (s *CodeScanningService) GetDefaultSetupConfiguration(ctx context.Context, owner, repo string) (*DefaultSetupConfiguration, *Response, error) { u := fmt.Sprintf("repos/%s/%s/code-scanning/default-setup", owner, repo) @@ -440,7 +605,7 @@ type UpdateDefaultSetupConfigurationResponse struct { // This method might return an AcceptedError and a status code of 202. This is because this is the status that GitHub // returns to signify that it has now scheduled the update of the pull request branch in a background task. // -// GitHub API docs: https://docs.github.com/en/rest/code-scanning#update-a-code-scanning-default-setup-configuration +// GitHub API docs: https://docs.github.com/en/rest/code-scanning/code-scanning#update-a-code-scanning-default-setup-configuration func (s *CodeScanningService) UpdateDefaultSetupConfiguration(ctx context.Context, owner, repo string, options *UpdateDefaultSetupConfigurationOptions) (*UpdateDefaultSetupConfigurationResponse, *Response, error) { u := fmt.Sprintf("repos/%s/%s/code-scanning/default-setup", owner, repo) diff --git a/github/code-scanning_test.go b/github/code-scanning_test.go index 20d4817d3f1..e42f1d8b37f 100644 --- a/github/code-scanning_test.go +++ b/github/code-scanning_test.go @@ -89,6 +89,47 @@ func TestCodeScanningService_UploadSarif(t *testing.T) { }) } +func TestCodeScanningService_GetSARIF(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/repos/o/r/code-scanning/sarifs/abc", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + fmt.Fprint(w, `{ + "processing_status": "s", + "analyses_url": "u" + }`) + }) + + ctx := context.Background() + sarifUpload, _, err := client.CodeScanning.GetSARIF(ctx, "o", "r", "abc") + if err != nil { + t.Errorf("CodeScanning.GetSARIF returned error: %v", err) + } + + want := &SARIFUpload{ + ProcessingStatus: String("s"), + AnalysesURL: String("u"), + } + if !cmp.Equal(sarifUpload, want) { + t.Errorf("CodeScanning.GetSARIF returned %+v, want %+v", sarifUpload, want) + } + + const methodName = "GetSARIF" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.CodeScanning.GetSARIF(ctx, "\n", "\n", "\n") + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.CodeScanning.GetSARIF(ctx, "o", "r", "abc") + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + func TestCodeScanningService_ListAlertsForOrg(t *testing.T) { client, mux, _, teardown := setup() defer teardown() @@ -730,52 +771,133 @@ func TestCodeScanningService_UpdateAlert(t *testing.T) { }) } +func TestCodeScanningService_ListAlertInstances(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/repos/o/r/code-scanning/alerts/88/instances", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + fmt.Fprint(w, `[ + { + "ref": "refs/heads/main", + "analysis_key": ".github/workflows/codeql-analysis.yml:analyze", + "environment": "", + "category": ".github/workflows/codeql-analysis.yml:analyze", + "state": "open", + "fixed_at": null, + "commit_sha": "abcdefg12345", + "message": { + "text": "This path depends on a user-provided value." + }, + "location": { + "path": "spec-main/api-session-spec.ts", + "start_line": 917, + "end_line": 917, + "start_column": 7, + "end_column": 18 + }, + "classifications": [ + "test" + ] + } + ]`) + }) + + opts := &AlertInstancesListOptions{Ref: "heads/main", ListOptions: ListOptions{Page: 1}} + ctx := context.Background() + instances, _, err := client.CodeScanning.ListAlertInstances(ctx, "o", "r", 88, opts) + if err != nil { + t.Errorf("CodeScanning.ListAlertInstances returned error: %v", err) + } + + want := []*MostRecentInstance{ + { + Ref: String("refs/heads/main"), + AnalysisKey: String(".github/workflows/codeql-analysis.yml:analyze"), + Category: String(".github/workflows/codeql-analysis.yml:analyze"), + Environment: String(""), + State: String("open"), + CommitSHA: String("abcdefg12345"), + Message: &Message{ + Text: String("This path depends on a user-provided value."), + }, + Location: &Location{ + Path: String("spec-main/api-session-spec.ts"), + StartLine: Int(917), + EndLine: Int(917), + StartColumn: Int(7), + EndColumn: Int(18), + }, + Classifications: []string{"test"}, + }, + } + if !cmp.Equal(instances, want) { + t.Errorf("CodeScanning.ListAlertInstances returned %+v, want %+v", instances, want) + } + + const methodName = "ListAlertInstances" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.CodeScanning.ListAlertInstances(ctx, "\n", "\n", -1, opts) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.CodeScanning.ListAlertInstances(ctx, "o", "r", 88, opts) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + func TestCodeScanningService_GetAlert(t *testing.T) { client, mux, _, teardown := setup() defer teardown() mux.HandleFunc("/repos/o/r/code-scanning/alerts/88", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - fmt.Fprint(w, `{"rule_id":"js/useless-expression", - "rule_severity":"warning", - "rule_description":"Expression has no effect", - "tool": { - "name": "CodeQL", - "guid": null, - "version": "1.4.0" - }, - "rule": { - "id": "useless expression", - "severity": "warning", - "description": "Expression has no effect", - "name": "useless expression", - "full_description": "Expression has no effect", - "help": "Expression has no effect" + fmt.Fprint(w, `{ + "rule_id":"js/useless-expression", + "rule_severity":"warning", + "rule_description":"Expression has no effect", + "tool": { + "name": "CodeQL", + "guid": null, + "version": "1.4.0" + }, + "rule": { + "id": "useless expression", + "severity": "warning", + "description": "Expression has no effect", + "name": "useless expression", + "full_description": "Expression has no effect", + "help": "Expression has no effect" + }, + "most_recent_instance": { + "ref": "refs/heads/main", + "state": "open", + "commit_sha": "abcdefg12345", + "message": { + "text": "This path depends on a user-provided value." }, - "most_recent_instance": { - "ref": "refs/heads/main", - "state": "open", - "commit_sha": "abcdefg12345", - "message": { - "text": "This path depends on a user-provided value." - }, - "location": { - "path": "spec-main/api-session-spec.ts", - "start_line": 917, - "end_line": 917, - "start_column": 7, - "end_column": 18 - }, - "classifications": [ - "test" - ] + "location": { + "path": "spec-main/api-session-spec.ts", + "start_line": 917, + "end_line": 917, + "start_column": 7, + "end_column": 18 }, - "created_at":"2019-01-02T15:04:05Z", - "state":"open", - "closed_by":null, - "closed_at":null, - "url":"https://api.github.com/repos/o/r/code-scanning/alerts/88", - "html_url":"https://github.com/o/r/security/code-scanning/88"}`) + "classifications": [ + "test" + ] + }, + "created_at":"2019-01-02T15:04:05Z", + "state":"open", + "closed_by":null, + "closed_at":null, + "url":"https://api.github.com/repos/o/r/code-scanning/alerts/88", + "html_url":"https://github.com/o/r/security/code-scanning/88" + }`) }) ctx := context.Background() @@ -1178,6 +1300,241 @@ func TestCodeScanningService_GetAnalysis(t *testing.T) { }) } +func TestCodeScanningService_DeleteAnalysis(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/repos/o/r/code-scanning/analyses/40", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "DELETE") + fmt.Fprint(w, `{ + "next_analysis_url": "a", + "confirm_delete_url": "b" + }`) + }) + + ctx := context.Background() + analysis, _, err := client.CodeScanning.DeleteAnalysis(ctx, "o", "r", 40) + if err != nil { + t.Errorf("CodeScanning.DeleteAnalysis returned error: %v", err) + } + + want := &DeleteAnalysis{ + NextAnalysisURL: String("a"), + ConfirmDeleteURL: String("b"), + } + if !cmp.Equal(analysis, want) { + t.Errorf("CodeScanning.DeleteAnalysis returned %+v, want %+v", analysis, want) + } + + const methodName = "DeleteAnalysis" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.CodeScanning.DeleteAnalysis(ctx, "\n", "\n", -123) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.CodeScanning.DeleteAnalysis(ctx, "o", "r", 40) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestCodeScanningService_ListCodeQLDatabases(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/repos/o/r/code-scanning/codeql/databases", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + fmt.Fprint(w, `[ + { + "id": 1, + "name": "name", + "language": "language", + "uploader": { + "login": "a", + "id": 1, + "node_id": "b", + "avatar_url": "c", + "gravatar_id": "d", + "url": "e", + "html_url": "f", + "followers_url": "g", + "following_url": "h", + "gists_url": "i", + "starred_url": "j", + "subscriptions_url": "k", + "organizations_url": "l", + "repos_url": "m", + "events_url": "n", + "received_events_url": "o", + "type": "p", + "site_admin": false + }, + "content_type": "r", + "size": 1024, + "created_at": "2021-01-13T11:55:49Z", + "updated_at": "2021-01-13T11:55:49Z", + "url": "s" + } + ]`) + }) + + ctx := context.Background() + databases, _, err := client.CodeScanning.ListCodeQLDatabases(ctx, "o", "r") + if err != nil { + t.Errorf("CodeScanning.ListCodeQLDatabases returned error: %v", err) + } + + date := &Timestamp{time.Date(2021, time.January, 13, 11, 55, 49, 0, time.UTC)} + want := []*CodeQLDatabase{ + { + ID: Int64(1), + Name: String("name"), + Language: String("language"), + Uploader: &User{ + Login: String("a"), + ID: Int64(1), + NodeID: String("b"), + AvatarURL: String("c"), + GravatarID: String("d"), + URL: String("e"), + HTMLURL: String("f"), + FollowersURL: String("g"), + FollowingURL: String("h"), + GistsURL: String("i"), + StarredURL: String("j"), + SubscriptionsURL: String("k"), + OrganizationsURL: String("l"), + ReposURL: String("m"), + EventsURL: String("n"), + ReceivedEventsURL: String("o"), + Type: String("p"), + SiteAdmin: Bool(false), + }, + ContentType: String("r"), + Size: Int64(1024), + CreatedAt: date, + UpdatedAt: date, + URL: String("s"), + }, + } + + if !cmp.Equal(databases, want) { + t.Errorf("CodeScanning.ListCodeQLDatabases returned %+v, want %+v", databases, want) + } + + const methodName = "ListCodeQLDatabases" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.CodeScanning.ListCodeQLDatabases(ctx, "\n", "\n") + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.CodeScanning.ListCodeQLDatabases(ctx, "o", "r") + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestCodeScanningService_GetCodeQLDatabase(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/repos/o/r/code-scanning/codeql/databases/lang", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + fmt.Fprint(w, `{ + "id": 1, + "name": "name", + "language": "language", + "uploader": { + "login": "a", + "id": 1, + "node_id": "b", + "avatar_url": "c", + "gravatar_id": "d", + "url": "e", + "html_url": "f", + "followers_url": "g", + "following_url": "h", + "gists_url": "i", + "starred_url": "j", + "subscriptions_url": "k", + "organizations_url": "l", + "repos_url": "m", + "events_url": "n", + "received_events_url": "o", + "type": "p", + "site_admin": false + }, + "content_type": "r", + "size": 1024, + "created_at": "2021-01-13T11:55:49Z", + "updated_at": "2021-01-13T11:55:49Z", + "url": "s" + }`) + }) + + ctx := context.Background() + database, _, err := client.CodeScanning.GetCodeQLDatabase(ctx, "o", "r", "lang") + if err != nil { + t.Errorf("CodeScanning.GetCodeQLDatabase returned error: %v", err) + } + + date := &Timestamp{time.Date(2021, time.January, 13, 11, 55, 49, 0, time.UTC)} + want := &CodeQLDatabase{ + ID: Int64(1), + Name: String("name"), + Language: String("language"), + Uploader: &User{ + Login: String("a"), + ID: Int64(1), + NodeID: String("b"), + AvatarURL: String("c"), + GravatarID: String("d"), + URL: String("e"), + HTMLURL: String("f"), + FollowersURL: String("g"), + FollowingURL: String("h"), + GistsURL: String("i"), + StarredURL: String("j"), + SubscriptionsURL: String("k"), + OrganizationsURL: String("l"), + ReposURL: String("m"), + EventsURL: String("n"), + ReceivedEventsURL: String("o"), + Type: String("p"), + SiteAdmin: Bool(false), + }, + ContentType: String("r"), + Size: Int64(1024), + CreatedAt: date, + UpdatedAt: date, + URL: String("s"), + } + + if !cmp.Equal(database, want) { + t.Errorf("CodeScanning.GetCodeQLDatabase returned %+v, want %+v", database, want) + } + + const methodName = "GetCodeQLDatabase" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.CodeScanning.GetCodeQLDatabase(ctx, "\n", "\n", "\n") + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.CodeScanning.GetCodeQLDatabase(ctx, "o", "r", "lang") + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + func TestCodeScanningService_GetDefaultSetupConfiguration(t *testing.T) { client, mux, _, teardown := setup() defer teardown() diff --git a/github/github-accessors.go b/github/github-accessors.go index d9b730396ff..560e0892eda 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -2830,6 +2830,78 @@ func (c *CodeownersError) GetSuggestion() string { return *c.Suggestion } +// GetContentType returns the ContentType field if it's non-nil, zero value otherwise. +func (c *CodeQLDatabase) GetContentType() string { + if c == nil || c.ContentType == nil { + return "" + } + return *c.ContentType +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (c *CodeQLDatabase) GetCreatedAt() Timestamp { + if c == nil || c.CreatedAt == nil { + return Timestamp{} + } + return *c.CreatedAt +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (c *CodeQLDatabase) GetID() int64 { + if c == nil || c.ID == nil { + return 0 + } + return *c.ID +} + +// GetLanguage returns the Language field if it's non-nil, zero value otherwise. +func (c *CodeQLDatabase) GetLanguage() string { + if c == nil || c.Language == nil { + return "" + } + return *c.Language +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (c *CodeQLDatabase) GetName() string { + if c == nil || c.Name == nil { + return "" + } + return *c.Name +} + +// GetSize returns the Size field if it's non-nil, zero value otherwise. +func (c *CodeQLDatabase) GetSize() int64 { + if c == nil || c.Size == nil { + return 0 + } + return *c.Size +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (c *CodeQLDatabase) GetUpdatedAt() Timestamp { + if c == nil || c.UpdatedAt == nil { + return Timestamp{} + } + return *c.UpdatedAt +} + +// GetUploader returns the Uploader field. +func (c *CodeQLDatabase) GetUploader() *User { + if c == nil { + return nil + } + return c.Uploader +} + +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (c *CodeQLDatabase) GetURL() string { + if c == nil || c.URL == nil { + return "" + } + return *c.URL +} + // GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. func (c *CodeResult) GetHTMLURL() string { if c == nil || c.HTMLURL == nil { @@ -4878,6 +4950,22 @@ func (d *DefaultSetupConfiguration) GetUpdatedAt() Timestamp { return *d.UpdatedAt } +// GetConfirmDeleteURL returns the ConfirmDeleteURL field if it's non-nil, zero value otherwise. +func (d *DeleteAnalysis) GetConfirmDeleteURL() string { + if d == nil || d.ConfirmDeleteURL == nil { + return "" + } + return *d.ConfirmDeleteURL +} + +// GetNextAnalysisURL returns the NextAnalysisURL field if it's non-nil, zero value otherwise. +func (d *DeleteAnalysis) GetNextAnalysisURL() string { + if d == nil || d.NextAnalysisURL == nil { + return "" + } + return *d.NextAnalysisURL +} + // GetInstallation returns the Installation field. func (d *DeleteEvent) GetInstallation() *Installation { if d == nil { @@ -11382,6 +11470,14 @@ func (m *MostRecentInstance) GetAnalysisKey() string { return *m.AnalysisKey } +// GetCategory returns the Category field if it's non-nil, zero value otherwise. +func (m *MostRecentInstance) GetCategory() string { + if m == nil || m.Category == nil { + return "" + } + return *m.Category +} + // GetCommitSHA returns the CommitSHA field if it's non-nil, zero value otherwise. func (m *MostRecentInstance) GetCommitSHA() string { if m == nil || m.CommitSHA == nil { @@ -11398,6 +11494,14 @@ func (m *MostRecentInstance) GetEnvironment() string { return *m.Environment } +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (m *MostRecentInstance) GetHTMLURL() string { + if m == nil || m.HTMLURL == nil { + return "" + } + return *m.HTMLURL +} + // GetLocation returns the Location field. func (m *MostRecentInstance) GetLocation() *Location { if m == nil { @@ -20110,6 +20214,22 @@ func (s *SarifID) GetURL() string { return *s.URL } +// GetAnalysesURL returns the AnalysesURL field if it's non-nil, zero value otherwise. +func (s *SARIFUpload) GetAnalysesURL() string { + if s == nil || s.AnalysesURL == nil { + return "" + } + return *s.AnalysesURL +} + +// GetProcessingStatus returns the ProcessingStatus field if it's non-nil, zero value otherwise. +func (s *SARIFUpload) GetProcessingStatus() string { + if s == nil || s.ProcessingStatus == nil { + return "" + } + return *s.ProcessingStatus +} + // GetSBOM returns the SBOM field. func (s *SBOM) GetSBOM() *SBOMInfo { if s == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 6abb7fea56a..262cdd5a06b 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -3364,6 +3364,93 @@ func TestCodeownersError_GetSuggestion(tt *testing.T) { c.GetSuggestion() } +func TestCodeQLDatabase_GetContentType(tt *testing.T) { + var zeroValue string + c := &CodeQLDatabase{ContentType: &zeroValue} + c.GetContentType() + c = &CodeQLDatabase{} + c.GetContentType() + c = nil + c.GetContentType() +} + +func TestCodeQLDatabase_GetCreatedAt(tt *testing.T) { + var zeroValue Timestamp + c := &CodeQLDatabase{CreatedAt: &zeroValue} + c.GetCreatedAt() + c = &CodeQLDatabase{} + c.GetCreatedAt() + c = nil + c.GetCreatedAt() +} + +func TestCodeQLDatabase_GetID(tt *testing.T) { + var zeroValue int64 + c := &CodeQLDatabase{ID: &zeroValue} + c.GetID() + c = &CodeQLDatabase{} + c.GetID() + c = nil + c.GetID() +} + +func TestCodeQLDatabase_GetLanguage(tt *testing.T) { + var zeroValue string + c := &CodeQLDatabase{Language: &zeroValue} + c.GetLanguage() + c = &CodeQLDatabase{} + c.GetLanguage() + c = nil + c.GetLanguage() +} + +func TestCodeQLDatabase_GetName(tt *testing.T) { + var zeroValue string + c := &CodeQLDatabase{Name: &zeroValue} + c.GetName() + c = &CodeQLDatabase{} + c.GetName() + c = nil + c.GetName() +} + +func TestCodeQLDatabase_GetSize(tt *testing.T) { + var zeroValue int64 + c := &CodeQLDatabase{Size: &zeroValue} + c.GetSize() + c = &CodeQLDatabase{} + c.GetSize() + c = nil + c.GetSize() +} + +func TestCodeQLDatabase_GetUpdatedAt(tt *testing.T) { + var zeroValue Timestamp + c := &CodeQLDatabase{UpdatedAt: &zeroValue} + c.GetUpdatedAt() + c = &CodeQLDatabase{} + c.GetUpdatedAt() + c = nil + c.GetUpdatedAt() +} + +func TestCodeQLDatabase_GetUploader(tt *testing.T) { + c := &CodeQLDatabase{} + c.GetUploader() + c = nil + c.GetUploader() +} + +func TestCodeQLDatabase_GetURL(tt *testing.T) { + var zeroValue string + c := &CodeQLDatabase{URL: &zeroValue} + c.GetURL() + c = &CodeQLDatabase{} + c.GetURL() + c = nil + c.GetURL() +} + func TestCodeResult_GetHTMLURL(tt *testing.T) { var zeroValue string c := &CodeResult{HTMLURL: &zeroValue} @@ -5765,6 +5852,26 @@ func TestDefaultSetupConfiguration_GetUpdatedAt(tt *testing.T) { d.GetUpdatedAt() } +func TestDeleteAnalysis_GetConfirmDeleteURL(tt *testing.T) { + var zeroValue string + d := &DeleteAnalysis{ConfirmDeleteURL: &zeroValue} + d.GetConfirmDeleteURL() + d = &DeleteAnalysis{} + d.GetConfirmDeleteURL() + d = nil + d.GetConfirmDeleteURL() +} + +func TestDeleteAnalysis_GetNextAnalysisURL(tt *testing.T) { + var zeroValue string + d := &DeleteAnalysis{NextAnalysisURL: &zeroValue} + d.GetNextAnalysisURL() + d = &DeleteAnalysis{} + d.GetNextAnalysisURL() + d = nil + d.GetNextAnalysisURL() +} + func TestDeleteEvent_GetInstallation(tt *testing.T) { d := &DeleteEvent{} d.GetInstallation() @@ -13307,6 +13414,16 @@ func TestMostRecentInstance_GetAnalysisKey(tt *testing.T) { m.GetAnalysisKey() } +func TestMostRecentInstance_GetCategory(tt *testing.T) { + var zeroValue string + m := &MostRecentInstance{Category: &zeroValue} + m.GetCategory() + m = &MostRecentInstance{} + m.GetCategory() + m = nil + m.GetCategory() +} + func TestMostRecentInstance_GetCommitSHA(tt *testing.T) { var zeroValue string m := &MostRecentInstance{CommitSHA: &zeroValue} @@ -13327,6 +13444,16 @@ func TestMostRecentInstance_GetEnvironment(tt *testing.T) { m.GetEnvironment() } +func TestMostRecentInstance_GetHTMLURL(tt *testing.T) { + var zeroValue string + m := &MostRecentInstance{HTMLURL: &zeroValue} + m.GetHTMLURL() + m = &MostRecentInstance{} + m.GetHTMLURL() + m = nil + m.GetHTMLURL() +} + func TestMostRecentInstance_GetLocation(tt *testing.T) { m := &MostRecentInstance{} m.GetLocation() @@ -23425,6 +23552,26 @@ func TestSarifID_GetURL(tt *testing.T) { s.GetURL() } +func TestSARIFUpload_GetAnalysesURL(tt *testing.T) { + var zeroValue string + s := &SARIFUpload{AnalysesURL: &zeroValue} + s.GetAnalysesURL() + s = &SARIFUpload{} + s.GetAnalysesURL() + s = nil + s.GetAnalysesURL() +} + +func TestSARIFUpload_GetProcessingStatus(tt *testing.T) { + var zeroValue string + s := &SARIFUpload{ProcessingStatus: &zeroValue} + s.GetProcessingStatus() + s = &SARIFUpload{} + s.GetProcessingStatus() + s = nil + s.GetProcessingStatus() +} + func TestSBOM_GetSBOM(tt *testing.T) { s := &SBOM{} s.GetSBOM() From 5ab57e7a69f08fff22d9fea977967e3ada48d9f2 Mon Sep 17 00:00:00 2001 From: WillAbides <233500+WillAbides@users.noreply.github.com> Date: Thu, 31 Aug 2023 14:27:18 -0500 Subject: [PATCH 009/145] Update package constructors (#2904) Fixes: #2897. --- README.md | 43 +-- example/actionpermissions/main.go | 2 +- example/appengine/app.go | 2 +- .../newreposecretwithxcrypto/main.go | 2 +- .../newusersecretwithxcrypto/main.go | 2 +- example/commitpr/main.go | 2 +- example/go.mod | 1 - example/go.sum | 39 -- example/listenvironments/main.go | 2 +- example/migrations/main.go | 2 +- example/newfilewithappauth/main.go | 19 +- example/newrepo/main.go | 2 +- example/newreposecretwithlibsodium/main.go | 5 +- example/newreposecretwithxcrypto/main.go | 2 +- example/tagprotection/main.go | 2 +- example/tokenauth/main.go | 2 +- github/doc.go | 26 +- github/github.go | 163 ++++++--- github/github_test.go | 334 +++++++----------- test/fields/fields.go | 2 +- test/integration/github_test.go | 2 +- 21 files changed, 270 insertions(+), 386 deletions(-) diff --git a/README.md b/README.md index 3eb9947c158..fae03041ffb 100644 --- a/README.md +++ b/README.md @@ -84,36 +84,18 @@ For more sample code snippets, head over to the ### Authentication ### -The go-github library does not directly handle authentication. Instead, when -creating a new client, pass an `http.Client` that can handle authentication for -you. The easiest and recommended way to do this is using the [oauth2][] -library, but you can always use any other library that provides an -`http.Client`. If you have an OAuth2 access token (for example, a [personal -API token][]), you can use it with the oauth2 library using: +Use the `WithAuthToken` method to configure your client to authenticate using an +OAuth token (for example, a [personal access token][]). This is what is needed +for a majority of use cases aside from GitHub Apps. ```go -import "golang.org/x/oauth2" - -func main() { - ctx := context.Background() - ts := oauth2.StaticTokenSource( - &oauth2.Token{AccessToken: "... your access token ..."}, - ) - tc := oauth2.NewClient(ctx, ts) - - client := github.NewClient(tc) - - // list all repositories for the authenticated user - repos, _, err := client.Repositories.List(ctx, "", nil) -} +client := github.NewClient(nil).WithAuthToken("... your access token ...") ``` Note that when using an authenticated Client, all calls made by the client will include the specified OAuth token. Therefore, authenticated clients should almost never be shared between different users. -See the [oauth2 docs][] for complete instructions on using that library. - For API methods that require HTTP Basic Authentication, use the [`BasicAuthTransport`](https://godoc.org/github.com/google/go-github/github#BasicAuthTransport). @@ -232,16 +214,9 @@ https://github.com/gregjones/httpcache for that. For example: ```go import "github.com/gregjones/httpcache" - ts := oauth2.StaticTokenSource( - &oauth2.Token{AccessToken: os.Getenv("GITHUB_TOKEN")}, - ) - tc := &http.Client{ - Transport: &oauth2.Transport{ - Base: httpcache.NewMemoryCacheTransport(), - Source: ts, - }, - } - client := github.NewClient(tc) + client := github.NewClient( + httpcache.NewMemoryCacheTransport().Client() + ).WithAuthToken(os.Getenv("GITHUB_TOKEN")) ``` Learn more about GitHub conditional requests at @@ -320,9 +295,7 @@ Furthermore, there are libraries like [cbrgm/githubevents][] that build upon the For complete usage of go-github, see the full [package docs][]. [GitHub API v3]: https://docs.github.com/en/rest -[oauth2]: https://github.com/golang/oauth2 -[oauth2 docs]: https://godoc.org/golang.org/x/oauth2 -[personal API token]: https://github.com/blog/1509-personal-api-tokens +[personal access token]: https://github.com/blog/1509-personal-api-tokens [package docs]: https://pkg.go.dev/github.com/google/go-github/v54/github [GraphQL API v4]: https://developer.github.com/v4/ [shurcooL/githubv4]: https://github.com/shurcooL/githubv4 diff --git a/example/actionpermissions/main.go b/example/actionpermissions/main.go index 40f4a86ece0..0a6bedbb3f6 100644 --- a/example/actionpermissions/main.go +++ b/example/actionpermissions/main.go @@ -35,7 +35,7 @@ func main() { log.Fatal("No owner: owner of repo must be given") } ctx := context.Background() - client := github.NewTokenClient(ctx, token) + client := github.NewClient(nil).WithAuthToken(token) actionsPermissionsRepository, _, err := client.Repositories.GetActionsPermissions(ctx, *owner, *name) if err != nil { diff --git a/example/appengine/app.go b/example/appengine/app.go index 1694faaacfd..1913d9a891f 100644 --- a/example/appengine/app.go +++ b/example/appengine/app.go @@ -28,7 +28,7 @@ func handler(w http.ResponseWriter, r *http.Request) { } ctx := appengine.NewContext(r) - client := github.NewTokenClient(ctx, os.Getenv("GITHUB_AUTH_TOKEN")) + client := github.NewClient(nil).WithAuthToken(os.Getenv("GITHUB_AUTH_TOKEN")) commits, _, err := client.Repositories.ListCommits(ctx, "google", "go-github", nil) if err != nil { diff --git a/example/codespaces/newreposecretwithxcrypto/main.go b/example/codespaces/newreposecretwithxcrypto/main.go index 4ec3757af25..0faf737daf8 100644 --- a/example/codespaces/newreposecretwithxcrypto/main.go +++ b/example/codespaces/newreposecretwithxcrypto/main.go @@ -72,7 +72,7 @@ func main() { } ctx := context.Background() - client := github.NewTokenClient(ctx, token) + client := github.NewClient(nil).WithAuthToken(token) if err := addRepoSecret(ctx, client, *owner, *repo, secretName, secretValue); err != nil { log.Fatal(err) diff --git a/example/codespaces/newusersecretwithxcrypto/main.go b/example/codespaces/newusersecretwithxcrypto/main.go index 964452da82b..d887b4e5f40 100644 --- a/example/codespaces/newusersecretwithxcrypto/main.go +++ b/example/codespaces/newusersecretwithxcrypto/main.go @@ -65,7 +65,7 @@ func main() { } ctx := context.Background() - client := github.NewTokenClient(ctx, token) + client := github.NewClient(nil).WithAuthToken(token) if err := addUserSecret(ctx, client, secretName, secretValue, *owner, *repo); err != nil { log.Fatal(err) diff --git a/example/commitpr/main.go b/example/commitpr/main.go index 2e81387017c..6cdc0e8f046 100644 --- a/example/commitpr/main.go +++ b/example/commitpr/main.go @@ -189,7 +189,7 @@ func main() { if *sourceOwner == "" || *sourceRepo == "" || *commitBranch == "" || *sourceFiles == "" || *authorName == "" || *authorEmail == "" { log.Fatal("You need to specify a non-empty value for the flags `-source-owner`, `-source-repo`, `-commit-branch`, `-files`, `-author-name` and `-author-email`") } - client = github.NewTokenClient(ctx, token) + client = github.NewClient(nil).WithAuthToken(token) ref, err := getRef() if err != nil { diff --git a/example/go.mod b/example/go.mod index aa04906aa9c..496140a1b63 100644 --- a/example/go.mod +++ b/example/go.mod @@ -7,7 +7,6 @@ require ( github.com/gofri/go-github-ratelimit v1.0.3 github.com/google/go-github/v54 v54.0.0 golang.org/x/crypto v0.12.0 - golang.org/x/oauth2 v0.7.0 golang.org/x/term v0.11.0 google.golang.org/appengine v1.6.7 ) diff --git a/example/go.sum b/example/go.sum index 1151ab7548d..513022c3565 100644 --- a/example/go.sum +++ b/example/go.sum @@ -1,10 +1,8 @@ -cloud.google.com/go/compute/metadata v0.2.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 h1:wPbRQzjjwFc0ih8puEVAOFGELsn1zoIIYdxvML7mDxA= github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8/go.mod h1:I0gYDMZ6Z5GRU7l58bNFSkPTFN6Yl12dsUlAZ8xy98g= github.com/bradleyfalzon/ghinstallation/v2 v2.0.4 h1:tXKVfhE7FcSkhkv0UwkLvPDeZ4kz6OXd0PKPlFqf81M= github.com/bradleyfalzon/ghinstallation/v2 v2.0.4/go.mod h1:B40qPqJxWE0jDZgOR1JmaMy+4AY1eBP+IByOvqyAKp0= github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= -github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/cloudflare/circl v1.1.0/go.mod h1:prBCrKB9DV4poKZY1l9zBXg2QJY7mvgRvtMxxK7fi4I= github.com/cloudflare/circl v1.3.3 h1:fE/Qz0QdIGqeWfnwq0RE0R7MI51s0M2E4Ga9kq5AEMs= github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= @@ -20,71 +18,34 @@ github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-github/v41 v41.0.0 h1:HseJrM2JFf2vfiZJ8anY2hqBjdfY1Vlj/K27ueww4gg= github.com/google/go-github/v41 v41.0.0/go.mod h1:XgmCA5H323A9rtgExdTcnDkcqp6S30AVACCBDOonIxg= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.7.0 h1:qe6s0zUXlPX80/dITx3440hWZ7GwMwgDDyrSGTPJG/g= -golang.org/x/oauth2 v0.7.0/go.mod h1:hPLQkd9LyjfXTiRohC/41GhcFqxisoUQ99sCUOHO9x4= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= -golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0= golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= diff --git a/example/listenvironments/main.go b/example/listenvironments/main.go index 15ec8cbb583..e2ff0c4b456 100644 --- a/example/listenvironments/main.go +++ b/example/listenvironments/main.go @@ -31,7 +31,7 @@ func main() { } ctx := context.Background() - client := github.NewTokenClient(ctx, token) + client := github.NewClient(nil).WithAuthToken(token) expectedPageSize := 2 diff --git a/example/migrations/main.go b/example/migrations/main.go index f5c36c63059..d87668c1479 100644 --- a/example/migrations/main.go +++ b/example/migrations/main.go @@ -17,7 +17,7 @@ import ( func fetchAllUserMigrations() ([]*github.UserMigration, error) { ctx := context.Background() - client := github.NewTokenClient(ctx, "") + client := github.NewClient(nil).WithAuthToken("") migrations, _, err := client.Migrations.ListUserMigrations(ctx, &github.ListOptions{Page: 1}) return migrations, err diff --git a/example/newfilewithappauth/main.go b/example/newfilewithappauth/main.go index 6526fadc35e..8b2a4987585 100644 --- a/example/newfilewithappauth/main.go +++ b/example/newfilewithappauth/main.go @@ -17,7 +17,6 @@ import ( "github.com/bradleyfalzon/ghinstallation/v2" "github.com/google/go-github/v54/github" - "golang.org/x/oauth2" ) func main() { @@ -35,13 +34,13 @@ func main() { itr.BaseURL = gitHost //create git client with app transport - client, err := github.NewEnterpriseClient( - gitHost, - gitHost, + client, err := github.NewClient( &http.Client{ Transport: itr, Timeout: time.Second * 30, - }) + }, + ).WithEnterpriseURLs(gitHost, gitHost) + if err != nil { log.Fatalf("faild to create git client for app: %v\n", err) } @@ -66,13 +65,9 @@ func main() { log.Fatalf("failed to create installation token: %v\n", err) } - ts := oauth2.StaticTokenSource( - &oauth2.Token{AccessToken: token.GetToken()}, - ) - oAuthClient := oauth2.NewClient(context.Background(), ts) - - //create new git hub client with accessToken - apiClient, err := github.NewEnterpriseClient(gitHost, gitHost, oAuthClient) + apiClient, err := github.NewClient(nil).WithAuthToken( + token.GetToken(), + ).WithEnterpriseURLs(gitHost, gitHost) if err != nil { log.Fatalf("failed to create new git client with token: %v\n", err) } diff --git a/example/newrepo/main.go b/example/newrepo/main.go index 758b293db23..84d315821f7 100644 --- a/example/newrepo/main.go +++ b/example/newrepo/main.go @@ -36,7 +36,7 @@ func main() { log.Fatal("No name: New repos must be given a name") } ctx := context.Background() - client := github.NewTokenClient(ctx, token) + client := github.NewClient(nil).WithAuthToken(token) r := &github.Repository{Name: name, Private: private, Description: description, AutoInit: autoInit} repo, _, err := client.Repositories.Create(ctx, "", r) diff --git a/example/newreposecretwithlibsodium/main.go b/example/newreposecretwithlibsodium/main.go index 039289054ee..c0d412b51ac 100644 --- a/example/newreposecretwithlibsodium/main.go +++ b/example/newreposecretwithlibsodium/main.go @@ -71,10 +71,7 @@ func main() { } ctx := context.Background() - client := github.NewTokenClient(ctx, token) - if err != nil { - log.Fatalf("unable to authorize using env GITHUB_AUTH_TOKEN: %v", err) - } + client := github.NewClient(nil).WithAuthToken(token) if err := addRepoSecret(ctx, client, *owner, *repo, secretName, secretValue); err != nil { log.Fatal(err) diff --git a/example/newreposecretwithxcrypto/main.go b/example/newreposecretwithxcrypto/main.go index 76eb3dd8741..0e9a11d9cd9 100644 --- a/example/newreposecretwithxcrypto/main.go +++ b/example/newreposecretwithxcrypto/main.go @@ -72,7 +72,7 @@ func main() { } ctx := context.Background() - client := github.NewTokenClient(ctx, token) + client := github.NewClient(nil).WithAuthToken(token) if err := addRepoSecret(ctx, client, *owner, *repo, secretName, secretValue); err != nil { log.Fatal(err) diff --git a/example/tagprotection/main.go b/example/tagprotection/main.go index 8f85c7c0cb8..2499b242603 100644 --- a/example/tagprotection/main.go +++ b/example/tagprotection/main.go @@ -44,7 +44,7 @@ func main() { token := string(byteToken) ctx := context.Background() - client := github.NewTokenClient(ctx, token) + client := github.NewClient(nil).WithAuthToken(token) // create new tag protection if pattern != "" { diff --git a/example/tokenauth/main.go b/example/tokenauth/main.go index 564db2663e6..645bb749aca 100644 --- a/example/tokenauth/main.go +++ b/example/tokenauth/main.go @@ -26,7 +26,7 @@ func main() { token := string(byteToken) ctx := context.Background() - client := github.NewTokenClient(ctx, token) + client := github.NewClient(nil).WithAuthToken(token) user, resp, err := client.Users.Get(ctx, "") if err != nil { diff --git a/github/doc.go b/github/doc.go index 42337fb878b..b4e6163d2b9 100644 --- a/github/doc.go +++ b/github/doc.go @@ -40,34 +40,16 @@ For more sample code snippets, head over to the https://github.com/google/go-git # Authentication -The go-github library does not directly handle authentication. Instead, when -creating a new client, pass an http.Client that can handle authentication for -you. The easiest and recommended way to do this is using the golang.org/x/oauth2 -library, but you can always use any other library that provides an http.Client. -If you have an OAuth2 access token (for example, a personal API token), you can -use it with the oauth2 library using: +Use Client.WithAuthToken to configure your client to authenticate using an Oauth token +(for example, a personal access token). This is what is needed for a majority of use cases +aside from GitHub Apps. - import "golang.org/x/oauth2" - - func main() { - ctx := context.Background() - ts := oauth2.StaticTokenSource( - &oauth2.Token{AccessToken: "... your access token ..."}, - ) - tc := oauth2.NewClient(ctx, ts) - - client := github.NewClient(tc) - - // list all repositories for the authenticated user - repos, _, err := client.Repositories.List(ctx, "", nil) - } + client := github.NewClient(nil).WithAuthToken("... your access token ...") Note that when using an authenticated Client, all calls made by the client will include the specified OAuth token. Therefore, authenticated clients should almost never be shared between different users. -See the oauth2 docs for complete instructions on using that library. - For API methods that require HTTP Basic Authentication, use the BasicAuthTransport. diff --git a/github/github.go b/github/github.go index a7031ffd65a..dbd856b0e2d 100644 --- a/github/github.go +++ b/github/github.go @@ -305,17 +305,92 @@ func addOptions(s string, opts interface{}) (string, error) { // NewClient returns a new GitHub API client. If a nil httpClient is // provided, a new http.Client will be used. To use API methods which require -// authentication, either use NewTokenClient instead or provide NewClient with +// authentication, either use Client.WithAuthToken or provide NewClient with // an http.Client that will perform the authentication for you (such as that // provided by the golang.org/x/oauth2 library). func NewClient(httpClient *http.Client) *Client { - if httpClient == nil { - httpClient = &http.Client{} + c := &Client{client: httpClient} + c.initialize() + return c +} + +// WithAuthToken returns a copy of the client configured to use the provided token for the Authorization header. +func (c *Client) WithAuthToken(token string) *Client { + c2 := c.copy() + defer c2.initialize() + transport := c2.client.Transport + if transport == nil { + transport = http.DefaultTransport + } + c2.client.Transport = roundTripperFunc( + func(req *http.Request) (*http.Response, error) { + req = req.Clone(req.Context()) + req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", token)) + return transport.RoundTrip(req) + }, + ) + return c2 +} + +// WithEnterpriseURLs returns a copy of the client configured to use the provided base and +// upload URLs. If the base URL does not have the suffix "/api/v3/", it will be added +// automatically. If the upload URL does not have the suffix "/api/uploads", it will be +// added automatically. +// +// Note that WithEnterpriseURLs is a convenience helper only; +// its behavior is equivalent to setting the BaseURL and UploadURL fields. +// +// Another important thing is that by default, the GitHub Enterprise URL format +// should be http(s)://[hostname]/api/v3/ or you will always receive the 406 status code. +// The upload URL format should be http(s)://[hostname]/api/uploads/. +func (c *Client) WithEnterpriseURLs(baseURL, uploadURL string) (*Client, error) { + c2 := c.copy() + defer c2.initialize() + var err error + c2.BaseURL, err = url.Parse(baseURL) + if err != nil { + return nil, err } - baseURL, _ := url.Parse(defaultBaseURL) - uploadURL, _ := url.Parse(uploadBaseURL) - c := &Client{client: httpClient, BaseURL: baseURL, UserAgent: defaultUserAgent, UploadURL: uploadURL} + if !strings.HasSuffix(c2.BaseURL.Path, "/") { + c2.BaseURL.Path += "/" + } + if !strings.HasSuffix(c2.BaseURL.Path, "/api/v3/") && + !strings.HasPrefix(c2.BaseURL.Host, "api.") && + !strings.Contains(c2.BaseURL.Host, ".api.") { + c2.BaseURL.Path += "api/v3/" + } + + c2.UploadURL, err = url.Parse(uploadURL) + if err != nil { + return nil, err + } + + if !strings.HasSuffix(c2.UploadURL.Path, "/") { + c2.UploadURL.Path += "/" + } + if !strings.HasSuffix(c2.UploadURL.Path, "/api/uploads/") && + !strings.HasPrefix(c2.UploadURL.Host, "api.") && + !strings.Contains(c2.UploadURL.Host, ".api.") { + c2.UploadURL.Path += "api/uploads/" + } + return c2, nil +} + +// initialize sets default values and initializes services. +func (c *Client) initialize() { + if c.client == nil { + c.client = &http.Client{} + } + if c.BaseURL == nil { + c.BaseURL, _ = url.Parse(defaultBaseURL) + } + if c.UploadURL == nil { + c.UploadURL, _ = url.Parse(uploadBaseURL) + } + if c.UserAgent == "" { + c.UserAgent = defaultUserAgent + } c.common.client = c c.Actions = (*ActionsService)(&c.common) c.Activity = (*ActivityService)(&c.common) @@ -349,7 +424,27 @@ func NewClient(httpClient *http.Client) *Client { c.SecurityAdvisories = (*SecurityAdvisoriesService)(&c.common) c.Teams = (*TeamsService)(&c.common) c.Users = (*UsersService)(&c.common) - return c +} + +// copy returns a copy of the current client. It must be initialized before use. +func (c *Client) copy() *Client { + c.clientMu.Lock() + // can't use *c here because that would copy mutexes by value. + clone := Client{ + client: c.client, + UserAgent: c.UserAgent, + BaseURL: c.BaseURL, + UploadURL: c.UploadURL, + secondaryRateLimitReset: c.secondaryRateLimitReset, + } + c.clientMu.Unlock() + if clone.client == nil { + clone.client = &http.Client{} + } + c.rateMu.Lock() + copy(clone.rateLimits[:], c.rateLimits[:]) + c.rateMu.Unlock() + return &clone } // NewClientWithEnvProxy enhances NewClient with the HttpProxy env. @@ -358,62 +453,18 @@ func NewClientWithEnvProxy() *Client { } // NewTokenClient returns a new GitHub API client authenticated with the provided token. +// Deprecated: Use NewClient(nil).WithAuthToken(token) instead. func NewTokenClient(_ context.Context, token string) *Client { - return NewClient(&http.Client{ - Transport: roundTripperFunc(func(req *http.Request) (*http.Response, error) { - req = req.Clone(req.Context()) - req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", token)) - return http.DefaultTransport.RoundTrip(req) - }), - }) + // This always returns a nil error. + return NewClient(nil).WithAuthToken(token) } // NewEnterpriseClient returns a new GitHub API client with provided // base URL and upload URL (often is your GitHub Enterprise hostname). -// If the base URL does not have the suffix "/api/v3/", it will be added automatically. -// If the upload URL does not have the suffix "/api/uploads", it will be added automatically. -// If a nil httpClient is provided, a new http.Client will be used. -// -// Note that NewEnterpriseClient is a convenience helper only; -// its behavior is equivalent to using NewClient, followed by setting -// the BaseURL and UploadURL fields. // -// Another important thing is that by default, the GitHub Enterprise URL format -// should be http(s)://[hostname]/api/v3/ or you will always receive the 406 status code. -// The upload URL format should be http(s)://[hostname]/api/uploads/. +// Deprecated: Use NewClient(httpClient).WithOptions(WithEnterpriseURLs(baseURL, uploadURL)) instead. func NewEnterpriseClient(baseURL, uploadURL string, httpClient *http.Client) (*Client, error) { - baseEndpoint, err := url.Parse(baseURL) - if err != nil { - return nil, err - } - - if !strings.HasSuffix(baseEndpoint.Path, "/") { - baseEndpoint.Path += "/" - } - if !strings.HasSuffix(baseEndpoint.Path, "/api/v3/") && - !strings.HasPrefix(baseEndpoint.Host, "api.") && - !strings.Contains(baseEndpoint.Host, ".api.") { - baseEndpoint.Path += "api/v3/" - } - - uploadEndpoint, err := url.Parse(uploadURL) - if err != nil { - return nil, err - } - - if !strings.HasSuffix(uploadEndpoint.Path, "/") { - uploadEndpoint.Path += "/" - } - if !strings.HasSuffix(uploadEndpoint.Path, "/api/uploads/") && - !strings.HasPrefix(uploadEndpoint.Host, "api.") && - !strings.Contains(uploadEndpoint.Host, ".api.") { - uploadEndpoint.Path += "api/uploads/" - } - - c := NewClient(httpClient) - c.BaseURL = baseEndpoint - c.UploadURL = uploadEndpoint - return c, nil + return NewClient(httpClient).WithEnterpriseURLs(baseURL, uploadURL) } // RequestOption represents an option that can modify an http.Request. diff --git a/github/github_test.go b/github/github_test.go index 982e1fe7498..af506e65243 100644 --- a/github/github_test.go +++ b/github/github_test.go @@ -306,219 +306,145 @@ func TestClient(t *testing.T) { } } -func TestNewTokenClient(t *testing.T) { +func TestWithAuthToken(t *testing.T) { token := "gh_test_token" - ctx := context.Background() var gotAuthHeaderVals []string wantAuthHeaderVals := []string{"Bearer " + token} srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { gotAuthHeaderVals = r.Header["Authorization"] })) - _, err := NewTokenClient(ctx, token).Client().Get(srv.URL) - if err != nil { - t.Fatalf("Get returned unexpected error: %v", err) - } - if diff := cmp.Diff(wantAuthHeaderVals, gotAuthHeaderVals); diff != "" { - t.Errorf("Authorization header values mismatch (-want +got):\n%s", diff) - } -} - -func TestNewEnterpriseClient(t *testing.T) { - baseURL := "https://custom-url/api/v3/" - uploadURL := "https://custom-upload-url/api/uploads/" - c, err := NewEnterpriseClient(baseURL, uploadURL, nil) - if err != nil { - t.Fatalf("NewEnterpriseClient returned unexpected error: %v", err) - } - - if got, want := c.BaseURL.String(), baseURL; got != want { - t.Errorf("NewClient BaseURL is %v, want %v", got, want) - } - if got, want := c.UploadURL.String(), uploadURL; got != want { - t.Errorf("NewClient UploadURL is %v, want %v", got, want) - } -} - -func TestNewEnterpriseClient_addsTrailingSlashToURLs(t *testing.T) { - baseURL := "https://custom-url/api/v3" - uploadURL := "https://custom-upload-url/api/uploads" - formattedBaseURL := baseURL + "/" - formattedUploadURL := uploadURL + "/" - - c, err := NewEnterpriseClient(baseURL, uploadURL, nil) - if err != nil { - t.Fatalf("NewEnterpriseClient returned unexpected error: %v", err) - } - - if got, want := c.BaseURL.String(), formattedBaseURL; got != want { - t.Errorf("NewClient BaseURL is %v, want %v", got, want) - } - if got, want := c.UploadURL.String(), formattedUploadURL; got != want { - t.Errorf("NewClient UploadURL is %v, want %v", got, want) - } -} - -func TestNewEnterpriseClient_addsEnterpriseSuffixToURLs(t *testing.T) { - baseURL := "https://custom-url/" - uploadURL := "https://custom-upload-url/" - formattedBaseURL := baseURL + "api/v3/" - formattedUploadURL := uploadURL + "api/uploads/" - - c, err := NewEnterpriseClient(baseURL, uploadURL, nil) - if err != nil { - t.Fatalf("NewEnterpriseClient returned unexpected error: %v", err) - } - - if got, want := c.BaseURL.String(), formattedBaseURL; got != want { - t.Errorf("NewClient BaseURL is %v, want %v", got, want) - } - if got, want := c.UploadURL.String(), formattedUploadURL; got != want { - t.Errorf("NewClient UploadURL is %v, want %v", got, want) - } -} - -func TestNewEnterpriseClient_addsEnterpriseSuffixAndTrailingSlashToURLs(t *testing.T) { - baseURL := "https://custom-url" - uploadURL := "https://custom-upload-url" - formattedBaseURL := baseURL + "/api/v3/" - formattedUploadURL := uploadURL + "/api/uploads/" - - c, err := NewEnterpriseClient(baseURL, uploadURL, nil) - if err != nil { - t.Fatalf("NewEnterpriseClient returned unexpected error: %v", err) - } - - if got, want := c.BaseURL.String(), formattedBaseURL; got != want { - t.Errorf("NewClient BaseURL is %v, want %v", got, want) - } - if got, want := c.UploadURL.String(), formattedUploadURL; got != want { - t.Errorf("NewClient UploadURL is %v, want %v", got, want) - } -} - -func TestNewEnterpriseClient_badBaseURL(t *testing.T) { - baseURL := "bogus\nbase\nURL" - uploadURL := "https://custom-upload-url/api/uploads/" - if _, err := NewEnterpriseClient(baseURL, uploadURL, nil); err == nil { - t.Fatal("NewEnterpriseClient returned nil, expected error") - } -} - -func TestNewEnterpriseClient_badUploadURL(t *testing.T) { - baseURL := "https://custom-url/api/v3/" - uploadURL := "bogus\nupload\nURL" - if _, err := NewEnterpriseClient(baseURL, uploadURL, nil); err == nil { - t.Fatal("NewEnterpriseClient returned nil, expected error") - } -} - -func TestNewEnterpriseClient_URLHasExistingAPIPrefix_AddTrailingSlash(t *testing.T) { - baseURL := "https://api.custom-url" - uploadURL := "https://api.custom-upload-url" - formattedBaseURL := baseURL + "/" - formattedUploadURL := uploadURL + "/" - - c, err := NewEnterpriseClient(baseURL, uploadURL, nil) - if err != nil { - t.Fatalf("NewEnterpriseClient returned unexpected error: %v", err) - } - - if got, want := c.BaseURL.String(), formattedBaseURL; got != want { - t.Errorf("NewClient BaseURL is %v, want %v", got, want) - } - if got, want := c.UploadURL.String(), formattedUploadURL; got != want { - t.Errorf("NewClient UploadURL is %v, want %v", got, want) - } -} - -func TestNewEnterpriseClient_URLHasExistingAPIPrefixAndTrailingSlash(t *testing.T) { - baseURL := "https://api.custom-url/" - uploadURL := "https://api.custom-upload-url/" - - c, err := NewEnterpriseClient(baseURL, uploadURL, nil) - if err != nil { - t.Fatalf("NewEnterpriseClient returned unexpected error: %v", err) - } - - if got, want := c.BaseURL.String(), baseURL; got != want { - t.Errorf("NewClient BaseURL is %v, want %v", got, want) - } - if got, want := c.UploadURL.String(), uploadURL; got != want { - t.Errorf("NewClient UploadURL is %v, want %v", got, want) - } -} - -func TestNewEnterpriseClient_URLHasAPISubdomain_AddTrailingSlash(t *testing.T) { - baseURL := "https://catalog.api.custom-url" - uploadURL := "https://catalog.api.custom-upload-url" - formattedBaseURL := baseURL + "/" - formattedUploadURL := uploadURL + "/" - - c, err := NewEnterpriseClient(baseURL, uploadURL, nil) - if err != nil { - t.Fatalf("NewEnterpriseClient returned unexpected error: %v", err) - } - - if got, want := c.BaseURL.String(), formattedBaseURL; got != want { - t.Errorf("NewClient BaseURL is %v, want %v", got, want) - } - if got, want := c.UploadURL.String(), formattedUploadURL; got != want { - t.Errorf("NewClient UploadURL is %v, want %v", got, want) - } -} - -func TestNewEnterpriseClient_URLHasAPISubdomainAndTrailingSlash(t *testing.T) { - baseURL := "https://catalog.api.custom-url/" - uploadURL := "https://catalog.api.custom-upload-url/" - - c, err := NewEnterpriseClient(baseURL, uploadURL, nil) - if err != nil { - t.Fatalf("NewEnterpriseClient returned unexpected error: %v", err) - } - - if got, want := c.BaseURL.String(), baseURL; got != want { - t.Errorf("NewClient BaseURL is %v, want %v", got, want) - } - if got, want := c.UploadURL.String(), uploadURL; got != want { - t.Errorf("NewClient UploadURL is %v, want %v", got, want) - } -} - -func TestNewEnterpriseClient_URLIsNotAProperAPISubdomain_addsEnterpriseSuffixAndSlash(t *testing.T) { - baseURL := "https://cloud-api.custom-url" - uploadURL := "https://cloud-api.custom-upload-url" - formattedBaseURL := baseURL + "/api/v3/" - formattedUploadURL := uploadURL + "/api/uploads/" - - c, err := NewEnterpriseClient(baseURL, uploadURL, nil) - if err != nil { - t.Fatalf("NewEnterpriseClient returned unexpected error: %v", err) - } - - if got, want := c.BaseURL.String(), formattedBaseURL; got != want { - t.Errorf("NewClient BaseURL is %v, want %v", got, want) - } - if got, want := c.UploadURL.String(), formattedUploadURL; got != want { - t.Errorf("NewClient UploadURL is %v, want %v", got, want) + validate := func(c *Client) { + t.Helper() + gotAuthHeaderVals = nil + _, err := c.Client().Get(srv.URL) + if err != nil { + t.Fatalf("Get returned unexpected error: %v", err) + } + diff := cmp.Diff(wantAuthHeaderVals, gotAuthHeaderVals) + if diff != "" { + t.Errorf("Authorization header values mismatch (-want +got):\n%s", diff) + } } + validate(NewClient(nil).WithAuthToken(token)) + validate(new(Client).WithAuthToken(token)) + validate(NewTokenClient(context.Background(), token)) } -func TestNewEnterpriseClient_URLIsNotAProperAPISubdomain_addsEnterpriseSuffix(t *testing.T) { - baseURL := "https://cloud-api.custom-url/" - uploadURL := "https://cloud-api.custom-upload-url/" - formattedBaseURL := baseURL + "api/v3/" - formattedUploadURL := uploadURL + "api/uploads/" - - c, err := NewEnterpriseClient(baseURL, uploadURL, nil) - if err != nil { - t.Fatalf("NewEnterpriseClient returned unexpected error: %v", err) - } - - if got, want := c.BaseURL.String(), formattedBaseURL; got != want { - t.Errorf("NewClient BaseURL is %v, want %v", got, want) - } - if got, want := c.UploadURL.String(), formattedUploadURL; got != want { - t.Errorf("NewClient UploadURL is %v, want %v", got, want) +func TestWithEnterpriseURLs(t *testing.T) { + for _, test := range []struct { + name string + baseURL string + wantBaseURL string + uploadURL string + wantUploadURL string + wantErr string + }{ + { + name: "does not modify properly formed URLs", + baseURL: "https://custom-url/api/v3/", + wantBaseURL: "https://custom-url/api/v3/", + uploadURL: "https://custom-upload-url/api/uploads/", + wantUploadURL: "https://custom-upload-url/api/uploads/", + }, + { + name: "adds trailing slash", + baseURL: "https://custom-url/api/v3", + wantBaseURL: "https://custom-url/api/v3/", + uploadURL: "https://custom-upload-url/api/uploads", + wantUploadURL: "https://custom-upload-url/api/uploads/", + }, + { + name: "adds enterprise suffix", + baseURL: "https://custom-url/", + wantBaseURL: "https://custom-url/api/v3/", + uploadURL: "https://custom-upload-url/", + wantUploadURL: "https://custom-upload-url/api/uploads/", + }, + { + name: "adds enterprise suffix and trailing slash", + baseURL: "https://custom-url", + wantBaseURL: "https://custom-url/api/v3/", + uploadURL: "https://custom-upload-url", + wantUploadURL: "https://custom-upload-url/api/uploads/", + }, + { + name: "bad base URL", + baseURL: "bogus\nbase\nURL", + uploadURL: "https://custom-upload-url/api/uploads/", + wantErr: `invalid control character in URL`, + }, + { + name: "bad upload URL", + baseURL: "https://custom-url/api/v3/", + uploadURL: "bogus\nupload\nURL", + wantErr: `invalid control character in URL`, + }, + { + name: "URL has existing API prefix, adds trailing slash", + baseURL: "https://api.custom-url", + wantBaseURL: "https://api.custom-url/", + uploadURL: "https://api.custom-upload-url", + wantUploadURL: "https://api.custom-upload-url/", + }, + { + name: "URL has existing API prefix and trailing slash", + baseURL: "https://api.custom-url/", + wantBaseURL: "https://api.custom-url/", + uploadURL: "https://api.custom-upload-url/", + wantUploadURL: "https://api.custom-upload-url/", + }, + { + name: "URL has API subdomain, adds trailing slash", + baseURL: "https://catalog.api.custom-url", + wantBaseURL: "https://catalog.api.custom-url/", + uploadURL: "https://catalog.api.custom-upload-url", + wantUploadURL: "https://catalog.api.custom-upload-url/", + }, + { + name: "URL has API subdomain and trailing slash", + baseURL: "https://catalog.api.custom-url/", + wantBaseURL: "https://catalog.api.custom-url/", + uploadURL: "https://catalog.api.custom-upload-url/", + wantUploadURL: "https://catalog.api.custom-upload-url/", + }, + { + name: "URL is not a proper API subdomain, adds enterprise suffix and slash", + baseURL: "https://cloud-api.custom-url", + wantBaseURL: "https://cloud-api.custom-url/api/v3/", + uploadURL: "https://cloud-api.custom-upload-url", + wantUploadURL: "https://cloud-api.custom-upload-url/api/uploads/", + }, + { + name: "URL is not a proper API subdomain, adds enterprise suffix", + baseURL: "https://cloud-api.custom-url/", + wantBaseURL: "https://cloud-api.custom-url/api/v3/", + uploadURL: "https://cloud-api.custom-upload-url/", + wantUploadURL: "https://cloud-api.custom-upload-url/api/uploads/", + }, + } { + t.Run(test.name, func(t *testing.T) { + validate := func(c *Client, err error) { + t.Helper() + if test.wantErr != "" { + if err == nil || !strings.Contains(err.Error(), test.wantErr) { + t.Fatalf("error does not contain expected string %q: %v", test.wantErr, err) + } + return + } + if err != nil { + t.Fatalf("got unexpected error: %v", err) + } + if c.BaseURL.String() != test.wantBaseURL { + t.Errorf("BaseURL is %v, want %v", c.BaseURL.String(), test.wantBaseURL) + } + if c.UploadURL.String() != test.wantUploadURL { + t.Errorf("UploadURL is %v, want %v", c.UploadURL.String(), test.wantUploadURL) + } + } + validate(NewClient(nil).WithEnterpriseURLs(test.baseURL, test.uploadURL)) + validate(new(Client).WithEnterpriseURLs(test.baseURL, test.uploadURL)) + validate(NewEnterpriseClient(test.baseURL, test.uploadURL, nil)) + }) } } diff --git a/test/fields/fields.go b/test/fields/fields.go index 8f5d1ffc05e..6b44a04310d 100644 --- a/test/fields/fields.go +++ b/test/fields/fields.go @@ -46,7 +46,7 @@ func main() { print("!!! No OAuth token. Some tests won't run. !!!\n\n") client = github.NewClient(nil) } else { - client = github.NewTokenClient(context.Background(), token) + client = github.NewClient(nil).WithAuthToken(token) auth = true } diff --git a/test/integration/github_test.go b/test/integration/github_test.go index 9bcbf7b554a..5bef6ca73aa 100644 --- a/test/integration/github_test.go +++ b/test/integration/github_test.go @@ -32,7 +32,7 @@ func init() { print("!!! No OAuth token. Some tests won't run. !!!\n\n") client = github.NewClient(nil) } else { - client = github.NewTokenClient(context.Background(), token) + client = github.NewClient(nil).WithAuthToken(token) auth = true } } From 1a6e6febdb06006b5b0d8278b0fbc89299855138 Mon Sep 17 00:00:00 2001 From: Yurii Soldak Date: Mon, 4 Sep 2023 15:53:36 +0200 Subject: [PATCH 010/145] Fix serialization of repository_names conditions object (#2910) Fixes: #2909. --- github/repos_rules.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/github/repos_rules.go b/github/repos_rules.go index 38d4255a9aa..7f964fe6655 100644 --- a/github/repos_rules.go +++ b/github/repos_rules.go @@ -38,8 +38,8 @@ type RulesetRefConditionParameters struct { // RulesetRepositoryNamesConditionParameters represents the conditions object for repository_names. type RulesetRepositoryNamesConditionParameters struct { - Include []string `json:"include,omitempty"` - Exclude []string `json:"exclude,omitempty"` + Include []string `json:"include"` + Exclude []string `json:"exclude"` Protected *bool `json:"protected,omitempty"` } From 5eddfaaeb7c8ad56b43e5c7d6719b2a5bb1defe6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Sep 2023 16:29:27 -0400 Subject: [PATCH 011/145] Bump actions/checkout from 3 to 4 (#2912) --- .github/workflows/linter.yml | 2 +- .github/workflows/tests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index a494d8fb779..1430245422d 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -23,7 +23,7 @@ jobs: runs-on: ${{ matrix.platform }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: golangci-lint ${{ matrix.working-directory }} uses: golangci/golangci-lint-action@v3 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ad0cc4487b1..87d97f99c09 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -39,7 +39,7 @@ jobs: - uses: actions/setup-go@v4 with: go-version: ${{ matrix.go-version }} - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 # Get values for cache paths to be used in later steps - id: cache-paths From 99ee29e326a0b3d5e09982f3de2101ba70613808 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Tue, 5 Sep 2023 13:02:11 -0400 Subject: [PATCH 012/145] Bump version of go-github to v55.0.0 (#2914) --- README.md | 15 ++++++++------- example/actionpermissions/main.go | 2 +- example/appengine/app.go | 2 +- example/basicauth/main.go | 2 +- .../codespaces/newreposecretwithxcrypto/main.go | 2 +- .../codespaces/newusersecretwithxcrypto/main.go | 2 +- example/commitpr/main.go | 2 +- example/go.mod | 6 +++--- example/listenvironments/main.go | 2 +- example/migrations/main.go | 2 +- example/newfilewithappauth/main.go | 2 +- example/newrepo/main.go | 2 +- example/newreposecretwithlibsodium/go.mod | 4 ++-- example/newreposecretwithlibsodium/main.go | 2 +- example/newreposecretwithxcrypto/main.go | 2 +- example/ratelimit/main.go | 2 +- example/simple/main.go | 2 +- example/tagprotection/main.go | 2 +- example/tokenauth/main.go | 2 +- example/topics/main.go | 2 +- github/doc.go | 2 +- github/examples_test.go | 2 +- github/github.go | 2 +- go.mod | 2 +- test/fields/fields.go | 2 +- test/integration/activity_test.go | 2 +- test/integration/authorizations_test.go | 2 +- test/integration/github_test.go | 2 +- test/integration/repos_test.go | 2 +- test/integration/users_test.go | 2 +- update-urls/go.mod | 2 +- 31 files changed, 41 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index fae03041ffb..1c8d9bd0e56 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # go-github # [![go-github release (latest SemVer)](https://img.shields.io/github/v/release/google/go-github?sort=semver)](https://github.com/google/go-github/releases) -[![GoDoc](https://img.shields.io/static/v1?label=godoc&message=reference&color=blue)](https://pkg.go.dev/github.com/google/go-github/v54/github) +[![GoDoc](https://img.shields.io/static/v1?label=godoc&message=reference&color=blue)](https://pkg.go.dev/github.com/google/go-github/v55/github) [![Test Status](https://github.com/google/go-github/workflows/tests/badge.svg)](https://github.com/google/go-github/actions?query=workflow%3Atests) [![Test Coverage](https://codecov.io/gh/google/go-github/branch/master/graph/badge.svg)](https://codecov.io/gh/google/go-github) [![Discuss at go-github@googlegroups.com](https://img.shields.io/badge/discuss-go--github%40googlegroups.com-blue.svg)](https://groups.google.com/group/go-github) @@ -24,7 +24,7 @@ If you're interested in using the [GraphQL API v4][], the recommended library is go-github is compatible with modern Go releases in module mode, with Go installed: ```bash -go get github.com/google/go-github/v54 +go get github.com/google/go-github/v55 ``` will resolve and add the package to the current development module, along with its dependencies. @@ -32,7 +32,7 @@ will resolve and add the package to the current development module, along with i Alternatively the same can be achieved if you use import in a package: ```go -import "github.com/google/go-github/v54/github" +import "github.com/google/go-github/v55/github" ``` and run `go get` without parameters. @@ -40,13 +40,13 @@ and run `go get` without parameters. Finally, to use the top-of-trunk version of this repo, use the following command: ```bash -go get github.com/google/go-github/v54@master +go get github.com/google/go-github/v55@master ``` ## Usage ## ```go -import "github.com/google/go-github/v54/github" // with go modules enabled (GO111MODULE=on or outside GOPATH) +import "github.com/google/go-github/v55/github" // with go modules enabled (GO111MODULE=on or outside GOPATH) import "github.com/google/go-github/github" // with go modules disabled ``` @@ -117,7 +117,7 @@ import ( "net/http" "github.com/bradleyfalzon/ghinstallation/v2" - "github.com/google/go-github/v54/github" + "github.com/google/go-github/v55/github" ) func main() { @@ -296,7 +296,7 @@ For complete usage of go-github, see the full [package docs][]. [GitHub API v3]: https://docs.github.com/en/rest [personal access token]: https://github.com/blog/1509-personal-api-tokens -[package docs]: https://pkg.go.dev/github.com/google/go-github/v54/github +[package docs]: https://pkg.go.dev/github.com/google/go-github/v55/github [GraphQL API v4]: https://developer.github.com/v4/ [shurcooL/githubv4]: https://github.com/shurcooL/githubv4 [GitHub webhook events]: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads @@ -369,6 +369,7 @@ Versions prior to 48.2.0 are not listed. | go-github Version | GitHub v3 API Version | | ----------------- | --------------------- | +| 55.0.0 | 2022-11-28 | | 54.0.0 | 2022-11-28 | | 53.2.0 | 2022-11-28 | | 53.1.0 | 2022-11-28 | diff --git a/example/actionpermissions/main.go b/example/actionpermissions/main.go index 0a6bedbb3f6..4ff7008ca9d 100644 --- a/example/actionpermissions/main.go +++ b/example/actionpermissions/main.go @@ -14,7 +14,7 @@ import ( "log" "os" - "github.com/google/go-github/v54/github" + "github.com/google/go-github/v55/github" ) var ( diff --git a/example/appengine/app.go b/example/appengine/app.go index 1913d9a891f..449f880cd17 100644 --- a/example/appengine/app.go +++ b/example/appengine/app.go @@ -12,7 +12,7 @@ import ( "net/http" "os" - "github.com/google/go-github/v54/github" + "github.com/google/go-github/v55/github" "google.golang.org/appengine" "google.golang.org/appengine/log" ) diff --git a/example/basicauth/main.go b/example/basicauth/main.go index f9431b25035..6cda7d6eb85 100644 --- a/example/basicauth/main.go +++ b/example/basicauth/main.go @@ -22,7 +22,7 @@ import ( "strings" "syscall" - "github.com/google/go-github/v54/github" + "github.com/google/go-github/v55/github" "golang.org/x/term" ) diff --git a/example/codespaces/newreposecretwithxcrypto/main.go b/example/codespaces/newreposecretwithxcrypto/main.go index 0faf737daf8..18c8ed24e3c 100644 --- a/example/codespaces/newreposecretwithxcrypto/main.go +++ b/example/codespaces/newreposecretwithxcrypto/main.go @@ -36,7 +36,7 @@ import ( "log" "os" - "github.com/google/go-github/v54/github" + "github.com/google/go-github/v55/github" "golang.org/x/crypto/nacl/box" ) diff --git a/example/codespaces/newusersecretwithxcrypto/main.go b/example/codespaces/newusersecretwithxcrypto/main.go index d887b4e5f40..9e05d6117e4 100644 --- a/example/codespaces/newusersecretwithxcrypto/main.go +++ b/example/codespaces/newusersecretwithxcrypto/main.go @@ -37,7 +37,7 @@ import ( "log" "os" - "github.com/google/go-github/v54/github" + "github.com/google/go-github/v55/github" "golang.org/x/crypto/nacl/box" ) diff --git a/example/commitpr/main.go b/example/commitpr/main.go index 6cdc0e8f046..1a94e1489d5 100644 --- a/example/commitpr/main.go +++ b/example/commitpr/main.go @@ -30,7 +30,7 @@ import ( "strings" "time" - "github.com/google/go-github/v54/github" + "github.com/google/go-github/v55/github" ) var ( diff --git a/example/go.mod b/example/go.mod index 496140a1b63..eaf9f5b6926 100644 --- a/example/go.mod +++ b/example/go.mod @@ -1,11 +1,11 @@ -module github.com/google/go-github/v54/example +module github.com/google/go-github/v55/example go 1.17 require ( github.com/bradleyfalzon/ghinstallation/v2 v2.0.4 github.com/gofri/go-github-ratelimit v1.0.3 - github.com/google/go-github/v54 v54.0.0 + github.com/google/go-github/v55 v55.0.0 golang.org/x/crypto v0.12.0 golang.org/x/term v0.11.0 google.golang.org/appengine v1.6.7 @@ -24,4 +24,4 @@ require ( ) // Use version at HEAD, not the latest published. -replace github.com/google/go-github/v54 => ../ +replace github.com/google/go-github/v55 => ../ diff --git a/example/listenvironments/main.go b/example/listenvironments/main.go index e2ff0c4b456..56aef7cf73a 100644 --- a/example/listenvironments/main.go +++ b/example/listenvironments/main.go @@ -18,7 +18,7 @@ import ( "log" "os" - "github.com/google/go-github/v54/github" + "github.com/google/go-github/v55/github" ) func main() { diff --git a/example/migrations/main.go b/example/migrations/main.go index d87668c1479..c5ee99c178f 100644 --- a/example/migrations/main.go +++ b/example/migrations/main.go @@ -12,7 +12,7 @@ import ( "context" "fmt" - "github.com/google/go-github/v54/github" + "github.com/google/go-github/v55/github" ) func fetchAllUserMigrations() ([]*github.UserMigration, error) { diff --git a/example/newfilewithappauth/main.go b/example/newfilewithappauth/main.go index 8b2a4987585..cd85a885106 100644 --- a/example/newfilewithappauth/main.go +++ b/example/newfilewithappauth/main.go @@ -16,7 +16,7 @@ import ( "time" "github.com/bradleyfalzon/ghinstallation/v2" - "github.com/google/go-github/v54/github" + "github.com/google/go-github/v55/github" ) func main() { diff --git a/example/newrepo/main.go b/example/newrepo/main.go index 84d315821f7..aa800333a6c 100644 --- a/example/newrepo/main.go +++ b/example/newrepo/main.go @@ -16,7 +16,7 @@ import ( "log" "os" - "github.com/google/go-github/v54/github" + "github.com/google/go-github/v55/github" ) var ( diff --git a/example/newreposecretwithlibsodium/go.mod b/example/newreposecretwithlibsodium/go.mod index 98684c1c1d9..114862d69f3 100644 --- a/example/newreposecretwithlibsodium/go.mod +++ b/example/newreposecretwithlibsodium/go.mod @@ -4,8 +4,8 @@ go 1.15 require ( github.com/GoKillers/libsodium-go v0.0.0-20171022220152-dd733721c3cb - github.com/google/go-github/v54 v54.0.0 + github.com/google/go-github/v55 v55.0.0 ) // Use version at HEAD, not the latest published. -replace github.com/google/go-github/v54 => ../.. +replace github.com/google/go-github/v55 => ../.. diff --git a/example/newreposecretwithlibsodium/main.go b/example/newreposecretwithlibsodium/main.go index c0d412b51ac..bdd9affb2f4 100644 --- a/example/newreposecretwithlibsodium/main.go +++ b/example/newreposecretwithlibsodium/main.go @@ -36,7 +36,7 @@ import ( "os" sodium "github.com/GoKillers/libsodium-go/cryptobox" - "github.com/google/go-github/v54/github" + "github.com/google/go-github/v55/github" ) var ( diff --git a/example/newreposecretwithxcrypto/main.go b/example/newreposecretwithxcrypto/main.go index 0e9a11d9cd9..3b65e1548d8 100644 --- a/example/newreposecretwithxcrypto/main.go +++ b/example/newreposecretwithxcrypto/main.go @@ -36,7 +36,7 @@ import ( "log" "os" - "github.com/google/go-github/v54/github" + "github.com/google/go-github/v55/github" "golang.org/x/crypto/nacl/box" ) diff --git a/example/ratelimit/main.go b/example/ratelimit/main.go index dcc1510000f..a311c9c058d 100644 --- a/example/ratelimit/main.go +++ b/example/ratelimit/main.go @@ -13,7 +13,7 @@ import ( "fmt" "github.com/gofri/go-github-ratelimit/github_ratelimit" - "github.com/google/go-github/v54/github" + "github.com/google/go-github/v55/github" ) func main() { diff --git a/example/simple/main.go b/example/simple/main.go index bb2a624d315..72583159d87 100644 --- a/example/simple/main.go +++ b/example/simple/main.go @@ -12,7 +12,7 @@ import ( "context" "fmt" - "github.com/google/go-github/v54/github" + "github.com/google/go-github/v55/github" ) // Fetch all the public organizations' membership of a user. diff --git a/example/tagprotection/main.go b/example/tagprotection/main.go index 2499b242603..056ffae4ea9 100644 --- a/example/tagprotection/main.go +++ b/example/tagprotection/main.go @@ -19,7 +19,7 @@ import ( "strings" "syscall" - "github.com/google/go-github/v54/github" + "github.com/google/go-github/v55/github" "golang.org/x/term" ) diff --git a/example/tokenauth/main.go b/example/tokenauth/main.go index 645bb749aca..6fe51804f2e 100644 --- a/example/tokenauth/main.go +++ b/example/tokenauth/main.go @@ -15,7 +15,7 @@ import ( "log" "syscall" - "github.com/google/go-github/v54/github" + "github.com/google/go-github/v55/github" "golang.org/x/term" ) diff --git a/example/topics/main.go b/example/topics/main.go index 83d3d7faa7b..98614836c77 100644 --- a/example/topics/main.go +++ b/example/topics/main.go @@ -12,7 +12,7 @@ import ( "context" "fmt" - "github.com/google/go-github/v54/github" + "github.com/google/go-github/v55/github" ) // Fetch and lists all the public topics associated with the specified GitHub topic diff --git a/github/doc.go b/github/doc.go index b4e6163d2b9..bace6fb3c6f 100644 --- a/github/doc.go +++ b/github/doc.go @@ -8,7 +8,7 @@ Package github provides a client for using the GitHub API. Usage: - import "github.com/google/go-github/v54/github" // with go modules enabled (GO111MODULE=on or outside GOPATH) + import "github.com/google/go-github/v55/github" // with go modules enabled (GO111MODULE=on or outside GOPATH) import "github.com/google/go-github/github" // with go modules disabled Construct a new GitHub client, then use the various services on the client to diff --git a/github/examples_test.go b/github/examples_test.go index 71315594afe..a2147bf417f 100644 --- a/github/examples_test.go +++ b/github/examples_test.go @@ -12,7 +12,7 @@ import ( "fmt" "log" - "github.com/google/go-github/v54/github" + "github.com/google/go-github/v55/github" ) func ExampleClient_Markdown() { diff --git a/github/github.go b/github/github.go index dbd856b0e2d..df01144460f 100644 --- a/github/github.go +++ b/github/github.go @@ -27,7 +27,7 @@ import ( ) const ( - Version = "v54.0.0" + Version = "v55.0.0" defaultAPIVersion = "2022-11-28" defaultBaseURL = "https://api.github.com/" diff --git a/go.mod b/go.mod index fa43a0aa5ff..c41237ead0e 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/google/go-github/v54 +module github.com/google/go-github/v55 require ( github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 diff --git a/test/fields/fields.go b/test/fields/fields.go index 6b44a04310d..c32cdaba980 100644 --- a/test/fields/fields.go +++ b/test/fields/fields.go @@ -25,7 +25,7 @@ import ( "reflect" "strings" - "github.com/google/go-github/v54/github" + "github.com/google/go-github/v55/github" ) var ( diff --git a/test/integration/activity_test.go b/test/integration/activity_test.go index 32620ec4270..90d43711b4e 100644 --- a/test/integration/activity_test.go +++ b/test/integration/activity_test.go @@ -12,7 +12,7 @@ import ( "context" "testing" - "github.com/google/go-github/v54/github" + "github.com/google/go-github/v55/github" ) const ( diff --git a/test/integration/authorizations_test.go b/test/integration/authorizations_test.go index ff4980672cd..d5bdf2e2884 100644 --- a/test/integration/authorizations_test.go +++ b/test/integration/authorizations_test.go @@ -17,7 +17,7 @@ import ( "testing" "time" - "github.com/google/go-github/v54/github" + "github.com/google/go-github/v55/github" ) const msgEnvMissing = "Skipping test because the required environment variable (%v) is not present." diff --git a/test/integration/github_test.go b/test/integration/github_test.go index 5bef6ca73aa..a51a2b23a47 100644 --- a/test/integration/github_test.go +++ b/test/integration/github_test.go @@ -15,7 +15,7 @@ import ( "net/http" "os" - "github.com/google/go-github/v54/github" + "github.com/google/go-github/v55/github" ) var ( diff --git a/test/integration/repos_test.go b/test/integration/repos_test.go index 72441bc57b4..f6d72d5edd8 100644 --- a/test/integration/repos_test.go +++ b/test/integration/repos_test.go @@ -15,7 +15,7 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/google/go-github/v54/github" + "github.com/google/go-github/v55/github" ) func TestRepositories_CRUD(t *testing.T) { diff --git a/test/integration/users_test.go b/test/integration/users_test.go index 61bf8c9974d..64efcd04a3e 100644 --- a/test/integration/users_test.go +++ b/test/integration/users_test.go @@ -14,7 +14,7 @@ import ( "math/rand" "testing" - "github.com/google/go-github/v54/github" + "github.com/google/go-github/v55/github" ) func TestUsers_Get(t *testing.T) { diff --git a/update-urls/go.mod b/update-urls/go.mod index faa2ff61eef..8fcf97b0614 100644 --- a/update-urls/go.mod +++ b/update-urls/go.mod @@ -1,4 +1,4 @@ -module github.com/google/go-github/v54/update-urls +module github.com/google/go-github/v55/update-urls go 1.16 From b7004313ee714201eb28bdd4d6fb98b7bd323611 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Tue, 5 Sep 2023 13:13:24 -0400 Subject: [PATCH 013/145] Bump go-github from v54 to v55 in /scrape (#2915) --- scrape/apps.go | 2 +- scrape/apps_test.go | 2 +- scrape/go.mod | 2 +- scrape/go.sum | 1516 +------------------------------------------ 4 files changed, 5 insertions(+), 1517 deletions(-) diff --git a/scrape/apps.go b/scrape/apps.go index 56db9c9a5a1..9cb99ddc0f8 100644 --- a/scrape/apps.go +++ b/scrape/apps.go @@ -17,7 +17,7 @@ import ( "strings" "github.com/PuerkitoBio/goquery" - "github.com/google/go-github/v54/github" + "github.com/google/go-github/v55/github" ) // AppRestrictionsEnabled returns whether the specified organization has diff --git a/scrape/apps_test.go b/scrape/apps_test.go index 32d7944940e..f80825fbad2 100644 --- a/scrape/apps_test.go +++ b/scrape/apps_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/google/go-github/v54/github" + "github.com/google/go-github/v55/github" ) func Test_AppRestrictionsEnabled(t *testing.T) { diff --git a/scrape/go.mod b/scrape/go.mod index 15673097473..8c6116364a6 100644 --- a/scrape/go.mod +++ b/scrape/go.mod @@ -5,7 +5,7 @@ go 1.13 require ( github.com/PuerkitoBio/goquery v1.8.1 github.com/google/go-cmp v0.5.9 - github.com/google/go-github/v54 v54.0.0 + github.com/google/go-github/v55 v55.0.0 github.com/xlzd/gotp v0.1.0 golang.org/x/net v0.14.0 ) diff --git a/scrape/go.sum b/scrape/go.sum index 8edb2296e4d..7a79727970b 100644 --- a/scrape/go.sum +++ b/scrape/go.sum @@ -1,1586 +1,74 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.44.3/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= -cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= -cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= -cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= -cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= -cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= -cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= -cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= -cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= -cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= -cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= -cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= -cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= -cloud.google.com/go v0.83.0/go.mod h1:Z7MJUsANfY0pYPdw0lbnivPx4/vhy/e2FEkSkF7vAVY= -cloud.google.com/go v0.84.0/go.mod h1:RazrYuxIK6Kb7YrzzhPoLmCVzl7Sup4NrbKPg8KHSUM= -cloud.google.com/go v0.87.0/go.mod h1:TpDYlFy7vuLzZMMZ+B6iRiELaY7z/gJPaqbMx6mlWcY= -cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aDQ= -cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI= -cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4= -cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc= -cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= -cloud.google.com/go v0.100.1/go.mod h1:fs4QogzfH5n2pBXBP9vRiU+eCny7lD2vmFZy79Iuw1U= -cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A= -cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc= -cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU= -cloud.google.com/go v0.104.0/go.mod h1:OO6xxXdJyvuJPcEPBLN9BJPD+jep5G1+2U5B5gkRYtA= -cloud.google.com/go v0.105.0/go.mod h1:PrLgOJNe5nfE9UMxKxgXj4mD3voiP+YQ6gdt6KMFOKM= -cloud.google.com/go v0.107.0/go.mod h1:wpc2eNrD7hXUTy8EKS10jkxpZBjASrORK7goS+3YX2I= -cloud.google.com/go v0.110.0/go.mod h1:SJnCLqQ0FCFGSZMUNUf84MV3Aia54kn7pi8st7tMzaY= -cloud.google.com/go v0.110.2/go.mod h1:k04UEeEtb6ZBRTv3dZz4CeJC3jKGxyhl0sAiVVquxiw= -cloud.google.com/go/accessapproval v1.4.0/go.mod h1:zybIuC3KpDOvotz59lFe5qxRZx6C75OtwbisN56xYB4= -cloud.google.com/go/accessapproval v1.5.0/go.mod h1:HFy3tuiGvMdcd/u+Cu5b9NkO1pEICJ46IR82PoUdplw= -cloud.google.com/go/accessapproval v1.6.0/go.mod h1:R0EiYnwV5fsRFiKZkPHr6mwyk2wxUJ30nL4j2pcFY2E= -cloud.google.com/go/accesscontextmanager v1.3.0/go.mod h1:TgCBehyr5gNMz7ZaH9xubp+CE8dkrszb4oK9CWyvD4o= -cloud.google.com/go/accesscontextmanager v1.4.0/go.mod h1:/Kjh7BBu/Gh83sv+K60vN9QE5NJcd80sU33vIe2IFPE= -cloud.google.com/go/accesscontextmanager v1.6.0/go.mod h1:8XCvZWfYw3K/ji0iVnp+6pu7huxoQTLmxAbVjbloTtM= -cloud.google.com/go/accesscontextmanager v1.7.0/go.mod h1:CEGLewx8dwa33aDAZQujl7Dx+uYhS0eay198wB/VumQ= -cloud.google.com/go/aiplatform v1.22.0/go.mod h1:ig5Nct50bZlzV6NvKaTwmplLLddFx0YReh9WfTO5jKw= -cloud.google.com/go/aiplatform v1.24.0/go.mod h1:67UUvRBKG6GTayHKV8DBv2RtR1t93YRu5B1P3x99mYY= -cloud.google.com/go/aiplatform v1.27.0/go.mod h1:Bvxqtl40l0WImSb04d0hXFU7gDOiq9jQmorivIiWcKg= -cloud.google.com/go/aiplatform v1.35.0/go.mod h1:7MFT/vCaOyZT/4IIFfxH4ErVg/4ku6lKv3w0+tFTgXQ= -cloud.google.com/go/aiplatform v1.36.1/go.mod h1:WTm12vJRPARNvJ+v6P52RDHCNe4AhvjcIZ/9/RRHy/k= -cloud.google.com/go/aiplatform v1.37.0/go.mod h1:IU2Cv29Lv9oCn/9LkFiiuKfwrRTq+QQMbW+hPCxJGZw= -cloud.google.com/go/analytics v0.11.0/go.mod h1:DjEWCu41bVbYcKyvlws9Er60YE4a//bK6mnhWvQeFNI= -cloud.google.com/go/analytics v0.12.0/go.mod h1:gkfj9h6XRf9+TS4bmuhPEShsh3hH8PAZzm/41OOhQd4= -cloud.google.com/go/analytics v0.17.0/go.mod h1:WXFa3WSym4IZ+JiKmavYdJwGG/CvpqiqczmL59bTD9M= -cloud.google.com/go/analytics v0.18.0/go.mod h1:ZkeHGQlcIPkw0R/GW+boWHhCOR43xz9RN/jn7WcqfIE= -cloud.google.com/go/analytics v0.19.0/go.mod h1:k8liqf5/HCnOUkbawNtrWWc+UAzyDlW89doe8TtoDsE= -cloud.google.com/go/apigateway v1.3.0/go.mod h1:89Z8Bhpmxu6AmUxuVRg/ECRGReEdiP3vQtk4Z1J9rJk= -cloud.google.com/go/apigateway v1.4.0/go.mod h1:pHVY9MKGaH9PQ3pJ4YLzoj6U5FUDeDFBllIz7WmzJoc= -cloud.google.com/go/apigateway v1.5.0/go.mod h1:GpnZR3Q4rR7LVu5951qfXPJCHquZt02jf7xQx7kpqN8= -cloud.google.com/go/apigeeconnect v1.3.0/go.mod h1:G/AwXFAKo0gIXkPTVfZDd2qA1TxBXJ3MgMRBQkIi9jc= -cloud.google.com/go/apigeeconnect v1.4.0/go.mod h1:kV4NwOKqjvt2JYR0AoIWo2QGfoRtn/pkS3QlHp0Ni04= -cloud.google.com/go/apigeeconnect v1.5.0/go.mod h1:KFaCqvBRU6idyhSNyn3vlHXc8VMDJdRmwDF6JyFRqZ8= -cloud.google.com/go/apigeeregistry v0.4.0/go.mod h1:EUG4PGcsZvxOXAdyEghIdXwAEi/4MEaoqLMLDMIwKXY= -cloud.google.com/go/apigeeregistry v0.5.0/go.mod h1:YR5+s0BVNZfVOUkMa5pAR2xGd0A473vA5M7j247o1wM= -cloud.google.com/go/apigeeregistry v0.6.0/go.mod h1:BFNzW7yQVLZ3yj0TKcwzb8n25CFBri51GVGOEUcgQsc= -cloud.google.com/go/apikeys v0.4.0/go.mod h1:XATS/yqZbaBK0HOssf+ALHp8jAlNHUgyfprvNcBIszU= -cloud.google.com/go/apikeys v0.5.0/go.mod h1:5aQfwY4D+ewMMWScd3hm2en3hCj+BROlyrt3ytS7KLI= -cloud.google.com/go/apikeys v0.6.0/go.mod h1:kbpXu5upyiAlGkKrJgQl8A0rKNNJ7dQ377pdroRSSi8= -cloud.google.com/go/appengine v1.4.0/go.mod h1:CS2NhuBuDXM9f+qscZ6V86m1MIIqPj3WC/UoEuR1Sno= -cloud.google.com/go/appengine v1.5.0/go.mod h1:TfasSozdkFI0zeoxW3PTBLiNqRmzraodCWatWI9Dmak= -cloud.google.com/go/appengine v1.6.0/go.mod h1:hg6i0J/BD2cKmDJbaFSYHFyZkgBEfQrDg/X0V5fJn84= -cloud.google.com/go/appengine v1.7.0/go.mod h1:eZqpbHFCqRGa2aCdope7eC0SWLV1j0neb/QnMJVWx6A= -cloud.google.com/go/appengine v1.7.1/go.mod h1:IHLToyb/3fKutRysUlFO0BPt5j7RiQ45nrzEJmKTo6E= -cloud.google.com/go/area120 v0.5.0/go.mod h1:DE/n4mp+iqVyvxHN41Vf1CR602GiHQjFPusMFW6bGR4= -cloud.google.com/go/area120 v0.6.0/go.mod h1:39yFJqWVgm0UZqWTOdqkLhjoC7uFfgXRC8g/ZegeAh0= -cloud.google.com/go/area120 v0.7.0/go.mod h1:a3+8EUD1SX5RUcCs3MY5YasiO1z6yLiNLRiFrykbynY= -cloud.google.com/go/area120 v0.7.1/go.mod h1:j84i4E1RboTWjKtZVWXPqvK5VHQFJRF2c1Nm69pWm9k= -cloud.google.com/go/artifactregistry v1.6.0/go.mod h1:IYt0oBPSAGYj/kprzsBjZ/4LnG/zOcHyFHjWPCi6SAQ= -cloud.google.com/go/artifactregistry v1.7.0/go.mod h1:mqTOFOnGZx8EtSqK/ZWcsm/4U8B77rbcLP6ruDU2Ixk= -cloud.google.com/go/artifactregistry v1.8.0/go.mod h1:w3GQXkJX8hiKN0v+at4b0qotwijQbYUqF2GWkZzAhC0= -cloud.google.com/go/artifactregistry v1.9.0/go.mod h1:2K2RqvA2CYvAeARHRkLDhMDJ3OXy26h3XW+3/Jh2uYc= -cloud.google.com/go/artifactregistry v1.11.1/go.mod h1:lLYghw+Itq9SONbCa1YWBoWs1nOucMH0pwXN1rOBZFI= -cloud.google.com/go/artifactregistry v1.11.2/go.mod h1:nLZns771ZGAwVLzTX/7Al6R9ehma4WUEhZGWV6CeQNQ= -cloud.google.com/go/artifactregistry v1.12.0/go.mod h1:o6P3MIvtzTOnmvGagO9v/rOjjA0HmhJ+/6KAXrmYDCI= -cloud.google.com/go/artifactregistry v1.13.0/go.mod h1:uy/LNfoOIivepGhooAUpL1i30Hgee3Cu0l4VTWHUC08= -cloud.google.com/go/asset v1.5.0/go.mod h1:5mfs8UvcM5wHhqtSv8J1CtxxaQq3AdBxxQi2jGW/K4o= -cloud.google.com/go/asset v1.7.0/go.mod h1:YbENsRK4+xTiL+Ofoj5Ckf+O17kJtgp3Y3nn4uzZz5s= -cloud.google.com/go/asset v1.8.0/go.mod h1:mUNGKhiqIdbr8X7KNayoYvyc4HbbFO9URsjbytpUaW0= -cloud.google.com/go/asset v1.9.0/go.mod h1:83MOE6jEJBMqFKadM9NLRcs80Gdw76qGuHn8m3h8oHQ= -cloud.google.com/go/asset v1.10.0/go.mod h1:pLz7uokL80qKhzKr4xXGvBQXnzHn5evJAEAtZiIb0wY= -cloud.google.com/go/asset v1.11.1/go.mod h1:fSwLhbRvC9p9CXQHJ3BgFeQNM4c9x10lqlrdEUYXlJo= -cloud.google.com/go/asset v1.12.0/go.mod h1:h9/sFOa4eDIyKmH6QMpm4eUK3pDojWnUhTgJlk762Hg= -cloud.google.com/go/asset v1.13.0/go.mod h1:WQAMyYek/b7NBpYq/K4KJWcRqzoalEsxz/t/dTk4THw= -cloud.google.com/go/assuredworkloads v1.5.0/go.mod h1:n8HOZ6pff6re5KYfBXcFvSViQjDwxFkAkmUFffJRbbY= -cloud.google.com/go/assuredworkloads v1.6.0/go.mod h1:yo2YOk37Yc89Rsd5QMVECvjaMKymF9OP+QXWlKXUkXw= -cloud.google.com/go/assuredworkloads v1.7.0/go.mod h1:z/736/oNmtGAyU47reJgGN+KVoYoxeLBoj4XkKYscNI= -cloud.google.com/go/assuredworkloads v1.8.0/go.mod h1:AsX2cqyNCOvEQC8RMPnoc0yEarXQk6WEKkxYfL6kGIo= -cloud.google.com/go/assuredworkloads v1.9.0/go.mod h1:kFuI1P78bplYtT77Tb1hi0FMxM0vVpRC7VVoJC3ZoT0= -cloud.google.com/go/assuredworkloads v1.10.0/go.mod h1:kwdUQuXcedVdsIaKgKTp9t0UJkE5+PAVNhdQm4ZVq2E= -cloud.google.com/go/automl v1.5.0/go.mod h1:34EjfoFGMZ5sgJ9EoLsRtdPSNZLcfflJR39VbVNS2M0= -cloud.google.com/go/automl v1.6.0/go.mod h1:ugf8a6Fx+zP0D59WLhqgTDsQI9w07o64uf/Is3Nh5p8= -cloud.google.com/go/automl v1.7.0/go.mod h1:RL9MYCCsJEOmt0Wf3z9uzG0a7adTT1fe+aObgSpkCt8= -cloud.google.com/go/automl v1.8.0/go.mod h1:xWx7G/aPEe/NP+qzYXktoBSDfjO+vnKMGgsApGJJquM= -cloud.google.com/go/automl v1.12.0/go.mod h1:tWDcHDp86aMIuHmyvjuKeeHEGq76lD7ZqfGLN6B0NuU= -cloud.google.com/go/baremetalsolution v0.3.0/go.mod h1:XOrocE+pvK1xFfleEnShBlNAXf+j5blPPxrhjKgnIFc= -cloud.google.com/go/baremetalsolution v0.4.0/go.mod h1:BymplhAadOO/eBa7KewQ0Ppg4A4Wplbn+PsFKRLo0uI= -cloud.google.com/go/baremetalsolution v0.5.0/go.mod h1:dXGxEkmR9BMwxhzBhV0AioD0ULBmuLZI8CdwalUxuss= -cloud.google.com/go/batch v0.3.0/go.mod h1:TR18ZoAekj1GuirsUsR1ZTKN3FC/4UDnScjT8NXImFE= -cloud.google.com/go/batch v0.4.0/go.mod h1:WZkHnP43R/QCGQsZ+0JyG4i79ranE2u8xvjq/9+STPE= -cloud.google.com/go/batch v0.7.0/go.mod h1:vLZN95s6teRUqRQ4s3RLDsH8PvboqBK+rn1oevL159g= -cloud.google.com/go/beyondcorp v0.2.0/go.mod h1:TB7Bd+EEtcw9PCPQhCJtJGjk/7TC6ckmnSFS+xwTfm4= -cloud.google.com/go/beyondcorp v0.3.0/go.mod h1:E5U5lcrcXMsCuoDNyGrpyTm/hn7ne941Jz2vmksAxW8= -cloud.google.com/go/beyondcorp v0.4.0/go.mod h1:3ApA0mbhHx6YImmuubf5pyW8srKnCEPON32/5hj+RmM= -cloud.google.com/go/beyondcorp v0.5.0/go.mod h1:uFqj9X+dSfrheVp7ssLTaRHd2EHqSL4QZmH4e8WXGGU= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= -cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= -cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= -cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= -cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/bigquery v1.42.0/go.mod h1:8dRTJxhtG+vwBKzE5OseQn/hiydoQN3EedCaOdYmxRA= -cloud.google.com/go/bigquery v1.43.0/go.mod h1:ZMQcXHsl+xmU1z36G2jNGZmKp9zNY5BUua5wDgmNCfw= -cloud.google.com/go/bigquery v1.44.0/go.mod h1:0Y33VqXTEsbamHJvJHdFmtqHvMIY28aK1+dFsvaChGc= -cloud.google.com/go/bigquery v1.47.0/go.mod h1:sA9XOgy0A8vQK9+MWhEQTY6Tix87M/ZurWFIxmF9I/E= -cloud.google.com/go/bigquery v1.48.0/go.mod h1:QAwSz+ipNgfL5jxiaK7weyOhzdoAy1zFm0Nf1fysJac= -cloud.google.com/go/bigquery v1.49.0/go.mod h1:Sv8hMmTFFYBlt/ftw2uN6dFdQPzBlREY9yBh7Oy7/4Q= -cloud.google.com/go/bigquery v1.50.0/go.mod h1:YrleYEh2pSEbgTBZYMJ5SuSr0ML3ypjRB1zgf7pvQLU= -cloud.google.com/go/billing v1.4.0/go.mod h1:g9IdKBEFlItS8bTtlrZdVLWSSdSyFUZKXNS02zKMOZY= -cloud.google.com/go/billing v1.5.0/go.mod h1:mztb1tBc3QekhjSgmpf/CV4LzWXLzCArwpLmP2Gm88s= -cloud.google.com/go/billing v1.6.0/go.mod h1:WoXzguj+BeHXPbKfNWkqVtDdzORazmCjraY+vrxcyvI= -cloud.google.com/go/billing v1.7.0/go.mod h1:q457N3Hbj9lYwwRbnlD7vUpyjq6u5U1RAOArInEiD5Y= -cloud.google.com/go/billing v1.12.0/go.mod h1:yKrZio/eu+okO/2McZEbch17O5CB5NpZhhXG6Z766ss= -cloud.google.com/go/billing v1.13.0/go.mod h1:7kB2W9Xf98hP9Sr12KfECgfGclsH3CQR0R08tnRlRbc= -cloud.google.com/go/binaryauthorization v1.1.0/go.mod h1:xwnoWu3Y84jbuHa0zd526MJYmtnVXn0syOjaJgy4+dM= -cloud.google.com/go/binaryauthorization v1.2.0/go.mod h1:86WKkJHtRcv5ViNABtYMhhNWRrD1Vpi//uKEy7aYEfI= -cloud.google.com/go/binaryauthorization v1.3.0/go.mod h1:lRZbKgjDIIQvzYQS1p99A7/U1JqvqeZg0wiI5tp6tg0= -cloud.google.com/go/binaryauthorization v1.4.0/go.mod h1:tsSPQrBd77VLplV70GUhBf/Zm3FsKmgSqgm4UmiDItk= -cloud.google.com/go/binaryauthorization v1.5.0/go.mod h1:OSe4OU1nN/VswXKRBmciKpo9LulY41gch5c68htf3/Q= -cloud.google.com/go/certificatemanager v1.3.0/go.mod h1:n6twGDvcUBFu9uBgt4eYvvf3sQ6My8jADcOVwHmzadg= -cloud.google.com/go/certificatemanager v1.4.0/go.mod h1:vowpercVFyqs8ABSmrdV+GiFf2H/ch3KyudYQEMM590= -cloud.google.com/go/certificatemanager v1.6.0/go.mod h1:3Hh64rCKjRAX8dXgRAyOcY5vQ/fE1sh8o+Mdd6KPgY8= -cloud.google.com/go/channel v1.8.0/go.mod h1:W5SwCXDJsq/rg3tn3oG0LOxpAo6IMxNa09ngphpSlnk= -cloud.google.com/go/channel v1.9.0/go.mod h1:jcu05W0my9Vx4mt3/rEHpfxc9eKi9XwsdDL8yBMbKUk= -cloud.google.com/go/channel v1.11.0/go.mod h1:IdtI0uWGqhEeatSB62VOoJ8FSUhJ9/+iGkJVqp74CGE= -cloud.google.com/go/channel v1.12.0/go.mod h1:VkxCGKASi4Cq7TbXxlaBezonAYpp1GCnKMY6tnMQnLU= -cloud.google.com/go/cloudbuild v1.3.0/go.mod h1:WequR4ULxlqvMsjDEEEFnOG5ZSRSgWOywXYDb1vPE6U= -cloud.google.com/go/cloudbuild v1.4.0/go.mod h1:5Qwa40LHiOXmz3386FrjrYM93rM/hdRr7b53sySrTqA= -cloud.google.com/go/cloudbuild v1.6.0/go.mod h1:UIbc/w9QCbH12xX+ezUsgblrWv+Cv4Tw83GiSMHOn9M= -cloud.google.com/go/cloudbuild v1.7.0/go.mod h1:zb5tWh2XI6lR9zQmsm1VRA+7OCuve5d8S+zJUul8KTg= -cloud.google.com/go/cloudbuild v1.9.0/go.mod h1:qK1d7s4QlO0VwfYn5YuClDGg2hfmLZEb4wQGAbIgL1s= -cloud.google.com/go/clouddms v1.3.0/go.mod h1:oK6XsCDdW4Ib3jCCBugx+gVjevp2TMXFtgxvPSee3OM= -cloud.google.com/go/clouddms v1.4.0/go.mod h1:Eh7sUGCC+aKry14O1NRljhjyrr0NFC0G2cjwX0cByRk= -cloud.google.com/go/clouddms v1.5.0/go.mod h1:QSxQnhikCLUw13iAbffF2CZxAER3xDGNHjsTAkQJcQA= -cloud.google.com/go/cloudtasks v1.5.0/go.mod h1:fD92REy1x5woxkKEkLdvavGnPJGEn8Uic9nWuLzqCpY= -cloud.google.com/go/cloudtasks v1.6.0/go.mod h1:C6Io+sxuke9/KNRkbQpihnW93SWDU3uXt92nu85HkYI= -cloud.google.com/go/cloudtasks v1.7.0/go.mod h1:ImsfdYWwlWNJbdgPIIGJWC+gemEGTBK/SunNQQNCAb4= -cloud.google.com/go/cloudtasks v1.8.0/go.mod h1:gQXUIwCSOI4yPVK7DgTVFiiP0ZW/eQkydWzwVMdHxrI= -cloud.google.com/go/cloudtasks v1.9.0/go.mod h1:w+EyLsVkLWHcOaqNEyvcKAsWp9p29dL6uL9Nst1cI7Y= -cloud.google.com/go/cloudtasks v1.10.0/go.mod h1:NDSoTLkZ3+vExFEWu2UJV1arUyzVDAiZtdWcsUyNwBs= -cloud.google.com/go/compute v0.1.0/go.mod h1:GAesmwr110a34z04OlxYkATPBEfVhkymfTBXtfbBFow= -cloud.google.com/go/compute v1.3.0/go.mod h1:cCZiE1NHEtai4wiufUhW8I8S1JKkAnhnQJWM7YD99wM= -cloud.google.com/go/compute v1.5.0/go.mod h1:9SMHyhJlzhlkJqrPAc839t2BZFTSk6Jdj6mkzQJeu0M= -cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz/FMzPu0s= -cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= -cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U= -cloud.google.com/go/compute v1.10.0/go.mod h1:ER5CLbMxl90o2jtNbGSbtfOpQKR0t15FOtRsugnLrlU= -cloud.google.com/go/compute v1.12.0/go.mod h1:e8yNOBcBONZU1vJKCvCoDw/4JQsA0dpM4x/6PIIOocU= -cloud.google.com/go/compute v1.12.1/go.mod h1:e8yNOBcBONZU1vJKCvCoDw/4JQsA0dpM4x/6PIIOocU= -cloud.google.com/go/compute v1.13.0/go.mod h1:5aPTS0cUNMIc1CE546K+Th6weJUNQErARyZtRXDJ8GE= -cloud.google.com/go/compute v1.14.0/go.mod h1:YfLtxrj9sU4Yxv+sXzZkyPjEyPBZfXHUvjxega5vAdo= -cloud.google.com/go/compute v1.15.1/go.mod h1:bjjoF/NtFUrkD/urWfdHaKuOPDR5nWIs63rR+SXhcpA= -cloud.google.com/go/compute v1.18.0/go.mod h1:1X7yHxec2Ga+Ss6jPyjxRxpu2uu7PLgsOVXvgU0yacs= -cloud.google.com/go/compute v1.19.0/go.mod h1:rikpw2y+UMidAe9tISo04EHNOIf42RLYF/q8Bs93scU= -cloud.google.com/go/compute v1.19.3/go.mod h1:qxvISKp/gYnXkSAD1ppcSOveRAmzxicEv/JlizULFrI= -cloud.google.com/go/compute v1.20.1/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= -cloud.google.com/go/compute/metadata v0.1.0/go.mod h1:Z1VN+bulIf6bt4P/C37K4DyZYZEXYonfTBHHFPO/4UU= -cloud.google.com/go/compute/metadata v0.2.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= -cloud.google.com/go/compute/metadata v0.2.1/go.mod h1:jgHgmJd2RKBGzXqF5LR2EZMGxBkeanZ9wwa75XHJgOM= -cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= -cloud.google.com/go/contactcenterinsights v1.3.0/go.mod h1:Eu2oemoePuEFc/xKFPjbTuPSj0fYJcPls9TFlPNnHHY= -cloud.google.com/go/contactcenterinsights v1.4.0/go.mod h1:L2YzkGbPsv+vMQMCADxJoT9YiTTnSEd6fEvCeHTYVck= -cloud.google.com/go/contactcenterinsights v1.6.0/go.mod h1:IIDlT6CLcDoyv79kDv8iWxMSTZhLxSCofVV5W6YFM/w= -cloud.google.com/go/container v1.6.0/go.mod h1:Xazp7GjJSeUYo688S+6J5V+n/t+G5sKBTFkKNudGRxg= -cloud.google.com/go/container v1.7.0/go.mod h1:Dp5AHtmothHGX3DwwIHPgq45Y8KmNsgN3amoYfxVkLo= -cloud.google.com/go/container v1.13.1/go.mod h1:6wgbMPeQRw9rSnKBCAJXnds3Pzj03C4JHamr8asWKy4= -cloud.google.com/go/container v1.14.0/go.mod h1:3AoJMPhHfLDxLvrlVWaK57IXzaPnLaZq63WX59aQBfM= -cloud.google.com/go/container v1.15.0/go.mod h1:ft+9S0WGjAyjDggg5S06DXj+fHJICWg8L7isCQe9pQA= -cloud.google.com/go/containeranalysis v0.5.1/go.mod h1:1D92jd8gRR/c0fGMlymRgxWD3Qw9C1ff6/T7mLgVL8I= -cloud.google.com/go/containeranalysis v0.6.0/go.mod h1:HEJoiEIu+lEXM+k7+qLCci0h33lX3ZqoYFdmPcoO7s4= -cloud.google.com/go/containeranalysis v0.7.0/go.mod h1:9aUL+/vZ55P2CXfuZjS4UjQ9AgXoSw8Ts6lemfmxBxI= -cloud.google.com/go/containeranalysis v0.9.0/go.mod h1:orbOANbwk5Ejoom+s+DUCTTJ7IBdBQJDcSylAx/on9s= -cloud.google.com/go/datacatalog v1.3.0/go.mod h1:g9svFY6tuR+j+hrTw3J2dNcmI0dzmSiyOzm8kpLq0a0= -cloud.google.com/go/datacatalog v1.5.0/go.mod h1:M7GPLNQeLfWqeIm3iuiruhPzkt65+Bx8dAKvScX8jvs= -cloud.google.com/go/datacatalog v1.6.0/go.mod h1:+aEyF8JKg+uXcIdAmmaMUmZ3q1b/lKLtXCmXdnc0lbc= -cloud.google.com/go/datacatalog v1.7.0/go.mod h1:9mEl4AuDYWw81UGc41HonIHH7/sn52H0/tc8f8ZbZIE= -cloud.google.com/go/datacatalog v1.8.0/go.mod h1:KYuoVOv9BM8EYz/4eMFxrr4DUKhGIOXxZoKYF5wdISM= -cloud.google.com/go/datacatalog v1.8.1/go.mod h1:RJ58z4rMp3gvETA465Vg+ag8BGgBdnRPEMMSTr5Uv+M= -cloud.google.com/go/datacatalog v1.12.0/go.mod h1:CWae8rFkfp6LzLumKOnmVh4+Zle4A3NXLzVJ1d1mRm0= -cloud.google.com/go/datacatalog v1.13.0/go.mod h1:E4Rj9a5ZtAxcQJlEBTLgMTphfP11/lNaAshpoBgemX8= -cloud.google.com/go/dataflow v0.6.0/go.mod h1:9QwV89cGoxjjSR9/r7eFDqqjtvbKxAK2BaYU6PVk9UM= -cloud.google.com/go/dataflow v0.7.0/go.mod h1:PX526vb4ijFMesO1o202EaUmouZKBpjHsTlCtB4parQ= -cloud.google.com/go/dataflow v0.8.0/go.mod h1:Rcf5YgTKPtQyYz8bLYhFoIV/vP39eL7fWNcSOyFfLJE= -cloud.google.com/go/dataform v0.3.0/go.mod h1:cj8uNliRlHpa6L3yVhDOBrUXH+BPAO1+KFMQQNSThKo= -cloud.google.com/go/dataform v0.4.0/go.mod h1:fwV6Y4Ty2yIFL89huYlEkwUPtS7YZinZbzzj5S9FzCE= -cloud.google.com/go/dataform v0.5.0/go.mod h1:GFUYRe8IBa2hcomWplodVmUx/iTL0FrsauObOM3Ipr0= -cloud.google.com/go/dataform v0.6.0/go.mod h1:QPflImQy33e29VuapFdf19oPbE4aYTJxr31OAPV+ulA= -cloud.google.com/go/dataform v0.7.0/go.mod h1:7NulqnVozfHvWUBpMDfKMUESr+85aJsC/2O0o3jWPDE= -cloud.google.com/go/datafusion v1.4.0/go.mod h1:1Zb6VN+W6ALo85cXnM1IKiPw+yQMKMhB9TsTSRDo/38= -cloud.google.com/go/datafusion v1.5.0/go.mod h1:Kz+l1FGHB0J+4XF2fud96WMmRiq/wj8N9u007vyXZ2w= -cloud.google.com/go/datafusion v1.6.0/go.mod h1:WBsMF8F1RhSXvVM8rCV3AeyWVxcC2xY6vith3iw3S+8= -cloud.google.com/go/datalabeling v0.5.0/go.mod h1:TGcJ0G2NzcsXSE/97yWjIZO0bXj0KbVlINXMG9ud42I= -cloud.google.com/go/datalabeling v0.6.0/go.mod h1:WqdISuk/+WIGeMkpw/1q7bK/tFEZxsrFJOJdY2bXvTQ= -cloud.google.com/go/datalabeling v0.7.0/go.mod h1:WPQb1y08RJbmpM3ww0CSUAGweL0SxByuW2E+FU+wXcM= -cloud.google.com/go/dataplex v1.3.0/go.mod h1:hQuRtDg+fCiFgC8j0zV222HvzFQdRd+SVX8gdmFcZzA= -cloud.google.com/go/dataplex v1.4.0/go.mod h1:X51GfLXEMVJ6UN47ESVqvlsRplbLhcsAt0kZCCKsU0A= -cloud.google.com/go/dataplex v1.5.2/go.mod h1:cVMgQHsmfRoI5KFYq4JtIBEUbYwc3c7tXmIDhRmNNVQ= -cloud.google.com/go/dataplex v1.6.0/go.mod h1:bMsomC/aEJOSpHXdFKFGQ1b0TDPIeL28nJObeO1ppRs= -cloud.google.com/go/dataproc v1.7.0/go.mod h1:CKAlMjII9H90RXaMpSxQ8EU6dQx6iAYNPcYPOkSbi8s= -cloud.google.com/go/dataproc v1.8.0/go.mod h1:5OW+zNAH0pMpw14JVrPONsxMQYMBqJuzORhIBfBn9uI= -cloud.google.com/go/dataproc v1.12.0/go.mod h1:zrF3aX0uV3ikkMz6z4uBbIKyhRITnxvr4i3IjKsKrw4= -cloud.google.com/go/dataqna v0.5.0/go.mod h1:90Hyk596ft3zUQ8NkFfvICSIfHFh1Bc7C4cK3vbhkeo= -cloud.google.com/go/dataqna v0.6.0/go.mod h1:1lqNpM7rqNLVgWBJyk5NF6Uen2PHym0jtVJonplVsDA= -cloud.google.com/go/dataqna v0.7.0/go.mod h1:Lx9OcIIeqCrw1a6KdO3/5KMP1wAmTc0slZWwP12Qq3c= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/datastore v1.10.0/go.mod h1:PC5UzAmDEkAmkfaknstTYbNpgE49HAgW2J1gcgUfmdM= -cloud.google.com/go/datastore v1.11.0/go.mod h1:TvGxBIHCS50u8jzG+AW/ppf87v1of8nwzFNgEZU1D3c= -cloud.google.com/go/datastream v1.2.0/go.mod h1:i/uTP8/fZwgATHS/XFu0TcNUhuA0twZxxQ3EyCUQMwo= -cloud.google.com/go/datastream v1.3.0/go.mod h1:cqlOX8xlyYF/uxhiKn6Hbv6WjwPPuI9W2M9SAXwaLLQ= -cloud.google.com/go/datastream v1.4.0/go.mod h1:h9dpzScPhDTs5noEMQVWP8Wx8AFBRyS0s8KWPx/9r0g= -cloud.google.com/go/datastream v1.5.0/go.mod h1:6TZMMNPwjUqZHBKPQ1wwXpb0d5VDVPl2/XoS5yi88q4= -cloud.google.com/go/datastream v1.6.0/go.mod h1:6LQSuswqLa7S4rPAOZFVjHIG3wJIjZcZrw8JDEDJuIs= -cloud.google.com/go/datastream v1.7.0/go.mod h1:uxVRMm2elUSPuh65IbZpzJNMbuzkcvu5CjMqVIUHrww= -cloud.google.com/go/deploy v1.4.0/go.mod h1:5Xghikd4VrmMLNaF6FiRFDlHb59VM59YoDQnOUdsH/c= -cloud.google.com/go/deploy v1.5.0/go.mod h1:ffgdD0B89tToyW/U/D2eL0jN2+IEV/3EMuXHA0l4r+s= -cloud.google.com/go/deploy v1.6.0/go.mod h1:f9PTHehG/DjCom3QH0cntOVRm93uGBDt2vKzAPwpXQI= -cloud.google.com/go/deploy v1.8.0/go.mod h1:z3myEJnA/2wnB4sgjqdMfgxCA0EqC3RBTNcVPs93mtQ= -cloud.google.com/go/dialogflow v1.15.0/go.mod h1:HbHDWs33WOGJgn6rfzBW1Kv807BE3O1+xGbn59zZWI4= -cloud.google.com/go/dialogflow v1.16.1/go.mod h1:po6LlzGfK+smoSmTBnbkIZY2w8ffjz/RcGSS+sh1el0= -cloud.google.com/go/dialogflow v1.17.0/go.mod h1:YNP09C/kXA1aZdBgC/VtXX74G/TKn7XVCcVumTflA+8= -cloud.google.com/go/dialogflow v1.18.0/go.mod h1:trO7Zu5YdyEuR+BhSNOqJezyFQ3aUzz0njv7sMx/iek= -cloud.google.com/go/dialogflow v1.19.0/go.mod h1:JVmlG1TwykZDtxtTXujec4tQ+D8SBFMoosgy+6Gn0s0= -cloud.google.com/go/dialogflow v1.29.0/go.mod h1:b+2bzMe+k1s9V+F2jbJwpHPzrnIyHihAdRFMtn2WXuM= -cloud.google.com/go/dialogflow v1.31.0/go.mod h1:cuoUccuL1Z+HADhyIA7dci3N5zUssgpBJmCzI6fNRB4= -cloud.google.com/go/dialogflow v1.32.0/go.mod h1:jG9TRJl8CKrDhMEcvfcfFkkpp8ZhgPz3sBGmAUYJ2qE= -cloud.google.com/go/dlp v1.6.0/go.mod h1:9eyB2xIhpU0sVwUixfBubDoRwP+GjeUoxxeueZmqvmM= -cloud.google.com/go/dlp v1.7.0/go.mod h1:68ak9vCiMBjbasxeVD17hVPxDEck+ExiHavX8kiHG+Q= -cloud.google.com/go/dlp v1.9.0/go.mod h1:qdgmqgTyReTz5/YNSSuueR8pl7hO0o9bQ39ZhtgkWp4= -cloud.google.com/go/documentai v1.7.0/go.mod h1:lJvftZB5NRiFSX4moiye1SMxHx0Bc3x1+p9e/RfXYiU= -cloud.google.com/go/documentai v1.8.0/go.mod h1:xGHNEB7CtsnySCNrCFdCyyMz44RhFEEX2Q7UD0c5IhU= -cloud.google.com/go/documentai v1.9.0/go.mod h1:FS5485S8R00U10GhgBC0aNGrJxBP8ZVpEeJ7PQDZd6k= -cloud.google.com/go/documentai v1.10.0/go.mod h1:vod47hKQIPeCfN2QS/jULIvQTugbmdc0ZvxxfQY1bg4= -cloud.google.com/go/documentai v1.16.0/go.mod h1:o0o0DLTEZ+YnJZ+J4wNfTxmDVyrkzFvttBXXtYRMHkM= -cloud.google.com/go/documentai v1.18.0/go.mod h1:F6CK6iUH8J81FehpskRmhLq/3VlwQvb7TvwOceQ2tbs= -cloud.google.com/go/domains v0.6.0/go.mod h1:T9Rz3GasrpYk6mEGHh4rymIhjlnIuB4ofT1wTxDeT4Y= -cloud.google.com/go/domains v0.7.0/go.mod h1:PtZeqS1xjnXuRPKE/88Iru/LdfoRyEHYA9nFQf4UKpg= -cloud.google.com/go/domains v0.8.0/go.mod h1:M9i3MMDzGFXsydri9/vW+EWz9sWb4I6WyHqdlAk0idE= -cloud.google.com/go/edgecontainer v0.1.0/go.mod h1:WgkZ9tp10bFxqO8BLPqv2LlfmQF1X8lZqwW4r1BTajk= -cloud.google.com/go/edgecontainer v0.2.0/go.mod h1:RTmLijy+lGpQ7BXuTDa4C4ssxyXT34NIuHIgKuP4s5w= -cloud.google.com/go/edgecontainer v0.3.0/go.mod h1:FLDpP4nykgwwIfcLt6zInhprzw0lEi2P1fjO6Ie0qbc= -cloud.google.com/go/edgecontainer v1.0.0/go.mod h1:cttArqZpBB2q58W/upSG++ooo6EsblxDIolxa3jSjbY= -cloud.google.com/go/errorreporting v0.3.0/go.mod h1:xsP2yaAp+OAW4OIm60An2bbLpqIhKXdWR/tawvl7QzU= -cloud.google.com/go/essentialcontacts v1.3.0/go.mod h1:r+OnHa5jfj90qIfZDO/VztSFqbQan7HV75p8sA+mdGI= -cloud.google.com/go/essentialcontacts v1.4.0/go.mod h1:8tRldvHYsmnBCHdFpvU+GL75oWiBKl80BiqlFh9tp+8= -cloud.google.com/go/essentialcontacts v1.5.0/go.mod h1:ay29Z4zODTuwliK7SnX8E86aUF2CTzdNtvv42niCX0M= -cloud.google.com/go/eventarc v1.7.0/go.mod h1:6ctpF3zTnaQCxUjHUdcfgcA1A2T309+omHZth7gDfmc= -cloud.google.com/go/eventarc v1.8.0/go.mod h1:imbzxkyAU4ubfsaKYdQg04WS1NvncblHEup4kvF+4gw= -cloud.google.com/go/eventarc v1.10.0/go.mod h1:u3R35tmZ9HvswGRBnF48IlYgYeBcPUCjkr4BTdem2Kw= -cloud.google.com/go/eventarc v1.11.0/go.mod h1:PyUjsUKPWoRBCHeOxZd/lbOOjahV41icXyUY5kSTvVY= -cloud.google.com/go/filestore v1.3.0/go.mod h1:+qbvHGvXU1HaKX2nD0WEPo92TP/8AQuCVEBXNY9z0+w= -cloud.google.com/go/filestore v1.4.0/go.mod h1:PaG5oDfo9r224f8OYXURtAsY+Fbyq/bLYoINEK8XQAI= -cloud.google.com/go/filestore v1.5.0/go.mod h1:FqBXDWBp4YLHqRnVGveOkHDf8svj9r5+mUDLupOWEDs= -cloud.google.com/go/filestore v1.6.0/go.mod h1:di5unNuss/qfZTw2U9nhFqo8/ZDSc466dre85Kydllg= -cloud.google.com/go/firestore v1.9.0/go.mod h1:HMkjKHNTtRyZNiMzu7YAsLr9K3X2udY2AMwDaMEQiiE= -cloud.google.com/go/functions v1.6.0/go.mod h1:3H1UA3qiIPRWD7PeZKLvHZ9SaQhR26XIJcC0A5GbvAk= -cloud.google.com/go/functions v1.7.0/go.mod h1:+d+QBcWM+RsrgZfV9xo6KfA1GlzJfxcfZcRPEhDDfzg= -cloud.google.com/go/functions v1.8.0/go.mod h1:RTZ4/HsQjIqIYP9a9YPbU+QFoQsAlYgrwOXJWHn1POY= -cloud.google.com/go/functions v1.9.0/go.mod h1:Y+Dz8yGguzO3PpIjhLTbnqV1CWmgQ5UwtlpzoyquQ08= -cloud.google.com/go/functions v1.10.0/go.mod h1:0D3hEOe3DbEvCXtYOZHQZmD+SzYsi1YbI7dGvHfldXw= -cloud.google.com/go/functions v1.12.0/go.mod h1:AXWGrF3e2C/5ehvwYo/GH6O5s09tOPksiKhz+hH8WkA= -cloud.google.com/go/functions v1.13.0/go.mod h1:EU4O007sQm6Ef/PwRsI8N2umygGqPBS/IZQKBQBcJ3c= -cloud.google.com/go/gaming v1.5.0/go.mod h1:ol7rGcxP/qHTRQE/RO4bxkXq+Fix0j6D4LFPzYTIrDM= -cloud.google.com/go/gaming v1.6.0/go.mod h1:YMU1GEvA39Qt3zWGyAVA9bpYz/yAhTvaQ1t2sK4KPUA= -cloud.google.com/go/gaming v1.7.0/go.mod h1:LrB8U7MHdGgFG851iHAfqUdLcKBdQ55hzXy9xBJz0+w= -cloud.google.com/go/gaming v1.8.0/go.mod h1:xAqjS8b7jAVW0KFYeRUxngo9My3f33kFmua++Pi+ggM= -cloud.google.com/go/gaming v1.9.0/go.mod h1:Fc7kEmCObylSWLO334NcO+O9QMDyz+TKC4v1D7X+Bc0= -cloud.google.com/go/gkebackup v0.2.0/go.mod h1:XKvv/4LfG829/B8B7xRkk8zRrOEbKtEam6yNfuQNH60= -cloud.google.com/go/gkebackup v0.3.0/go.mod h1:n/E671i1aOQvUxT541aTkCwExO/bTer2HDlj4TsBRAo= -cloud.google.com/go/gkebackup v0.4.0/go.mod h1:byAyBGUwYGEEww7xsbnUTBHIYcOPy/PgUWUtOeRm9Vg= -cloud.google.com/go/gkeconnect v0.5.0/go.mod h1:c5lsNAg5EwAy7fkqX/+goqFsU1Da/jQFqArp+wGNr/o= -cloud.google.com/go/gkeconnect v0.6.0/go.mod h1:Mln67KyU/sHJEBY8kFZ0xTeyPtzbq9StAVvEULYK16A= -cloud.google.com/go/gkeconnect v0.7.0/go.mod h1:SNfmVqPkaEi3bF/B3CNZOAYPYdg7sU+obZ+QTky2Myw= -cloud.google.com/go/gkehub v0.9.0/go.mod h1:WYHN6WG8w9bXU0hqNxt8rm5uxnk8IH+lPY9J2TV7BK0= -cloud.google.com/go/gkehub v0.10.0/go.mod h1:UIPwxI0DsrpsVoWpLB0stwKCP+WFVG9+y977wO+hBH0= -cloud.google.com/go/gkehub v0.11.0/go.mod h1:JOWHlmN+GHyIbuWQPl47/C2RFhnFKH38jH9Ascu3n0E= -cloud.google.com/go/gkehub v0.12.0/go.mod h1:djiIwwzTTBrF5NaXCGv3mf7klpEMcST17VBTVVDcuaw= -cloud.google.com/go/gkemulticloud v0.3.0/go.mod h1:7orzy7O0S+5kq95e4Hpn7RysVA7dPs8W/GgfUtsPbrA= -cloud.google.com/go/gkemulticloud v0.4.0/go.mod h1:E9gxVBnseLWCk24ch+P9+B2CoDFJZTyIgLKSalC7tuI= -cloud.google.com/go/gkemulticloud v0.5.0/go.mod h1:W0JDkiyi3Tqh0TJr//y19wyb1yf8llHVto2Htf2Ja3Y= -cloud.google.com/go/grafeas v0.2.0/go.mod h1:KhxgtF2hb0P191HlY5besjYm6MqTSTj3LSI+M+ByZHc= -cloud.google.com/go/gsuiteaddons v1.3.0/go.mod h1:EUNK/J1lZEZO8yPtykKxLXI6JSVN2rg9bN8SXOa0bgM= -cloud.google.com/go/gsuiteaddons v1.4.0/go.mod h1:rZK5I8hht7u7HxFQcFei0+AtfS9uSushomRlg+3ua1o= -cloud.google.com/go/gsuiteaddons v1.5.0/go.mod h1:TFCClYLd64Eaa12sFVmUyG62tk4mdIsI7pAnSXRkcFo= -cloud.google.com/go/iam v0.1.0/go.mod h1:vcUNEa0pEm0qRVpmWepWaFMIAI8/hjB9mO8rNCJtF6c= -cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY= -cloud.google.com/go/iam v0.5.0/go.mod h1:wPU9Vt0P4UmCux7mqtRu6jcpPAb74cP1fh50J3QpkUc= -cloud.google.com/go/iam v0.6.0/go.mod h1:+1AH33ueBne5MzYccyMHtEKqLE4/kJOibtffMHDMFMc= -cloud.google.com/go/iam v0.7.0/go.mod h1:H5Br8wRaDGNc8XP3keLc4unfUUZeyH3Sfl9XpQEYOeg= -cloud.google.com/go/iam v0.8.0/go.mod h1:lga0/y3iH6CX7sYqypWJ33hf7kkfXJag67naqGESjkE= -cloud.google.com/go/iam v0.11.0/go.mod h1:9PiLDanza5D+oWFZiH1uG+RnRCfEGKoyl6yo4cgWZGY= -cloud.google.com/go/iam v0.12.0/go.mod h1:knyHGviacl11zrtZUoDuYpDgLjvr28sLQaG0YB2GYAY= -cloud.google.com/go/iam v0.13.0/go.mod h1:ljOg+rcNfzZ5d6f1nAUJ8ZIxOaZUVoS14bKCtaLZ/D0= -cloud.google.com/go/iap v1.4.0/go.mod h1:RGFwRJdihTINIe4wZ2iCP0zF/qu18ZwyKxrhMhygBEc= -cloud.google.com/go/iap v1.5.0/go.mod h1:UH/CGgKd4KyohZL5Pt0jSKE4m3FR51qg6FKQ/z/Ix9A= -cloud.google.com/go/iap v1.6.0/go.mod h1:NSuvI9C/j7UdjGjIde7t7HBz+QTwBcapPE07+sSRcLk= -cloud.google.com/go/iap v1.7.0/go.mod h1:beqQx56T9O1G1yNPph+spKpNibDlYIiIixiqsQXxLIo= -cloud.google.com/go/iap v1.7.1/go.mod h1:WapEwPc7ZxGt2jFGB/C/bm+hP0Y6NXzOYGjpPnmMS74= -cloud.google.com/go/ids v1.1.0/go.mod h1:WIuwCaYVOzHIj2OhN9HAwvW+DBdmUAdcWlFxRl+KubM= -cloud.google.com/go/ids v1.2.0/go.mod h1:5WXvp4n25S0rA/mQWAg1YEEBBq6/s+7ml1RDCW1IrcY= -cloud.google.com/go/ids v1.3.0/go.mod h1:JBdTYwANikFKaDP6LtW5JAi4gubs57SVNQjemdt6xV4= -cloud.google.com/go/iot v1.3.0/go.mod h1:r7RGh2B61+B8oz0AGE+J72AhA0G7tdXItODWsaA2oLs= -cloud.google.com/go/iot v1.4.0/go.mod h1:dIDxPOn0UvNDUMD8Ger7FIaTuvMkj+aGk94RPP0iV+g= -cloud.google.com/go/iot v1.5.0/go.mod h1:mpz5259PDl3XJthEmh9+ap0affn/MqNSP4My77Qql9o= -cloud.google.com/go/iot v1.6.0/go.mod h1:IqdAsmE2cTYYNO1Fvjfzo9po179rAtJeVGUvkLN3rLE= -cloud.google.com/go/kms v1.4.0/go.mod h1:fajBHndQ+6ubNw6Ss2sSd+SWvjL26RNo/dr7uxsnnOA= -cloud.google.com/go/kms v1.5.0/go.mod h1:QJS2YY0eJGBg3mnDfuaCyLauWwBJiHRboYxJ++1xJNg= -cloud.google.com/go/kms v1.6.0/go.mod h1:Jjy850yySiasBUDi6KFUwUv2n1+o7QZFyuUJg6OgjA0= -cloud.google.com/go/kms v1.8.0/go.mod h1:4xFEhYFqvW+4VMELtZyxomGSYtSQKzM178ylFW4jMAg= -cloud.google.com/go/kms v1.9.0/go.mod h1:qb1tPTgfF9RQP8e1wq4cLFErVuTJv7UsSC915J8dh3w= -cloud.google.com/go/kms v1.10.0/go.mod h1:ng3KTUtQQU9bPX3+QGLsflZIHlkbn8amFAMY63m8d24= -cloud.google.com/go/kms v1.10.1/go.mod h1:rIWk/TryCkR59GMC3YtHtXeLzd634lBbKenvyySAyYI= -cloud.google.com/go/language v1.4.0/go.mod h1:F9dRpNFQmJbkaop6g0JhSBXCNlO90e1KWx5iDdxbWic= -cloud.google.com/go/language v1.6.0/go.mod h1:6dJ8t3B+lUYfStgls25GusK04NLh3eDLQnWM3mdEbhI= -cloud.google.com/go/language v1.7.0/go.mod h1:DJ6dYN/W+SQOjF8e1hLQXMF21AkH2w9wiPzPCJa2MIE= -cloud.google.com/go/language v1.8.0/go.mod h1:qYPVHf7SPoNNiCL2Dr0FfEFNil1qi3pQEyygwpgVKB8= -cloud.google.com/go/language v1.9.0/go.mod h1:Ns15WooPM5Ad/5no/0n81yUetis74g3zrbeJBE+ptUY= -cloud.google.com/go/lifesciences v0.5.0/go.mod h1:3oIKy8ycWGPUyZDR/8RNnTOYevhaMLqh5vLUXs9zvT8= -cloud.google.com/go/lifesciences v0.6.0/go.mod h1:ddj6tSX/7BOnhxCSd3ZcETvtNr8NZ6t/iPhY2Tyfu08= -cloud.google.com/go/lifesciences v0.8.0/go.mod h1:lFxiEOMqII6XggGbOnKiyZ7IBwoIqA84ClvoezaA/bo= -cloud.google.com/go/logging v1.6.1/go.mod h1:5ZO0mHHbvm8gEmeEUHrmDlTDSu5imF6MUP9OfilNXBw= -cloud.google.com/go/logging v1.7.0/go.mod h1:3xjP2CjkM3ZkO73aj4ASA5wRPGGCRrPIAeNqVNkzY8M= -cloud.google.com/go/longrunning v0.1.1/go.mod h1:UUFxuDWkv22EuY93jjmDMFT5GPQKeFVJBIF6QlTqdsE= -cloud.google.com/go/longrunning v0.3.0/go.mod h1:qth9Y41RRSUE69rDcOn6DdK3HfQfsUI0YSmW3iIlLJc= -cloud.google.com/go/longrunning v0.4.1/go.mod h1:4iWDqhBZ70CvZ6BfETbvam3T8FMvLK+eFj0E6AaRQTo= -cloud.google.com/go/managedidentities v1.3.0/go.mod h1:UzlW3cBOiPrzucO5qWkNkh0w33KFtBJU281hacNvsdE= -cloud.google.com/go/managedidentities v1.4.0/go.mod h1:NWSBYbEMgqmbZsLIyKvxrYbtqOsxY1ZrGM+9RgDqInM= -cloud.google.com/go/managedidentities v1.5.0/go.mod h1:+dWcZ0JlUmpuxpIDfyP5pP5y0bLdRwOS4Lp7gMni/LA= -cloud.google.com/go/maps v0.1.0/go.mod h1:BQM97WGyfw9FWEmQMpZ5T6cpovXXSd1cGmFma94eubI= -cloud.google.com/go/maps v0.6.0/go.mod h1:o6DAMMfb+aINHz/p/jbcY+mYeXBoZoxTfdSQ8VAJaCw= -cloud.google.com/go/maps v0.7.0/go.mod h1:3GnvVl3cqeSvgMcpRlQidXsPYuDGQ8naBis7MVzpXsY= -cloud.google.com/go/mediatranslation v0.5.0/go.mod h1:jGPUhGTybqsPQn91pNXw0xVHfuJ3leR1wj37oU3y1f4= -cloud.google.com/go/mediatranslation v0.6.0/go.mod h1:hHdBCTYNigsBxshbznuIMFNe5QXEowAuNmmC7h8pu5w= -cloud.google.com/go/mediatranslation v0.7.0/go.mod h1:LCnB/gZr90ONOIQLgSXagp8XUW1ODs2UmUMvcgMfI2I= -cloud.google.com/go/memcache v1.4.0/go.mod h1:rTOfiGZtJX1AaFUrOgsMHX5kAzaTQ8azHiuDoTPzNsE= -cloud.google.com/go/memcache v1.5.0/go.mod h1:dk3fCK7dVo0cUU2c36jKb4VqKPS22BTkf81Xq617aWM= -cloud.google.com/go/memcache v1.6.0/go.mod h1:XS5xB0eQZdHtTuTF9Hf8eJkKtR3pVRCcvJwtm68T3rA= -cloud.google.com/go/memcache v1.7.0/go.mod h1:ywMKfjWhNtkQTxrWxCkCFkoPjLHPW6A7WOTVI8xy3LY= -cloud.google.com/go/memcache v1.9.0/go.mod h1:8oEyzXCu+zo9RzlEaEjHl4KkgjlNDaXbCQeQWlzNFJM= -cloud.google.com/go/metastore v1.5.0/go.mod h1:2ZNrDcQwghfdtCwJ33nM0+GrBGlVuh8rakL3vdPY3XY= -cloud.google.com/go/metastore v1.6.0/go.mod h1:6cyQTls8CWXzk45G55x57DVQ9gWg7RiH65+YgPsNh9s= -cloud.google.com/go/metastore v1.7.0/go.mod h1:s45D0B4IlsINu87/AsWiEVYbLaIMeUSoxlKKDqBGFS8= -cloud.google.com/go/metastore v1.8.0/go.mod h1:zHiMc4ZUpBiM7twCIFQmJ9JMEkDSyZS9U12uf7wHqSI= -cloud.google.com/go/metastore v1.10.0/go.mod h1:fPEnH3g4JJAk+gMRnrAnoqyv2lpUCqJPWOodSaf45Eo= -cloud.google.com/go/monitoring v1.7.0/go.mod h1:HpYse6kkGo//7p6sT0wsIC6IBDET0RhIsnmlA53dvEk= -cloud.google.com/go/monitoring v1.8.0/go.mod h1:E7PtoMJ1kQXWxPjB6mv2fhC5/15jInuulFdYYtlcvT4= -cloud.google.com/go/monitoring v1.12.0/go.mod h1:yx8Jj2fZNEkL/GYZyTLS4ZtZEZN8WtDEiEqG4kLK50w= -cloud.google.com/go/monitoring v1.13.0/go.mod h1:k2yMBAB1H9JT/QETjNkgdCGD9bPF712XiLTVr+cBrpw= -cloud.google.com/go/networkconnectivity v1.4.0/go.mod h1:nOl7YL8odKyAOtzNX73/M5/mGZgqqMeryi6UPZTk/rA= -cloud.google.com/go/networkconnectivity v1.5.0/go.mod h1:3GzqJx7uhtlM3kln0+x5wyFvuVH1pIBJjhCpjzSt75o= -cloud.google.com/go/networkconnectivity v1.6.0/go.mod h1:OJOoEXW+0LAxHh89nXd64uGG+FbQoeH8DtxCHVOMlaM= -cloud.google.com/go/networkconnectivity v1.7.0/go.mod h1:RMuSbkdbPwNMQjB5HBWD5MpTBnNm39iAVpC3TmsExt8= -cloud.google.com/go/networkconnectivity v1.10.0/go.mod h1:UP4O4sWXJG13AqrTdQCD9TnLGEbtNRqjuaaA7bNjF5E= -cloud.google.com/go/networkconnectivity v1.11.0/go.mod h1:iWmDD4QF16VCDLXUqvyspJjIEtBR/4zq5hwnY2X3scM= -cloud.google.com/go/networkmanagement v1.4.0/go.mod h1:Q9mdLLRn60AsOrPc8rs8iNV6OHXaGcDdsIQe1ohekq8= -cloud.google.com/go/networkmanagement v1.5.0/go.mod h1:ZnOeZ/evzUdUsnvRt792H0uYEnHQEMaz+REhhzJRcf4= -cloud.google.com/go/networkmanagement v1.6.0/go.mod h1:5pKPqyXjB/sgtvB5xqOemumoQNB7y95Q7S+4rjSOPYY= -cloud.google.com/go/networksecurity v0.5.0/go.mod h1:xS6fOCoqpVC5zx15Z/MqkfDwH4+m/61A3ODiDV1xmiQ= -cloud.google.com/go/networksecurity v0.6.0/go.mod h1:Q5fjhTr9WMI5mbpRYEbiexTzROf7ZbDzvzCrNl14nyU= -cloud.google.com/go/networksecurity v0.7.0/go.mod h1:mAnzoxx/8TBSyXEeESMy9OOYwo1v+gZ5eMRnsT5bC8k= -cloud.google.com/go/networksecurity v0.8.0/go.mod h1:B78DkqsxFG5zRSVuwYFRZ9Xz8IcQ5iECsNrPn74hKHU= -cloud.google.com/go/notebooks v1.2.0/go.mod h1:9+wtppMfVPUeJ8fIWPOq1UnATHISkGXGqTkxeieQ6UY= -cloud.google.com/go/notebooks v1.3.0/go.mod h1:bFR5lj07DtCPC7YAAJ//vHskFBxA5JzYlH68kXVdk34= -cloud.google.com/go/notebooks v1.4.0/go.mod h1:4QPMngcwmgb6uw7Po99B2xv5ufVoIQ7nOGDyL4P8AgA= -cloud.google.com/go/notebooks v1.5.0/go.mod h1:q8mwhnP9aR8Hpfnrc5iN5IBhrXUy8S2vuYs+kBJ/gu0= -cloud.google.com/go/notebooks v1.7.0/go.mod h1:PVlaDGfJgj1fl1S3dUwhFMXFgfYGhYQt2164xOMONmE= -cloud.google.com/go/notebooks v1.8.0/go.mod h1:Lq6dYKOYOWUCTvw5t2q1gp1lAp0zxAxRycayS0iJcqQ= -cloud.google.com/go/optimization v1.1.0/go.mod h1:5po+wfvX5AQlPznyVEZjGJTMr4+CAkJf2XSTQOOl9l4= -cloud.google.com/go/optimization v1.2.0/go.mod h1:Lr7SOHdRDENsh+WXVmQhQTrzdu9ybg0NecjHidBq6xs= -cloud.google.com/go/optimization v1.3.1/go.mod h1:IvUSefKiwd1a5p0RgHDbWCIbDFgKuEdB+fPPuP0IDLI= -cloud.google.com/go/orchestration v1.3.0/go.mod h1:Sj5tq/JpWiB//X/q3Ngwdl5K7B7Y0KZ7bfv0wL6fqVA= -cloud.google.com/go/orchestration v1.4.0/go.mod h1:6W5NLFWs2TlniBphAViZEVhrXRSMgUGDfW7vrWKvsBk= -cloud.google.com/go/orchestration v1.6.0/go.mod h1:M62Bevp7pkxStDfFfTuCOaXgaaqRAga1yKyoMtEoWPQ= -cloud.google.com/go/orgpolicy v1.4.0/go.mod h1:xrSLIV4RePWmP9P3tBl8S93lTmlAxjm06NSm2UTmKvE= -cloud.google.com/go/orgpolicy v1.5.0/go.mod h1:hZEc5q3wzwXJaKrsx5+Ewg0u1LxJ51nNFlext7Tanwc= -cloud.google.com/go/orgpolicy v1.10.0/go.mod h1:w1fo8b7rRqlXlIJbVhOMPrwVljyuW5mqssvBtU18ONc= -cloud.google.com/go/osconfig v1.7.0/go.mod h1:oVHeCeZELfJP7XLxcBGTMBvRO+1nQ5tFG9VQTmYS2Fs= -cloud.google.com/go/osconfig v1.8.0/go.mod h1:EQqZLu5w5XA7eKizepumcvWx+m8mJUhEwiPqWiZeEdg= -cloud.google.com/go/osconfig v1.9.0/go.mod h1:Yx+IeIZJ3bdWmzbQU4fxNl8xsZ4amB+dygAwFPlvnNo= -cloud.google.com/go/osconfig v1.10.0/go.mod h1:uMhCzqC5I8zfD9zDEAfvgVhDS8oIjySWh+l4WK6GnWw= -cloud.google.com/go/osconfig v1.11.0/go.mod h1:aDICxrur2ogRd9zY5ytBLV89KEgT2MKB2L/n6x1ooPw= -cloud.google.com/go/oslogin v1.4.0/go.mod h1:YdgMXWRaElXz/lDk1Na6Fh5orF7gvmJ0FGLIs9LId4E= -cloud.google.com/go/oslogin v1.5.0/go.mod h1:D260Qj11W2qx/HVF29zBg+0fd6YCSjSqLUkY/qEenQU= -cloud.google.com/go/oslogin v1.6.0/go.mod h1:zOJ1O3+dTU8WPlGEkFSh7qeHPPSoxrcMbbK1Nm2iX70= -cloud.google.com/go/oslogin v1.7.0/go.mod h1:e04SN0xO1UNJ1M5GP0vzVBFicIe4O53FOfcixIqTyXo= -cloud.google.com/go/oslogin v1.9.0/go.mod h1:HNavntnH8nzrn8JCTT5fj18FuJLFJc4NaZJtBnQtKFs= -cloud.google.com/go/phishingprotection v0.5.0/go.mod h1:Y3HZknsK9bc9dMi+oE8Bim0lczMU6hrX0UpADuMefr0= -cloud.google.com/go/phishingprotection v0.6.0/go.mod h1:9Y3LBLgy0kDTcYET8ZH3bq/7qni15yVUoAxiFxnlSUA= -cloud.google.com/go/phishingprotection v0.7.0/go.mod h1:8qJI4QKHoda/sb/7/YmMQ2omRLSLYSu9bU0EKCNI+Lk= -cloud.google.com/go/policytroubleshooter v1.3.0/go.mod h1:qy0+VwANja+kKrjlQuOzmlvscn4RNsAc0e15GGqfMxg= -cloud.google.com/go/policytroubleshooter v1.4.0/go.mod h1:DZT4BcRw3QoO8ota9xw/LKtPa8lKeCByYeKTIf/vxdE= -cloud.google.com/go/policytroubleshooter v1.5.0/go.mod h1:Rz1WfV+1oIpPdN2VvvuboLVRsB1Hclg3CKQ53j9l8vw= -cloud.google.com/go/policytroubleshooter v1.6.0/go.mod h1:zYqaPTsmfvpjm5ULxAyD/lINQxJ0DDsnWOP/GZ7xzBc= -cloud.google.com/go/privatecatalog v0.5.0/go.mod h1:XgosMUvvPyxDjAVNDYxJ7wBW8//hLDDYmnsNcMGq1K0= -cloud.google.com/go/privatecatalog v0.6.0/go.mod h1:i/fbkZR0hLN29eEWiiwue8Pb+GforiEIBnV9yrRUOKI= -cloud.google.com/go/privatecatalog v0.7.0/go.mod h1:2s5ssIFO69F5csTXcwBP7NPFTZvps26xGzvQ2PQaBYg= -cloud.google.com/go/privatecatalog v0.8.0/go.mod h1:nQ6pfaegeDAq/Q5lrfCQzQLhubPiZhSaNhIgfJlnIXs= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= -cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= -cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= -cloud.google.com/go/pubsub v1.26.0/go.mod h1:QgBH3U/jdJy/ftjPhTkyXNj543Tin1pRYcdcPRnFIRI= -cloud.google.com/go/pubsub v1.27.1/go.mod h1:hQN39ymbV9geqBnfQq6Xf63yNhUAhv9CZhzp5O6qsW0= -cloud.google.com/go/pubsub v1.28.0/go.mod h1:vuXFpwaVoIPQMGXqRyUQigu/AX1S3IWugR9xznmcXX8= -cloud.google.com/go/pubsub v1.30.0/go.mod h1:qWi1OPS0B+b5L+Sg6Gmc9zD1Y+HaM0MdUr7LsupY1P4= -cloud.google.com/go/pubsublite v1.5.0/go.mod h1:xapqNQ1CuLfGi23Yda/9l4bBCKz/wC3KIJ5gKcxveZg= -cloud.google.com/go/pubsublite v1.6.0/go.mod h1:1eFCS0U11xlOuMFV/0iBqw3zP12kddMeCbj/F3FSj9k= -cloud.google.com/go/pubsublite v1.7.0/go.mod h1:8hVMwRXfDfvGm3fahVbtDbiLePT3gpoiJYJY+vxWxVM= -cloud.google.com/go/recaptchaenterprise v1.3.1/go.mod h1:OdD+q+y4XGeAlxRaMn1Y7/GveP6zmq76byL6tjPE7d4= -cloud.google.com/go/recaptchaenterprise/v2 v2.1.0/go.mod h1:w9yVqajwroDNTfGuhmOjPDN//rZGySaf6PtFVcSCa7o= -cloud.google.com/go/recaptchaenterprise/v2 v2.2.0/go.mod h1:/Zu5jisWGeERrd5HnlS3EUGb/D335f9k51B/FVil0jk= -cloud.google.com/go/recaptchaenterprise/v2 v2.3.0/go.mod h1:O9LwGCjrhGHBQET5CA7dd5NwwNQUErSgEDit1DLNTdo= -cloud.google.com/go/recaptchaenterprise/v2 v2.4.0/go.mod h1:Am3LHfOuBstrLrNCBrlI5sbwx9LBg3te2N6hGvHn2mE= -cloud.google.com/go/recaptchaenterprise/v2 v2.5.0/go.mod h1:O8LzcHXN3rz0j+LBC91jrwI3R+1ZSZEWrfL7XHgNo9U= -cloud.google.com/go/recaptchaenterprise/v2 v2.6.0/go.mod h1:RPauz9jeLtB3JVzg6nCbe12qNoaa8pXc4d/YukAmcnA= -cloud.google.com/go/recaptchaenterprise/v2 v2.7.0/go.mod h1:19wVj/fs5RtYtynAPJdDTb69oW0vNHYDBTbB4NvMD9c= -cloud.google.com/go/recommendationengine v0.5.0/go.mod h1:E5756pJcVFeVgaQv3WNpImkFP8a+RptV6dDLGPILjvg= -cloud.google.com/go/recommendationengine v0.6.0/go.mod h1:08mq2umu9oIqc7tDy8sx+MNJdLG0fUi3vaSVbztHgJ4= -cloud.google.com/go/recommendationengine v0.7.0/go.mod h1:1reUcE3GIu6MeBz/h5xZJqNLuuVjNg1lmWMPyjatzac= -cloud.google.com/go/recommender v1.5.0/go.mod h1:jdoeiBIVrJe9gQjwd759ecLJbxCDED4A6p+mqoqDvTg= -cloud.google.com/go/recommender v1.6.0/go.mod h1:+yETpm25mcoiECKh9DEScGzIRyDKpZ0cEhWGo+8bo+c= -cloud.google.com/go/recommender v1.7.0/go.mod h1:XLHs/W+T8olwlGOgfQenXBTbIseGclClff6lhFVe9Bs= -cloud.google.com/go/recommender v1.8.0/go.mod h1:PkjXrTT05BFKwxaUxQmtIlrtj0kph108r02ZZQ5FE70= -cloud.google.com/go/recommender v1.9.0/go.mod h1:PnSsnZY7q+VL1uax2JWkt/UegHssxjUVVCrX52CuEmQ= -cloud.google.com/go/redis v1.7.0/go.mod h1:V3x5Jq1jzUcg+UNsRvdmsfuFnit1cfe3Z/PGyq/lm4Y= -cloud.google.com/go/redis v1.8.0/go.mod h1:Fm2szCDavWzBk2cDKxrkmWBqoCiL1+Ctwq7EyqBCA/A= -cloud.google.com/go/redis v1.9.0/go.mod h1:HMYQuajvb2D0LvMgZmLDZW8V5aOC/WxstZHiy4g8OiA= -cloud.google.com/go/redis v1.10.0/go.mod h1:ThJf3mMBQtW18JzGgh41/Wld6vnDDc/F/F35UolRZPM= -cloud.google.com/go/redis v1.11.0/go.mod h1:/X6eicana+BWcUda5PpwZC48o37SiFVTFSs0fWAJ7uQ= -cloud.google.com/go/resourcemanager v1.3.0/go.mod h1:bAtrTjZQFJkiWTPDb1WBjzvc6/kifjj4QBYuKCCoqKA= -cloud.google.com/go/resourcemanager v1.4.0/go.mod h1:MwxuzkumyTX7/a3n37gmsT3py7LIXwrShilPh3P1tR0= -cloud.google.com/go/resourcemanager v1.5.0/go.mod h1:eQoXNAiAvCf5PXxWxXjhKQoTMaUSNrEfg+6qdf/wots= -cloud.google.com/go/resourcemanager v1.6.0/go.mod h1:YcpXGRs8fDzcUl1Xw8uOVmI8JEadvhRIkoXXUNVYcVo= -cloud.google.com/go/resourcemanager v1.7.0/go.mod h1:HlD3m6+bwhzj9XCouqmeiGuni95NTrExfhoSrkC/3EI= -cloud.google.com/go/resourcesettings v1.3.0/go.mod h1:lzew8VfESA5DQ8gdlHwMrqZs1S9V87v3oCnKCWoOuQU= -cloud.google.com/go/resourcesettings v1.4.0/go.mod h1:ldiH9IJpcrlC3VSuCGvjR5of/ezRrOxFtpJoJo5SmXg= -cloud.google.com/go/resourcesettings v1.5.0/go.mod h1:+xJF7QSG6undsQDfsCJyqWXyBwUoJLhetkRMDRnIoXA= -cloud.google.com/go/retail v1.8.0/go.mod h1:QblKS8waDmNUhghY2TI9O3JLlFk8jybHeV4BF19FrE4= -cloud.google.com/go/retail v1.9.0/go.mod h1:g6jb6mKuCS1QKnH/dpu7isX253absFl6iE92nHwlBUY= -cloud.google.com/go/retail v1.10.0/go.mod h1:2gDk9HsL4HMS4oZwz6daui2/jmKvqShXKQuB2RZ+cCc= -cloud.google.com/go/retail v1.11.0/go.mod h1:MBLk1NaWPmh6iVFSz9MeKG/Psyd7TAgm6y/9L2B4x9Y= -cloud.google.com/go/retail v1.12.0/go.mod h1:UMkelN/0Z8XvKymXFbD4EhFJlYKRx1FGhQkVPU5kF14= -cloud.google.com/go/run v0.2.0/go.mod h1:CNtKsTA1sDcnqqIFR3Pb5Tq0usWxJJvsWOCPldRU3Do= -cloud.google.com/go/run v0.3.0/go.mod h1:TuyY1+taHxTjrD0ZFk2iAR+xyOXEA0ztb7U3UNA0zBo= -cloud.google.com/go/run v0.8.0/go.mod h1:VniEnuBwqjigv0A7ONfQUaEItaiCRVujlMqerPPiktM= -cloud.google.com/go/run v0.9.0/go.mod h1:Wwu+/vvg8Y+JUApMwEDfVfhetv30hCG4ZwDR/IXl2Qg= -cloud.google.com/go/scheduler v1.4.0/go.mod h1:drcJBmxF3aqZJRhmkHQ9b3uSSpQoltBPGPxGAWROx6s= -cloud.google.com/go/scheduler v1.5.0/go.mod h1:ri073ym49NW3AfT6DZi21vLZrG07GXr5p3H1KxN5QlI= -cloud.google.com/go/scheduler v1.6.0/go.mod h1:SgeKVM7MIwPn3BqtcBntpLyrIJftQISRrYB5ZtT+KOk= -cloud.google.com/go/scheduler v1.7.0/go.mod h1:jyCiBqWW956uBjjPMMuX09n3x37mtyPJegEWKxRsn44= -cloud.google.com/go/scheduler v1.8.0/go.mod h1:TCET+Y5Gp1YgHT8py4nlg2Sew8nUHMqcpousDgXJVQc= -cloud.google.com/go/scheduler v1.9.0/go.mod h1:yexg5t+KSmqu+njTIh3b7oYPheFtBWGcbVUYF1GGMIc= -cloud.google.com/go/secretmanager v1.6.0/go.mod h1:awVa/OXF6IiyaU1wQ34inzQNc4ISIDIrId8qE5QGgKA= -cloud.google.com/go/secretmanager v1.8.0/go.mod h1:hnVgi/bN5MYHd3Gt0SPuTPPp5ENina1/LxM+2W9U9J4= -cloud.google.com/go/secretmanager v1.9.0/go.mod h1:b71qH2l1yHmWQHt9LC80akm86mX8AL6X1MA01dW8ht4= -cloud.google.com/go/secretmanager v1.10.0/go.mod h1:MfnrdvKMPNra9aZtQFvBcvRU54hbPD8/HayQdlUgJpU= -cloud.google.com/go/security v1.5.0/go.mod h1:lgxGdyOKKjHL4YG3/YwIL2zLqMFCKs0UbQwgyZmfJl4= -cloud.google.com/go/security v1.7.0/go.mod h1:mZklORHl6Bg7CNnnjLH//0UlAlaXqiG7Lb9PsPXLfD0= -cloud.google.com/go/security v1.8.0/go.mod h1:hAQOwgmaHhztFhiQ41CjDODdWP0+AE1B3sX4OFlq+GU= -cloud.google.com/go/security v1.9.0/go.mod h1:6Ta1bO8LXI89nZnmnsZGp9lVoVWXqsVbIq/t9dzI+2Q= -cloud.google.com/go/security v1.10.0/go.mod h1:QtOMZByJVlibUT2h9afNDWRZ1G96gVywH8T5GUSb9IA= -cloud.google.com/go/security v1.12.0/go.mod h1:rV6EhrpbNHrrxqlvW0BWAIawFWq3X90SduMJdFwtLB8= -cloud.google.com/go/security v1.13.0/go.mod h1:Q1Nvxl1PAgmeW0y3HTt54JYIvUdtcpYKVfIB8AOMZ+0= -cloud.google.com/go/securitycenter v1.13.0/go.mod h1:cv5qNAqjY84FCN6Y9z28WlkKXyWsgLO832YiWwkCWcU= -cloud.google.com/go/securitycenter v1.14.0/go.mod h1:gZLAhtyKv85n52XYWt6RmeBdydyxfPeTrpToDPw4Auc= -cloud.google.com/go/securitycenter v1.15.0/go.mod h1:PeKJ0t8MoFmmXLXWm41JidyzI3PJjd8sXWaVqg43WWk= -cloud.google.com/go/securitycenter v1.16.0/go.mod h1:Q9GMaLQFUD+5ZTabrbujNWLtSLZIZF7SAR0wWECrjdk= -cloud.google.com/go/securitycenter v1.18.1/go.mod h1:0/25gAzCM/9OL9vVx4ChPeM/+DlfGQJDwBy/UC8AKK0= -cloud.google.com/go/securitycenter v1.19.0/go.mod h1:LVLmSg8ZkkyaNy4u7HCIshAngSQ8EcIRREP3xBnyfag= -cloud.google.com/go/servicecontrol v1.4.0/go.mod h1:o0hUSJ1TXJAmi/7fLJAedOovnujSEvjKCAFNXPQ1RaU= -cloud.google.com/go/servicecontrol v1.5.0/go.mod h1:qM0CnXHhyqKVuiZnGKrIurvVImCs8gmqWsDoqe9sU1s= -cloud.google.com/go/servicecontrol v1.10.0/go.mod h1:pQvyvSRh7YzUF2efw7H87V92mxU8FnFDawMClGCNuAA= -cloud.google.com/go/servicecontrol v1.11.0/go.mod h1:kFmTzYzTUIuZs0ycVqRHNaNhgR+UMUpw9n02l/pY+mc= -cloud.google.com/go/servicecontrol v1.11.1/go.mod h1:aSnNNlwEFBY+PWGQ2DoM0JJ/QUXqV5/ZD9DOLB7SnUk= -cloud.google.com/go/servicedirectory v1.4.0/go.mod h1:gH1MUaZCgtP7qQiI+F+A+OpeKF/HQWgtAddhTbhL2bs= -cloud.google.com/go/servicedirectory v1.5.0/go.mod h1:QMKFL0NUySbpZJ1UZs3oFAmdvVxhhxB6eJ/Vlp73dfg= -cloud.google.com/go/servicedirectory v1.6.0/go.mod h1:pUlbnWsLH9c13yGkxCmfumWEPjsRs1RlmJ4pqiNjVL4= -cloud.google.com/go/servicedirectory v1.7.0/go.mod h1:5p/U5oyvgYGYejufvxhgwjL8UVXjkuw7q5XcG10wx1U= -cloud.google.com/go/servicedirectory v1.8.0/go.mod h1:srXodfhY1GFIPvltunswqXpVxFPpZjf8nkKQT7XcXaY= -cloud.google.com/go/servicedirectory v1.9.0/go.mod h1:29je5JjiygNYlmsGz8k6o+OZ8vd4f//bQLtvzkPPT/s= -cloud.google.com/go/servicemanagement v1.4.0/go.mod h1:d8t8MDbezI7Z2R1O/wu8oTggo3BI2GKYbdG4y/SJTco= -cloud.google.com/go/servicemanagement v1.5.0/go.mod h1:XGaCRe57kfqu4+lRxaFEAuqmjzF0r+gWHjWqKqBvKFo= -cloud.google.com/go/servicemanagement v1.6.0/go.mod h1:aWns7EeeCOtGEX4OvZUWCCJONRZeFKiptqKf1D0l/Jc= -cloud.google.com/go/servicemanagement v1.8.0/go.mod h1:MSS2TDlIEQD/fzsSGfCdJItQveu9NXnUniTrq/L8LK4= -cloud.google.com/go/serviceusage v1.3.0/go.mod h1:Hya1cozXM4SeSKTAgGXgj97GlqUvF5JaoXacR1JTP/E= -cloud.google.com/go/serviceusage v1.4.0/go.mod h1:SB4yxXSaYVuUBYUml6qklyONXNLt83U0Rb+CXyhjEeU= -cloud.google.com/go/serviceusage v1.5.0/go.mod h1:w8U1JvqUqwJNPEOTQjrMHkw3IaIFLoLsPLvsE3xueec= -cloud.google.com/go/serviceusage v1.6.0/go.mod h1:R5wwQcbOWsyuOfbP9tGdAnCAc6B9DRwPG1xtWMDeuPA= -cloud.google.com/go/shell v1.3.0/go.mod h1:VZ9HmRjZBsjLGXusm7K5Q5lzzByZmJHf1d0IWHEN5X4= -cloud.google.com/go/shell v1.4.0/go.mod h1:HDxPzZf3GkDdhExzD/gs8Grqk+dmYcEjGShZgYa9URw= -cloud.google.com/go/shell v1.6.0/go.mod h1:oHO8QACS90luWgxP3N9iZVuEiSF84zNyLytb+qE2f9A= -cloud.google.com/go/spanner v1.41.0/go.mod h1:MLYDBJR/dY4Wt7ZaMIQ7rXOTLjYrmxLE/5ve9vFfWos= -cloud.google.com/go/spanner v1.44.0/go.mod h1:G8XIgYdOK+Fbcpbs7p2fiprDw4CaZX63whnSMLVBxjk= -cloud.google.com/go/spanner v1.45.0/go.mod h1:FIws5LowYz8YAE1J8fOS7DJup8ff7xJeetWEo5REA2M= -cloud.google.com/go/speech v1.6.0/go.mod h1:79tcr4FHCimOp56lwC01xnt/WPJZc4v3gzyT7FoBkCM= -cloud.google.com/go/speech v1.7.0/go.mod h1:KptqL+BAQIhMsj1kOP2la5DSEEerPDuOP/2mmkhHhZQ= -cloud.google.com/go/speech v1.8.0/go.mod h1:9bYIl1/tjsAnMgKGHKmBZzXKEkGgtU+MpdDPTE9f7y0= -cloud.google.com/go/speech v1.9.0/go.mod h1:xQ0jTcmnRFFM2RfX/U+rk6FQNUF6DQlydUSyoooSpco= -cloud.google.com/go/speech v1.14.1/go.mod h1:gEosVRPJ9waG7zqqnsHpYTOoAS4KouMRLDFMekpJ0J0= -cloud.google.com/go/speech v1.15.0/go.mod h1:y6oH7GhqCaZANH7+Oe0BhgIogsNInLlz542tg3VqeYI= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= -cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= -cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= -cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq6kuBTW58Y= -cloud.google.com/go/storage v1.23.0/go.mod h1:vOEEDNFnciUMhBeT6hsJIn3ieU5cFRmzeLgDvXzfIXc= -cloud.google.com/go/storage v1.27.0/go.mod h1:x9DOL8TK/ygDUMieqwfhdpQryTeEkhGKMi80i/iqR2s= -cloud.google.com/go/storage v1.28.1/go.mod h1:Qnisd4CqDdo6BGs2AD5LLnEsmSQ80wQ5ogcBBKhU86Y= -cloud.google.com/go/storage v1.29.0/go.mod h1:4puEjyTKnku6gfKoTfNOU/W+a9JyuVNxjpS5GBrB8h4= -cloud.google.com/go/storagetransfer v1.5.0/go.mod h1:dxNzUopWy7RQevYFHewchb29POFv3/AaBgnhqzqiK0w= -cloud.google.com/go/storagetransfer v1.6.0/go.mod h1:y77xm4CQV/ZhFZH75PLEXY0ROiS7Gh6pSKrM8dJyg6I= -cloud.google.com/go/storagetransfer v1.7.0/go.mod h1:8Giuj1QNb1kfLAiWM1bN6dHzfdlDAVC9rv9abHot2W4= -cloud.google.com/go/storagetransfer v1.8.0/go.mod h1:JpegsHHU1eXg7lMHkvf+KE5XDJ7EQu0GwNJbbVGanEw= -cloud.google.com/go/talent v1.1.0/go.mod h1:Vl4pt9jiHKvOgF9KoZo6Kob9oV4lwd/ZD5Cto54zDRw= -cloud.google.com/go/talent v1.2.0/go.mod h1:MoNF9bhFQbiJ6eFD3uSsg0uBALw4n4gaCaEjBw9zo8g= -cloud.google.com/go/talent v1.3.0/go.mod h1:CmcxwJ/PKfRgd1pBjQgU6W3YBwiewmUzQYH5HHmSCmM= -cloud.google.com/go/talent v1.4.0/go.mod h1:ezFtAgVuRf8jRsvyE6EwmbTK5LKciD4KVnHuDEFmOOA= -cloud.google.com/go/talent v1.5.0/go.mod h1:G+ODMj9bsasAEJkQSzO2uHQWXHHXUomArjWQQYkqK6c= -cloud.google.com/go/texttospeech v1.4.0/go.mod h1:FX8HQHA6sEpJ7rCMSfXuzBcysDAuWusNNNvN9FELDd8= -cloud.google.com/go/texttospeech v1.5.0/go.mod h1:oKPLhR4n4ZdQqWKURdwxMy0uiTS1xU161C8W57Wkea4= -cloud.google.com/go/texttospeech v1.6.0/go.mod h1:YmwmFT8pj1aBblQOI3TfKmwibnsfvhIBzPXcW4EBovc= -cloud.google.com/go/tpu v1.3.0/go.mod h1:aJIManG0o20tfDQlRIej44FcwGGl/cD0oiRyMKG19IQ= -cloud.google.com/go/tpu v1.4.0/go.mod h1:mjZaX8p0VBgllCzF6wcU2ovUXN9TONFLd7iz227X2Xg= -cloud.google.com/go/tpu v1.5.0/go.mod h1:8zVo1rYDFuW2l4yZVY0R0fb/v44xLh3llq7RuV61fPM= -cloud.google.com/go/trace v1.3.0/go.mod h1:FFUE83d9Ca57C+K8rDl/Ih8LwOzWIV1krKgxg6N0G28= -cloud.google.com/go/trace v1.4.0/go.mod h1:UG0v8UBqzusp+z63o7FK74SdFE+AXpCLdFb1rshXG+Y= -cloud.google.com/go/trace v1.8.0/go.mod h1:zH7vcsbAhklH8hWFig58HvxcxyQbaIqMarMg9hn5ECA= -cloud.google.com/go/trace v1.9.0/go.mod h1:lOQqpE5IaWY0Ixg7/r2SjixMuc6lfTFeO4QGM4dQWOk= -cloud.google.com/go/translate v1.3.0/go.mod h1:gzMUwRjvOqj5i69y/LYLd8RrNQk+hOmIXTi9+nb3Djs= -cloud.google.com/go/translate v1.4.0/go.mod h1:06Dn/ppvLD6WvA5Rhdp029IX2Mi3Mn7fpMRLPvXT5Wg= -cloud.google.com/go/translate v1.5.0/go.mod h1:29YDSYveqqpA1CQFD7NQuP49xymq17RXNaUDdc0mNu0= -cloud.google.com/go/translate v1.6.0/go.mod h1:lMGRudH1pu7I3n3PETiOB2507gf3HnfLV8qlkHZEyos= -cloud.google.com/go/translate v1.7.0/go.mod h1:lMGRudH1pu7I3n3PETiOB2507gf3HnfLV8qlkHZEyos= -cloud.google.com/go/video v1.8.0/go.mod h1:sTzKFc0bUSByE8Yoh8X0mn8bMymItVGPfTuUBUyRgxk= -cloud.google.com/go/video v1.9.0/go.mod h1:0RhNKFRF5v92f8dQt0yhaHrEuH95m068JYOvLZYnJSw= -cloud.google.com/go/video v1.12.0/go.mod h1:MLQew95eTuaNDEGriQdcYn0dTwf9oWiA4uYebxM5kdg= -cloud.google.com/go/video v1.13.0/go.mod h1:ulzkYlYgCp15N2AokzKjy7MQ9ejuynOJdf1tR5lGthk= -cloud.google.com/go/video v1.14.0/go.mod h1:SkgaXwT+lIIAKqWAJfktHT/RbgjSuY6DobxEp0C5yTQ= -cloud.google.com/go/video v1.15.0/go.mod h1:SkgaXwT+lIIAKqWAJfktHT/RbgjSuY6DobxEp0C5yTQ= -cloud.google.com/go/videointelligence v1.6.0/go.mod h1:w0DIDlVRKtwPCn/C4iwZIJdvC69yInhW0cfi+p546uU= -cloud.google.com/go/videointelligence v1.7.0/go.mod h1:k8pI/1wAhjznARtVT9U1llUaFNPh7muw8QyOUpavru4= -cloud.google.com/go/videointelligence v1.8.0/go.mod h1:dIcCn4gVDdS7yte/w+koiXn5dWVplOZkE+xwG9FgK+M= -cloud.google.com/go/videointelligence v1.9.0/go.mod h1:29lVRMPDYHikk3v8EdPSaL8Ku+eMzDljjuvRs105XoU= -cloud.google.com/go/videointelligence v1.10.0/go.mod h1:LHZngX1liVtUhZvi2uNS0VQuOzNi2TkY1OakiuoUOjU= -cloud.google.com/go/vision v1.2.0/go.mod h1:SmNwgObm5DpFBme2xpyOyasvBc1aPdjvMk2bBk0tKD0= -cloud.google.com/go/vision/v2 v2.2.0/go.mod h1:uCdV4PpN1S0jyCyq8sIM42v2Y6zOLkZs+4R9LrGYwFo= -cloud.google.com/go/vision/v2 v2.3.0/go.mod h1:UO61abBx9QRMFkNBbf1D8B1LXdS2cGiiCRx0vSpZoUo= -cloud.google.com/go/vision/v2 v2.4.0/go.mod h1:VtI579ll9RpVTrdKdkMzckdnwMyX2JILb+MhPqRbPsY= -cloud.google.com/go/vision/v2 v2.5.0/go.mod h1:MmaezXOOE+IWa+cS7OhRRLK2cNv1ZL98zhqFFZaaH2E= -cloud.google.com/go/vision/v2 v2.6.0/go.mod h1:158Hes0MvOS9Z/bDMSFpjwsUrZ5fPrdwuyyvKSGAGMY= -cloud.google.com/go/vision/v2 v2.7.0/go.mod h1:H89VysHy21avemp6xcf9b9JvZHVehWbET0uT/bcuY/0= -cloud.google.com/go/vmmigration v1.2.0/go.mod h1:IRf0o7myyWFSmVR1ItrBSFLFD/rJkfDCUTO4vLlJvsE= -cloud.google.com/go/vmmigration v1.3.0/go.mod h1:oGJ6ZgGPQOFdjHuocGcLqX4lc98YQ7Ygq8YQwHh9A7g= -cloud.google.com/go/vmmigration v1.5.0/go.mod h1:E4YQ8q7/4W9gobHjQg4JJSgXXSgY21nA5r8swQV+Xxc= -cloud.google.com/go/vmmigration v1.6.0/go.mod h1:bopQ/g4z+8qXzichC7GW1w2MjbErL54rk3/C843CjfY= -cloud.google.com/go/vmwareengine v0.1.0/go.mod h1:RsdNEf/8UDvKllXhMz5J40XxDrNJNN4sagiox+OI208= -cloud.google.com/go/vmwareengine v0.2.2/go.mod h1:sKdctNJxb3KLZkE/6Oui94iw/xs9PRNC2wnNLXsHvH8= -cloud.google.com/go/vmwareengine v0.3.0/go.mod h1:wvoyMvNWdIzxMYSpH/R7y2h5h3WFkx6d+1TIsP39WGY= -cloud.google.com/go/vpcaccess v1.4.0/go.mod h1:aQHVbTWDYUR1EbTApSVvMq1EnT57ppDmQzZ3imqIk4w= -cloud.google.com/go/vpcaccess v1.5.0/go.mod h1:drmg4HLk9NkZpGfCmZ3Tz0Bwnm2+DKqViEpeEpOq0m8= -cloud.google.com/go/vpcaccess v1.6.0/go.mod h1:wX2ILaNhe7TlVa4vC5xce1bCnqE3AeH27RV31lnmZes= -cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xXZmFiHmGE= -cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg= -cloud.google.com/go/webrisk v1.6.0/go.mod h1:65sW9V9rOosnc9ZY7A7jsy1zoHS5W9IAXv6dGqhMQMc= -cloud.google.com/go/webrisk v1.7.0/go.mod h1:mVMHgEYH0r337nmt1JyLthzMr6YxwN1aAIEc2fTcq7A= -cloud.google.com/go/webrisk v1.8.0/go.mod h1:oJPDuamzHXgUc+b8SiHRcVInZQuybnvEW72PqTc7sSg= -cloud.google.com/go/websecurityscanner v1.3.0/go.mod h1:uImdKm2wyeXQevQJXeh8Uun/Ym1VqworNDlBXQevGMo= -cloud.google.com/go/websecurityscanner v1.4.0/go.mod h1:ebit/Fp0a+FWu5j4JOmJEV8S8CzdTkAS77oDsiSqYWQ= -cloud.google.com/go/websecurityscanner v1.5.0/go.mod h1:Y6xdCPy81yi0SQnDY1xdNTNpfY1oAgXUlcfN3B3eSng= -cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0= -cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= -cloud.google.com/go/workflows v1.8.0/go.mod h1:ysGhmEajwZxGn1OhGOGKsTXc5PyxOc0vfKf5Af+to4M= -cloud.google.com/go/workflows v1.9.0/go.mod h1:ZGkj1aFIOd9c8Gerkjjq7OW7I5+l6cSvT3ujaO/WwSA= -cloud.google.com/go/workflows v1.10.0/go.mod h1:fZ8LmRmZQWacon9UCX1r/g/DfAXx5VcPALq2CxzdePw= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -gioui.org v0.0.0-20210308172011-57750fc8a0a6/go.mod h1:RSH6KIUZ0p2xy5zHDxgAM4zumjgTw83q2ge/PI+yyw8= -git.sr.ht/~sbinet/gg v0.3.1/go.mod h1:KGYtlADtqsqANL9ueOFkWymvzUvLMQllU5Ixo+8v3pc= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/JohnCGriffin/overflow v0.0.0-20211019200055-46fa312c352c/go.mod h1:X0CRv0ky0k6m906ixxpzmDRLvX58TFUKS2eePweuyxk= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 h1:wPbRQzjjwFc0ih8puEVAOFGELsn1zoIIYdxvML7mDxA= github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8/go.mod h1:I0gYDMZ6Z5GRU7l58bNFSkPTFN6Yl12dsUlAZ8xy98g= github.com/PuerkitoBio/goquery v1.8.1 h1:uQxhNlArOIdbrH1tr0UXwdVFgDcZDrZVdcpygAcwmWM= github.com/PuerkitoBio/goquery v1.8.1/go.mod h1:Q8ICL1kNUJ2sXGoAhPGUdYDJvgQgHzJsnnd3H7Ho5jQ= -github.com/ajstarks/deck v0.0.0-20200831202436-30c9fc6549a9/go.mod h1:JynElWSGnm/4RlzPXRlREEwqTHAN3T56Bv2ITsFT3gY= -github.com/ajstarks/deck/generate v0.0.0-20210309230005-c3f852c02e19/go.mod h1:T13YZdzov6OU0A1+RfKZiZN9ca6VeKdBdyDV+BY97Tk= -github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= -github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b/go.mod h1:1KcenG0jGWcpt8ov532z81sp/kMMUG485J2InIOyADM= -github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/andybalholm/cascadia v1.3.1 h1:nhxRkql1kdYCc8Snf7D5/D3spOX+dBgjA6u8x004T2c= github.com/andybalholm/cascadia v1.3.1/go.mod h1:R4bJ1UQfqADjvDa4P6HZHLh/3OxWWEqc0Sk8XGwHqvA= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/apache/arrow/go/v10 v10.0.1/go.mod h1:YvhnlEePVnBS4+0z3fhPfUy7W1Ikj0Ih0vcRo/gZ1M0= -github.com/apache/arrow/go/v11 v11.0.0/go.mod h1:Eg5OsL5H+e299f7u5ssuXsuHQVEGC4xei5aX110hRiI= -github.com/apache/thrift v0.16.0/go.mod h1:PHK3hniurgQaNMZYaCLEqXKsYK8upmhPbmdP2FXSqgU= -github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= -github.com/boombuler/barcode v1.0.1/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/circl v1.1.0/go.mod h1:prBCrKB9DV4poKZY1l9zBXg2QJY7mvgRvtMxxK7fi4I= github.com/cloudflare/circl v1.3.3 h1:fE/Qz0QdIGqeWfnwq0RE0R7MI51s0M2E4Ga9kq5AEMs= github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= -github.com/cncf/udpa/go v0.0.0-20220112060539-c52dc94e7fbe/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= -github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20220314180256-7f1daf1720fc/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20230105202645-06c439db220b/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20230310173818-32f1caf87195/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= -github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= -github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= -github.com/envoyproxy/go-control-plane v0.10.3/go.mod h1:fJJn/j26vwOu972OllsvAgJJM//w9BV6Fxbg2LuVd34= -github.com/envoyproxy/go-control-plane v0.11.0/go.mod h1:VnHyVMpzcLvCFt9yUz1UnCwHLhwx1WguiVDV7pTG/tI= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/envoyproxy/protoc-gen-validate v0.6.7/go.mod h1:dyJXwwfPK2VSqiB9Klm1J6romD608Ba7Hij42vrOBCo= -github.com/envoyproxy/protoc-gen-validate v0.9.1/go.mod h1:OKNgG7TCp5pF4d6XftA0++PMirau2/yoOwVac3AbF2w= -github.com/envoyproxy/protoc-gen-validate v0.10.0/go.mod h1:DRjgyB0I43LtJapqN6NiRwroiAU2PaFuvk/vjgh61ss= -github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= -github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-fonts/dejavu v0.1.0/go.mod h1:4Wt4I4OU2Nq9asgDCteaAaWZOV24E+0/Pwo0gppep4g= -github.com/go-fonts/latin-modern v0.2.0/go.mod h1:rQVLdDMK+mK1xscDwsqM5J8U2jrRa3T0ecnM9pNujks= -github.com/go-fonts/liberation v0.1.1/go.mod h1:K6qoJYypsmfVjWg8KOVDQhLc8UDgIK2HYqyqAO9z7GY= -github.com/go-fonts/liberation v0.2.0/go.mod h1:K6qoJYypsmfVjWg8KOVDQhLc8UDgIK2HYqyqAO9z7GY= -github.com/go-fonts/stix v0.1.0/go.mod h1:w/c1f0ldAUlJmLBvlbkvVXLAD+tAMqobIIQpmnUIzUY= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-latex/latex v0.0.0-20210118124228-b3d85cf34e07/go.mod h1:CO1AlKB2CSIqUrmQPqA0gdRIlnLEY0gK5JGjh37zN5U= -github.com/go-latex/latex v0.0.0-20210823091927-c0d11ff05a81/go.mod h1:SX0U8uGpxhq9o2S/CELCSUxEWWAuoCUcVCQWv7G2OCk= -github.com/go-pdf/fpdf v0.5.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhOh5M= -github.com/go-pdf/fpdf v0.6.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhOh5M= -github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= -github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= -github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= -github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/flatbuffers v2.0.8+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-github/v54 v54.0.0 h1:OZdXwow4EAD5jEo5qg+dGFH2DpkyZvVsAehjvJuUL/c= -github.com/google/go-github/v54 v54.0.0/go.mod h1:Sw1LXWHhXRZtzJ9LI5fyJg9wbQzYvFhW8W5P2yaAQ7s= +github.com/google/go-github/v55 v55.0.0 h1:4pp/1tNMB9X/LuAhs5i0KQAE40NmiR/y6prLNb9x9cg= +github.com/google/go-github/v55 v55.0.0/go.mod h1:JLahOTA1DnXzhxEymmFF5PP2tSS9JVNj68mSZNDwskA= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= -github.com/google/martian/v3 v3.3.2/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/s2a-go v0.1.0/go.mod h1:OJpEgntRZo8ugHpF9hkoLJbS5dSI20XZeXJ9JVywLlM= -github.com/google/s2a-go v0.1.3/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= -github.com/google/s2a-go v0.1.4/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= -github.com/googleapis/enterprise-certificate-proxy v0.1.0/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= -github.com/googleapis/enterprise-certificate-proxy v0.2.0/go.mod h1:8C0jb7/mgJe/9KK8Lm7X9ctZC2t60YyIpYEI16jx0Qg= -github.com/googleapis/enterprise-certificate-proxy v0.2.1/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= -github.com/googleapis/enterprise-certificate-proxy v0.2.3/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= -github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM= -github.com/googleapis/gax-go/v2 v2.2.0/go.mod h1:as02EH8zWkzwUoLbBaFeQ+arQaj/OthfcblKl4IGNaM= -github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99EXz9pXxye9YM= -github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c= -github.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqEF02fYlzkUCyo= -github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY= -github.com/googleapis/gax-go/v2 v2.7.0/go.mod h1:TEop28CZZQ2y+c0VxMUmu1lV+fQx57QpBWsYpwqHJx8= -github.com/googleapis/gax-go/v2 v2.7.1/go.mod h1:4orTrqY6hXxxaUL4LHIPl6lGo8vAE38/qKbhSAKP6QI= -github.com/googleapis/gax-go/v2 v2.8.0/go.mod h1:4orTrqY6hXxxaUL4LHIPl6lGo8vAE38/qKbhSAKP6QI= -github.com/googleapis/gax-go/v2 v2.10.0/go.mod h1:4UOEnMCrxsSqQ940WnTiD6qJ63le2ev3xfyagutxiPw= -github.com/googleapis/gax-go/v2 v2.11.0/go.mod h1:DxmR61SGKkGLa2xigwuZIQpkCI2S5iydzRfb3peWZJI= -github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= -github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3/go.mod h1:o//XUCC/F+yRGJoPO/VU0GSB0f8Nhgmxx0VIRUvaC0w= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= -github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/jung-kurt/gofpdf v1.0.0/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= -github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= -github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/asmfmt v1.3.2/go.mod h1:AG8TuvYojzulgDAMCnYn50l/5QV3Bs/tp6j0HLHbNSE= -github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= -github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/lyft/protoc-gen-star v0.6.0/go.mod h1:TGAoBVkt8w7MPG72TrKIu85MIdXwDuzJYeZuUPFPNwA= -github.com/lyft/protoc-gen-star v0.6.1/go.mod h1:TGAoBVkt8w7MPG72TrKIu85MIdXwDuzJYeZuUPFPNwA= -github.com/lyft/protoc-gen-star/v2 v2.0.1/go.mod h1:RcCdONR2ScXaYnQC5tUzxzlpA3WVYF7/opLeUgcQs/o= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-sqlite3 v1.14.14/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= -github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8/go.mod h1:mC1jAcsrzbxHt8iiaC+zU4b1ylILSosueou12R++wfY= -github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3/go.mod h1:RagcQ7I8IeTMnF8JTXieKnO4Z6JCsikNEzj0DwauVzE= -github.com/phpdave11/gofpdf v1.4.2/go.mod h1:zpO6xFn9yxo3YLyMvW8HcKWVdbNqgIfOOp2dXMnm1mY= -github.com/phpdave11/gofpdi v1.0.12/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI= -github.com/phpdave11/gofpdi v1.0.13/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI= -github.com/pierrec/lz4/v4 v4.1.15/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= -github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= -github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/ruudk/golang-pdf417 v0.0.0-20181029194003-1af4ab5afa58/go.mod h1:6lfFZQK844Gfx8o5WFuvpxWRwnSoipWe/p622j1v06w= -github.com/ruudk/golang-pdf417 v0.0.0-20201230142125-a7e3863a1245/go.mod h1:pQAZKsJ8yyVxGRWYNEm9oFB8ieLgKFnamEyDmSA0BRk= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= -github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= -github.com/spf13/afero v1.9.2/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/xlzd/gotp v0.1.0 h1:37blvlKCh38s+fkem+fFh7sMnceltoIEBYTVXyoa5Po= github.com/xlzd/gotp v0.1.0/go.mod h1:ndLJ3JKzi3xLmUProq4LLxCuECL93dG9WASNLpHz8qg= -github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/zeebo/assert v1.3.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0= -github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= -go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= -go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.15.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= -go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= -golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= -golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191002040644-a1355ae1e2c3/go.mod h1:NOZ3BPKG0ec/BKJQgnvsSFpcKLM5xXVWnvZS97DWHgE= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= -golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20220827204233-334a2380cb91/go.mod h1:cyybsKvd6eL0RnXn6p/Grxp8F5bW7iYuBgsNCOHpMYE= -golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20190910094157-69e4b8554b2a/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20200119044424-58c23975cae1/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20200430140353-33d19683fad8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20200618115811-c13761719519/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20201208152932-35266b937fa6/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20210216034530-4410531fe030/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20210607152325-775e3b0c77b9/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= -golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= -golang.org/x/image v0.0.0-20211028202545-6944b10bf410/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= -golang.org/x/image v0.0.0-20220302094943-723b81ca9867/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= -golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= -golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210916014120-12bc252f5db8/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.0.0-20220617184016-355a448f1bc9/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= -golang.org/x/net v0.0.0-20221012135044-0b7e1fb9d458/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= -golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= -golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= -golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14= golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= -golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= -golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= -golang.org/x/oauth2 v0.0.0-20220608161450-d0670ef3b1eb/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE= -golang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE= -golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= -golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= -golang.org/x/oauth2 v0.0.0-20221006150949-b44042a4b9c1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= -golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= -golang.org/x/oauth2 v0.4.0/go.mod h1:RznEsdpjGAINPTOF0UH/t+xJ75L18YO3Ho6Pyn+uRec= -golang.org/x/oauth2 v0.5.0/go.mod h1:9/XBHVqLaWO3/BRHs5jbpYCnOZVjj5V0ndyaAM7KB4I= -golang.org/x/oauth2 v0.6.0/go.mod h1:ycmewcwgD4Rpr3eZJLSB4Kyyljb3qDh40vJ8STE5HKw= -golang.org/x/oauth2 v0.7.0/go.mod h1:hPLQkd9LyjfXTiRohC/41GhcFqxisoUQ99sCUOHO9x4= -golang.org/x/oauth2 v0.8.0/go.mod h1:yr7u4HXZRm1R1kBWqr/xKNqewf0plRYoB7sla+BCIXE= -golang.org/x/oauth2 v0.11.0 h1:vPL4xzxBM4niKCW6g9whtaWVXTJf1U5e4aZxxFx/gbU= -golang.org/x/oauth2 v0.11.0/go.mod h1:LdF7O/8bLR/qWK9DrpXmbHLTouvRHK0SgJl0GmDBchk= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210304124612-50617c2ba197/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220502124256-b6088ccd6cba/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= -golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= -golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= -golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20220922220347-f3bd1da661af/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.1.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190927191325-030b2cf1153e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= -golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= -gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0= -gonum.org/v1/gonum v0.9.3/go.mod h1:TZumC3NeyVQskjXqmyWt4S3bINhy7B4eYwW69EbyX+0= -gonum.org/v1/gonum v0.11.0/go.mod h1:fSG4YDCxxUZQJ7rKsQrj0gMOg00Il0Z96/qMA4bVQhA= -gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= -gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= -gonum.org/v1/plot v0.9.0/go.mod h1:3Pcqqmp6RHvJI72kgb8fThyUnav364FOsdDo2aGW5lY= -gonum.org/v1/plot v0.10.1/go.mod h1:VZW5OlhkL1mysU9vaqNHnsy86inf6Ot+jB3r+BczCEo= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= -google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= -google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= -google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= -google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= -google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= -google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo= -google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4= -google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= -google.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00sOU= -google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k= -google.golang.org/api v0.55.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= -google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= -google.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdrMgI= -google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I= -google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo= -google.golang.org/api v0.67.0/go.mod h1:ShHKP8E60yPsKNw/w8w+VYaj9H6buA5UqDp8dhbQZ6g= -google.golang.org/api v0.70.0/go.mod h1:Bs4ZM2HGifEvXwd50TtW70ovgJffJYw2oRCOFU/SkfA= -google.golang.org/api v0.71.0/go.mod h1:4PyU6e6JogV1f9eA4voyrTY2batOLdgZ5qZ5HOCc4j8= -google.golang.org/api v0.74.0/go.mod h1:ZpfMZOVRMywNyvJFeqL9HRWBgAuRfSjJFpe9QtRRyDs= -google.golang.org/api v0.75.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA= -google.golang.org/api v0.77.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA= -google.golang.org/api v0.78.0/go.mod h1:1Sg78yoMLOhlQTeF+ARBoytAcH1NNyyl390YMy6rKmw= -google.golang.org/api v0.80.0/go.mod h1:xY3nI94gbvBrE0J6NHXhxOmW97HG7Khjkku6AFB3Hyg= -google.golang.org/api v0.84.0/go.mod h1:NTsGnUFJMYROtiquksZHBWtHfeMC7iYthki7Eq3pa8o= -google.golang.org/api v0.85.0/go.mod h1:AqZf8Ep9uZ2pyTvgL+x0D3Zt0eoT9b5E8fmzfu6FO2g= -google.golang.org/api v0.90.0/go.mod h1:+Sem1dnrKlrXMR/X0bPnMWyluQe4RsNoYfmNLhOIkzw= -google.golang.org/api v0.93.0/go.mod h1:+Sem1dnrKlrXMR/X0bPnMWyluQe4RsNoYfmNLhOIkzw= -google.golang.org/api v0.95.0/go.mod h1:eADj+UBuxkh5zlrSntJghuNeg8HwQ1w5lTKkuqaETEI= -google.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= -google.golang.org/api v0.97.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= -google.golang.org/api v0.98.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= -google.golang.org/api v0.99.0/go.mod h1:1YOf74vkVndF7pG6hIHuINsM7eWwpVTAfNMNiL91A08= -google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70= -google.golang.org/api v0.102.0/go.mod h1:3VFl6/fzoA+qNuS1N1/VfXY4LjoXN/wzeIp7TweWwGo= -google.golang.org/api v0.103.0/go.mod h1:hGtW6nK1AC+d9si/UBhw8Xli+QMOf6xyNAyJw4qU9w0= -google.golang.org/api v0.106.0/go.mod h1:2Ts0XTHNVWxypznxWOYUeI4g3WdP9Pk2Qk58+a/O9MY= -google.golang.org/api v0.107.0/go.mod h1:2Ts0XTHNVWxypznxWOYUeI4g3WdP9Pk2Qk58+a/O9MY= -google.golang.org/api v0.108.0/go.mod h1:2Ts0XTHNVWxypznxWOYUeI4g3WdP9Pk2Qk58+a/O9MY= -google.golang.org/api v0.110.0/go.mod h1:7FC4Vvx1Mooxh8C5HWjzZHcavuS2f6pmJpZx60ca7iI= -google.golang.org/api v0.111.0/go.mod h1:qtFHvU9mhgTJegR31csQ+rwxyUTHOKFqCKWp1J0fdw0= -google.golang.org/api v0.114.0/go.mod h1:ifYI2ZsFK6/uGddGfAD5BMxlnkBqCmqHSDUVi45N5Yg= -google.golang.org/api v0.118.0/go.mod h1:76TtD3vkgmZ66zZzp72bUUklpmQmKlhh6sYtIjYK+5E= -google.golang.org/api v0.122.0/go.mod h1:gcitW0lvnyWjSp9nKxAbdHKIZ6vF4aajGueeslZOyms= -google.golang.org/api v0.124.0/go.mod h1:xu2HQurE5gi/3t1aFCvhPD781p0a3p11sdunTJ2BlP4= -google.golang.org/api v0.126.0/go.mod h1:mBwVAtz+87bEN6CbA1GtZPDOqY2R5ONPqJeIlvyo4Aw= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= -google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= -google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= -google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210329143202-679c6ae281ee/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= -google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= -google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= -google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210713002101-d411969a0d9a/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= -google.golang.org/genproto v0.0.0-20210716133855-ce7ef5c701ea/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= -google.golang.org/genproto v0.0.0-20210728212813-7823e685a01f/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= -google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= -google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwySK631ADgubI+/XFU/xp8FD5KIVV4rj8UC5w= -google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20220126215142-9970aeb2e350/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20220207164111-0872dc986b00/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220304144024-325a89244dc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220324131243-acbaeb5b85eb/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= -google.golang.org/genproto v0.0.0-20220329172620-7be39ac1afc7/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= -google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= -google.golang.org/genproto v0.0.0-20220413183235-5e96e2839df9/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= -google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= -google.golang.org/genproto v0.0.0-20220421151946-72621c1f0bd3/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= -google.golang.org/genproto v0.0.0-20220429170224-98d788798c3e/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= -google.golang.org/genproto v0.0.0-20220502173005-c8bf987b8c21/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= -google.golang.org/genproto v0.0.0-20220505152158-f39f71e6c8f3/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= -google.golang.org/genproto v0.0.0-20220518221133-4f43b3371335/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= -google.golang.org/genproto v0.0.0-20220523171625-347a074981d8/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= -google.golang.org/genproto v0.0.0-20220608133413-ed9918b62aac/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= -google.golang.org/genproto v0.0.0-20220616135557-88e70c0c3a90/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= -google.golang.org/genproto v0.0.0-20220617124728-180714bec0ad/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= -google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= -google.golang.org/genproto v0.0.0-20220628213854-d9e0b6570c03/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= -google.golang.org/genproto v0.0.0-20220722212130-b98a9ff5e252/go.mod h1:GkXuJDJ6aQ7lnJcRF+SJVgFdQhypqgl3LB1C9vabdRE= -google.golang.org/genproto v0.0.0-20220801145646-83ce21fca29f/go.mod h1:iHe1svFLAZg9VWz891+QbRMwUv9O/1Ww+/mngYeThbc= -google.golang.org/genproto v0.0.0-20220815135757-37a418bb8959/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= -google.golang.org/genproto v0.0.0-20220817144833-d7fd3f11b9b1/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= -google.golang.org/genproto v0.0.0-20220822174746-9e6da59bd2fc/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= -google.golang.org/genproto v0.0.0-20220829144015-23454907ede3/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= -google.golang.org/genproto v0.0.0-20220829175752-36a9c930ecbf/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= -google.golang.org/genproto v0.0.0-20220913154956-18f8339a66a5/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= -google.golang.org/genproto v0.0.0-20220914142337-ca0e39ece12f/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= -google.golang.org/genproto v0.0.0-20220915135415-7fd63a7952de/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= -google.golang.org/genproto v0.0.0-20220916172020-2692e8806bfa/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= -google.golang.org/genproto v0.0.0-20220919141832-68c03719ef51/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= -google.golang.org/genproto v0.0.0-20220920201722-2b89144ce006/go.mod h1:ht8XFiar2npT/g4vkk7O0WYS1sHOHbdujxbEp7CJWbw= -google.golang.org/genproto v0.0.0-20220926165614-551eb538f295/go.mod h1:woMGP53BroOrRY3xTxlbr8Y3eB/nzAvvFM83q7kG2OI= -google.golang.org/genproto v0.0.0-20220926220553-6981cbe3cfce/go.mod h1:woMGP53BroOrRY3xTxlbr8Y3eB/nzAvvFM83q7kG2OI= -google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqwhZAwq4wsRUaVG555sVgsNmIjRtO7t/JH29U= -google.golang.org/genproto v0.0.0-20221014173430-6e2ab493f96b/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= -google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= -google.golang.org/genproto v0.0.0-20221024153911-1573dae28c9c/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= -google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= -google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c/go.mod h1:CGI5F/G+E5bKwmfYo09AXuVN4dD894kIKUFmVbP2/Fo= -google.golang.org/genproto v0.0.0-20221109142239-94d6d90a7d66/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= -google.golang.org/genproto v0.0.0-20221114212237-e4508ebdbee1/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= -google.golang.org/genproto v0.0.0-20221117204609-8f9c96812029/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= -google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= -google.golang.org/genproto v0.0.0-20221201164419-0e50fba7f41c/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= -google.golang.org/genproto v0.0.0-20221201204527-e3fa12d562f3/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= -google.golang.org/genproto v0.0.0-20221202195650-67e5cbc046fd/go.mod h1:cTsE614GARnxrLsqKREzmNYJACSWWpAWdNMwnD7c2BE= -google.golang.org/genproto v0.0.0-20221227171554-f9683d7f8bef/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/genproto v0.0.0-20230112194545-e10362b5ecf9/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/genproto v0.0.0-20230113154510-dbe35b8444a5/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/genproto v0.0.0-20230123190316-2c411cf9d197/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/genproto v0.0.0-20230124163310-31e0e69b6fc2/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/genproto v0.0.0-20230125152338-dcaf20b6aeaa/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/genproto v0.0.0-20230127162408-596548ed4efa/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/genproto v0.0.0-20230209215440-0dfe4f8abfcc/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/genproto v0.0.0-20230216225411-c8e22ba71e44/go.mod h1:8B0gmkoRebU8ukX6HP+4wrVQUY1+6PkQ44BSyIlflHA= -google.golang.org/genproto v0.0.0-20230222225845-10f96fb3dbec/go.mod h1:3Dl5ZL0q0isWJt+FVcfpQyirqemEuLAK/iFvg1UP1Hw= -google.golang.org/genproto v0.0.0-20230223222841-637eb2293923/go.mod h1:3Dl5ZL0q0isWJt+FVcfpQyirqemEuLAK/iFvg1UP1Hw= -google.golang.org/genproto v0.0.0-20230303212802-e74f57abe488/go.mod h1:TvhZT5f700eVlTNwND1xoEZQeWTB2RY/65kplwl/bFA= -google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= -google.golang.org/genproto v0.0.0-20230320184635-7606e756e683/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= -google.golang.org/genproto v0.0.0-20230323212658-478b75c54725/go.mod h1:UUQDJDOlWu4KYeJZffbWgBkS1YFobzKbLVfK69pe0Ak= -google.golang.org/genproto v0.0.0-20230330154414-c0448cd141ea/go.mod h1:UUQDJDOlWu4KYeJZffbWgBkS1YFobzKbLVfK69pe0Ak= -google.golang.org/genproto v0.0.0-20230331144136-dcfb400f0633/go.mod h1:UUQDJDOlWu4KYeJZffbWgBkS1YFobzKbLVfK69pe0Ak= -google.golang.org/genproto v0.0.0-20230403163135-c38d8f061ccd/go.mod h1:UUQDJDOlWu4KYeJZffbWgBkS1YFobzKbLVfK69pe0Ak= -google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= -google.golang.org/genproto v0.0.0-20230525234025-438c736192d0/go.mod h1:9ExIQyXL5hZrHzQceCwuSYwZZ5QZBazOcprJ5rgs3lY= -google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:xZnkP7mREFX5MORlOPEzLMr+90PPZQ2QWzrVTWfAq64= -google.golang.org/genproto/googleapis/api v0.0.0-20230525234020-1aefcd67740a/go.mod h1:ts19tUU+Z0ZShN1y3aPyq2+O3d5FUNNgT6FtOzmrNn8= -google.golang.org/genproto/googleapis/api v0.0.0-20230525234035-dd9d682886f9/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= -google.golang.org/genproto/googleapis/api v0.0.0-20230526203410-71b5a4ffd15e/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= -google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= -google.golang.org/genproto/googleapis/bytestream v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:ylj+BE99M198VPbBh6A8d9n3w8fChvyLK3wwBOjXBFA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234015-3fc162c6f38a/go.mod h1:xURIpW9ES5+/GZhnV6beoEtxQrnkRGIfP5VQG2tCBLc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230526203410-71b5a4ffd15e/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= -google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= -google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= -google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= -google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= -google.golang.org/grpc v1.52.0/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= -google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= -google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= -google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= -google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= -lukechampine.com/uint128 v1.1.1/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= -lukechampine.com/uint128 v1.2.0/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= -modernc.org/cc/v3 v3.36.0/go.mod h1:NFUHyPn4ekoC/JHeZFfZurN6ixxawE1BnVonP/oahEI= -modernc.org/cc/v3 v3.36.2/go.mod h1:NFUHyPn4ekoC/JHeZFfZurN6ixxawE1BnVonP/oahEI= -modernc.org/cc/v3 v3.36.3/go.mod h1:NFUHyPn4ekoC/JHeZFfZurN6ixxawE1BnVonP/oahEI= -modernc.org/ccgo/v3 v3.0.0-20220428102840-41399a37e894/go.mod h1:eI31LL8EwEBKPpNpA4bU1/i+sKOwOrQy8D87zWUcRZc= -modernc.org/ccgo/v3 v3.0.0-20220430103911-bc99d88307be/go.mod h1:bwdAnOoaIt8Ax9YdWGjxWsdkPcZyRPHqrOvJxaKAKGw= -modernc.org/ccgo/v3 v3.16.4/go.mod h1:tGtX0gE9Jn7hdZFeU88slbTh1UtCYKusWOoCJuvkWsQ= -modernc.org/ccgo/v3 v3.16.6/go.mod h1:tGtX0gE9Jn7hdZFeU88slbTh1UtCYKusWOoCJuvkWsQ= -modernc.org/ccgo/v3 v3.16.8/go.mod h1:zNjwkizS+fIFDrDjIAgBSCLkWbJuHF+ar3QRn+Z9aws= -modernc.org/ccgo/v3 v3.16.9/go.mod h1:zNMzC9A9xeNUepy6KuZBbugn3c0Mc9TeiJO4lgvkJDo= -modernc.org/ccorpus v1.11.6/go.mod h1:2gEUTrWqdpH2pXsmTM1ZkjeSrUWDpjMu2T6m29L/ErQ= -modernc.org/httpfs v1.0.6/go.mod h1:7dosgurJGp0sPaRanU53W4xZYKh14wfzX420oZADeHM= -modernc.org/libc v0.0.0-20220428101251-2d5f3daf273b/go.mod h1:p7Mg4+koNjc8jkqwcoFBJx7tXkpj00G77X7A72jXPXA= -modernc.org/libc v1.16.0/go.mod h1:N4LD6DBE9cf+Dzf9buBlzVJndKr/iJHG97vGLHYnb5A= -modernc.org/libc v1.16.1/go.mod h1:JjJE0eu4yeK7tab2n4S1w8tlWd9MxXLRzheaRnAKymU= -modernc.org/libc v1.16.17/go.mod h1:hYIV5VZczAmGZAnG15Vdngn5HSF5cSkbvfz2B7GRuVU= -modernc.org/libc v1.16.19/go.mod h1:p7Mg4+koNjc8jkqwcoFBJx7tXkpj00G77X7A72jXPXA= -modernc.org/libc v1.17.0/go.mod h1:XsgLldpP4aWlPlsjqKRdHPqCxCjISdHfM/yeWC5GyW0= -modernc.org/libc v1.17.1/go.mod h1:FZ23b+8LjxZs7XtFMbSzL/EhPxNbfZbErxEHc7cbD9s= -modernc.org/mathutil v1.2.2/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= -modernc.org/mathutil v1.4.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= -modernc.org/mathutil v1.5.0/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= -modernc.org/memory v1.1.1/go.mod h1:/0wo5ibyrQiaoUoH7f9D8dnglAmILJ5/cxZlRECf+Nw= -modernc.org/memory v1.2.0/go.mod h1:/0wo5ibyrQiaoUoH7f9D8dnglAmILJ5/cxZlRECf+Nw= -modernc.org/memory v1.2.1/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU= -modernc.org/opt v0.1.1/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= -modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= -modernc.org/sqlite v1.18.1/go.mod h1:6ho+Gow7oX5V+OiOQ6Tr4xeqbx13UZ6t+Fw9IRUG4d4= -modernc.org/strutil v1.1.1/go.mod h1:DE+MQQ/hjKBZS2zNInV5hhcipt5rLPWkmpbGeW5mmdw= -modernc.org/strutil v1.1.3/go.mod h1:MEHNA7PdEnEwLvspRMtWTNnp2nnyvMfkimT1NKNAGbw= -modernc.org/tcl v1.13.1/go.mod h1:XOLfOwzhkljL4itZkK6T72ckMgvj0BDsnKNdZVUOecw= -modernc.org/token v1.0.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= -modernc.org/z v1.5.1/go.mod h1:eWFB510QWW5Th9YGZT81s+LwvaAs3Q2yr4sP0rmLkv8= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= -rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= -rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= From 4030e93eb69076454b3fc48b605b15054efbaf63 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Wed, 6 Sep 2023 18:47:32 +0300 Subject: [PATCH 014/145] Add enterprise runner group operations (#2891) --- github/enterprise_actions_runner_groups.go | 310 ++++++++ .../enterprise_actions_runner_groups_test.go | 666 ++++++++++++++++++ github/github-accessors.go | 160 +++++ github/github-accessors_test.go | 200 ++++++ 4 files changed, 1336 insertions(+) create mode 100644 github/enterprise_actions_runner_groups.go create mode 100644 github/enterprise_actions_runner_groups_test.go diff --git a/github/enterprise_actions_runner_groups.go b/github/enterprise_actions_runner_groups.go new file mode 100644 index 00000000000..b6bb70dae40 --- /dev/null +++ b/github/enterprise_actions_runner_groups.go @@ -0,0 +1,310 @@ +// Copyright 2023 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// ListOrganizations represents the response from the list orgs endpoints. +type ListOrganizations struct { + TotalCount *int `json:"total_count,omitempty"` + Organizations []*Organization `json:"organizations"` +} + +// EnterpriseRunnerGroup represents a self-hosted runner group configured in an enterprise. +type EnterpriseRunnerGroup struct { + ID *int64 `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Visibility *string `json:"visibility,omitempty"` + Default *bool `json:"default,omitempty"` + SelectedOrganizationsURL *string `json:"selected_organizations_url,omitempty"` + RunnersURL *string `json:"runners_url,omitempty"` + Inherited *bool `json:"inherited,omitempty"` + AllowsPublicRepositories *bool `json:"allows_public_repositories,omitempty"` + RestrictedToWorkflows *bool `json:"restricted_to_workflows,omitempty"` + SelectedWorkflows []string `json:"selected_workflows,omitempty"` + WorkflowRestrictionsReadOnly *bool `json:"workflow_restrictions_read_only,omitempty"` +} + +// EnterpriseRunnerGroups represents a collection of self-hosted runner groups configured for an enterprise. +type EnterpriseRunnerGroups struct { + TotalCount *int `json:"total_count,omitempty"` + RunnerGroups []*EnterpriseRunnerGroup `json:"runner_groups"` +} + +// CreateEnterpriseRunnerGroupRequest represents a request to create a Runner group for an enterprise. +type CreateEnterpriseRunnerGroupRequest struct { + Name *string `json:"name,omitempty"` + Visibility *string `json:"visibility,omitempty"` + // List of organization IDs that can access the runner group. + SelectedOrganizationIDs []int64 `json:"selected_organization_ids,omitempty"` + // Runners represent a list of runner IDs to add to the runner group. + Runners []int64 `json:"runners,omitempty"` + // If set to True, public repos can use this runner group + AllowsPublicRepositories *bool `json:"allows_public_repositories,omitempty"` + // If true, the runner group will be restricted to running only the workflows specified in the SelectedWorkflows slice. + RestrictedToWorkflows *bool `json:"restricted_to_workflows,omitempty"` + // List of workflows the runner group should be allowed to run. This setting will be ignored unless RestrictedToWorkflows is set to true. + SelectedWorkflows []string `json:"selected_workflows,omitempty"` +} + +// UpdateEnterpriseRunnerGroupRequest represents a request to update a Runner group for an enterprise. +type UpdateEnterpriseRunnerGroupRequest struct { + Name *string `json:"name,omitempty"` + Visibility *string `json:"visibility,omitempty"` + AllowsPublicRepositories *bool `json:"allows_public_repositories,omitempty"` + RestrictedToWorkflows *bool `json:"restricted_to_workflows,omitempty"` + SelectedWorkflows []string `json:"selected_workflows,omitempty"` +} + +// SetOrgAccessRunnerGroupRequest represents a request to replace the list of organizations +// that can access a self-hosted runner group configured in an enterprise. +type SetOrgAccessRunnerGroupRequest struct { + // Updated list of organization IDs that should be given access to the runner group. + SelectedOrganizationIDs []int64 `json:"selected_organization_ids"` +} + +// ListEnterpriseRunnerGroupOptions extend ListOptions to have the optional parameters VisibleToOrganization. +type ListEnterpriseRunnerGroupOptions struct { + ListOptions + + // Only return runner groups that are allowed to be used by this organization. + VisibleToOrganization string `url:"visible_to_organization,omitempty"` +} + +// ListRunnerGroups lists all self-hosted runner groups configured in an enterprise. +// +// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#list-self-hosted-runner-groups-for-an-enterprise +func (s *EnterpriseService) ListRunnerGroups(ctx context.Context, enterprise string, opts *ListEnterpriseRunnerGroupOptions) (*EnterpriseRunnerGroups, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/runner-groups", enterprise) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + groups := &EnterpriseRunnerGroups{} + resp, err := s.client.Do(ctx, req, &groups) + if err != nil { + return nil, resp, err + } + + return groups, resp, nil +} + +// GetEnterpriseRunnerGroup gets a specific self-hosted runner group for an enterprise using its RunnerGroup ID. +// +// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#get-a-self-hosted-runner-group-for-an-enterprise +func (s *EnterpriseService) GetEnterpriseRunnerGroup(ctx context.Context, enterprise string, groupID int64) (*EnterpriseRunnerGroup, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v", enterprise, groupID) + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + runnerGroup := new(EnterpriseRunnerGroup) + resp, err := s.client.Do(ctx, req, runnerGroup) + if err != nil { + return nil, resp, err + } + + return runnerGroup, resp, nil +} + +// DeleteEnterpriseRunnerGroup deletes a self-hosted runner group from an enterprise. +// +// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#delete-a-self-hosted-runner-group-from-an-enterprise +func (s *EnterpriseService) DeleteEnterpriseRunnerGroup(ctx context.Context, enterprise string, groupID int64) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v", enterprise, groupID) + + req, err := s.client.NewRequest("DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, req, nil) +} + +// CreateEnterpriseRunnerGroup creates a new self-hosted runner group for an enterprise. +// +// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#create-a-self-hosted-runner-group-for-an-enterprise +func (s *EnterpriseService) CreateEnterpriseRunnerGroup(ctx context.Context, enterprise string, createReq CreateEnterpriseRunnerGroupRequest) (*EnterpriseRunnerGroup, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/runner-groups", enterprise) + req, err := s.client.NewRequest("POST", u, createReq) + if err != nil { + return nil, nil, err + } + + runnerGroup := new(EnterpriseRunnerGroup) + resp, err := s.client.Do(ctx, req, runnerGroup) + if err != nil { + return nil, resp, err + } + + return runnerGroup, resp, nil +} + +// UpdateEnterpriseRunnerGroup updates a self-hosted runner group for an enterprise. +// +// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#update-a-self-hosted-runner-group-for-an-enterprise +func (s *EnterpriseService) UpdateEnterpriseRunnerGroup(ctx context.Context, enterprise string, groupID int64, updateReq UpdateEnterpriseRunnerGroupRequest) (*EnterpriseRunnerGroup, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v", enterprise, groupID) + req, err := s.client.NewRequest("PATCH", u, updateReq) + if err != nil { + return nil, nil, err + } + + runnerGroup := new(EnterpriseRunnerGroup) + resp, err := s.client.Do(ctx, req, runnerGroup) + if err != nil { + return nil, resp, err + } + + return runnerGroup, resp, nil +} + +// ListOrganizationAccessRunnerGroup lists the organizations with access to a self-hosted runner group configured in an enterprise. +// +// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#list-organization-access-to-a-self-hosted-runner-group-in-an-enterprise +func (s *EnterpriseService) ListOrganizationAccessRunnerGroup(ctx context.Context, enterprise string, groupID int64, opts *ListOptions) (*ListOrganizations, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v/organizations", enterprise, groupID) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + orgs := &ListOrganizations{} + resp, err := s.client.Do(ctx, req, &orgs) + if err != nil { + return nil, resp, err + } + + return orgs, resp, nil +} + +// SetOrganizationAccessRunnerGroup replaces the list of organizations that have access to a self-hosted runner group configured in an enterprise +// with a new List of organizations. +// +// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#set-organization-access-for-a-self-hosted-runner-group-in-an-enterprise +func (s *EnterpriseService) SetOrganizationAccessRunnerGroup(ctx context.Context, enterprise string, groupID int64, ids SetOrgAccessRunnerGroupRequest) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v/organizations", enterprise, groupID) + + req, err := s.client.NewRequest("PUT", u, ids) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, req, nil) +} + +// AddOrganizationAccessRunnerGroup adds an organization to the list of selected organizations that can access a self-hosted runner group. +// The runner group must have visibility set to 'selected'. +// +// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#add-organization-access-to-a-self-hosted-runner-group-in-an-enterprise +func (s *EnterpriseService) AddOrganizationAccessRunnerGroup(ctx context.Context, enterprise string, groupID, orgID int64) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v/organizations/%v", enterprise, groupID, orgID) + + req, err := s.client.NewRequest("PUT", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, req, nil) +} + +// RemoveOrganizationAccessRunnerGroup removes an organization from the list of selected organizations that can access a self-hosted runner group. +// The runner group must have visibility set to 'selected'. +// +// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#remove-organization-access-to-a-self-hosted-runner-group-in-an-enterprise +func (s *EnterpriseService) RemoveOrganizationAccessRunnerGroup(ctx context.Context, enterprise string, groupID, orgID int64) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v/organizations/%v", enterprise, groupID, orgID) + + req, err := s.client.NewRequest("DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, req, nil) +} + +// ListRunnerGroupRunners lists self-hosted runners that are in a specific enterprise group. +// +// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#list-self-hosted-runners-in-a-group-for-an-enterprise +func (s *EnterpriseService) ListRunnerGroupRunners(ctx context.Context, enterprise string, groupID int64, opts *ListOptions) (*Runners, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v/runners", enterprise, groupID) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + runners := &Runners{} + resp, err := s.client.Do(ctx, req, &runners) + if err != nil { + return nil, resp, err + } + + return runners, resp, nil +} + +// SetRunnerGroupRunners replaces the list of self-hosted runners that are part of an enterprise runner group +// with a new list of runners. +// +// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#set-self-hosted-runners-in-a-group-for-an-enterprise +func (s *EnterpriseService) SetRunnerGroupRunners(ctx context.Context, enterprise string, groupID int64, ids SetRunnerGroupRunnersRequest) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v/runners", enterprise, groupID) + + req, err := s.client.NewRequest("PUT", u, ids) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, req, nil) +} + +// AddRunnerGroupRunners adds a self-hosted runner to a runner group configured in an enterprise. +// +// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#add-a-self-hosted-runner-to-a-group-for-an-enterprise +func (s *EnterpriseService) AddRunnerGroupRunners(ctx context.Context, enterprise string, groupID, runnerID int64) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v/runners/%v", enterprise, groupID, runnerID) + + req, err := s.client.NewRequest("PUT", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, req, nil) +} + +// RemoveRunnerGroupRunners removes a self-hosted runner from a group configured in an enterprise. +// The runner is then returned to the default group. +// +// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#remove-a-self-hosted-runner-from-a-group-for-an-enterprise +func (s *EnterpriseService) RemoveRunnerGroupRunners(ctx context.Context, enterprise string, groupID, runnerID int64) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v/runners/%v", enterprise, groupID, runnerID) + + req, err := s.client.NewRequest("DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, req, nil) +} diff --git a/github/enterprise_actions_runner_groups_test.go b/github/enterprise_actions_runner_groups_test.go new file mode 100644 index 00000000000..36036e419c2 --- /dev/null +++ b/github/enterprise_actions_runner_groups_test.go @@ -0,0 +1,666 @@ +// Copyright 2023 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" + "net/http" + "testing" + + "github.com/google/go-cmp/cmp" +) + +func TestEnterpriseService_ListRunnerGroups(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/enterprises/o/actions/runner-groups", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + testFormValues(t, r, values{"per_page": "2", "page": "2"}) + fmt.Fprint(w, `{"total_count":3,"runner_groups":[{"id":1,"name":"Default","visibility":"all","default":true,"runners_url":"https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/1/runners","inherited":false,"allows_public_repositories":true,"restricted_to_workflows":true,"selected_workflows":["a","b"]},{"id":2,"name":"octo-runner-group","visibility":"selected","default":false,"selected_organizations_url":"https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/organizations","runners_url":"https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/runners","inherited":true,"allows_public_repositories":true,"restricted_to_workflows":false,"selected_workflows":[]},{"id":3,"name":"expensive-hardware","visibility":"private","default":false,"runners_url":"https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/3/runners","inherited":false,"allows_public_repositories":true,"restricted_to_workflows":false,"selected_workflows":[]}]}`) + }) + + opts := &ListEnterpriseRunnerGroupOptions{ListOptions: ListOptions{Page: 2, PerPage: 2}} + ctx := context.Background() + groups, _, err := client.Enterprise.ListRunnerGroups(ctx, "o", opts) + if err != nil { + t.Errorf("Enterprise.ListRunnerGroups returned error: %v", err) + } + + want := &EnterpriseRunnerGroups{ + TotalCount: Int(3), + RunnerGroups: []*EnterpriseRunnerGroup{ + {ID: Int64(1), Name: String("Default"), Visibility: String("all"), Default: Bool(true), RunnersURL: String("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/1/runners"), Inherited: Bool(false), AllowsPublicRepositories: Bool(true), RestrictedToWorkflows: Bool(true), SelectedWorkflows: []string{"a", "b"}}, + {ID: Int64(2), Name: String("octo-runner-group"), Visibility: String("selected"), Default: Bool(false), SelectedOrganizationsURL: String("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/organizations"), RunnersURL: String("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/runners"), Inherited: Bool(true), AllowsPublicRepositories: Bool(true), RestrictedToWorkflows: Bool(false), SelectedWorkflows: []string{}}, + {ID: Int64(3), Name: String("expensive-hardware"), Visibility: String("private"), Default: Bool(false), RunnersURL: String("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/3/runners"), Inherited: Bool(false), AllowsPublicRepositories: Bool(true), RestrictedToWorkflows: Bool(false), SelectedWorkflows: []string{}}, + }, + } + if !cmp.Equal(groups, want) { + t.Errorf("Enterprise.ListRunnerGroups returned %+v, want %+v", groups, want) + } + + const methodName = "ListRunnerGroups" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Enterprise.ListRunnerGroups(ctx, "\n", opts) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Enterprise.ListRunnerGroups(ctx, "o", opts) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestEnterpriseService_ListRunnerGroupsVisibleToOrganization(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/enterprises/o/actions/runner-groups", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + testFormValues(t, r, values{"per_page": "2", "page": "2", "visible_to_organization": "github"}) + fmt.Fprint(w, `{"total_count":3,"runner_groups":[{"id":1,"name":"Default","visibility":"all","default":true,"runners_url":"https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/1/runners","inherited":false,"allows_public_repositories":true,"restricted_to_workflows":false,"selected_workflows":[]},{"id":2,"name":"octo-runner-group","visibility":"selected","default":false,"selected_organizations_url":"https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/organizations","runners_url":"https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/runners","inherited":true,"allows_public_repositories":true,"restricted_to_workflows":false,"selected_workflows":[]},{"id":3,"name":"expensive-hardware","visibility":"private","default":false,"runners_url":"https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/3/runners","inherited":false,"allows_public_repositories":true,"restricted_to_workflows":false,"selected_workflows":[]}]}`) + }) + + opts := &ListEnterpriseRunnerGroupOptions{ListOptions: ListOptions{Page: 2, PerPage: 2}, VisibleToOrganization: "github"} + ctx := context.Background() + groups, _, err := client.Enterprise.ListRunnerGroups(ctx, "o", opts) + if err != nil { + t.Errorf("Enterprise.ListRunnerGroups returned error: %v", err) + } + + want := &EnterpriseRunnerGroups{ + TotalCount: Int(3), + RunnerGroups: []*EnterpriseRunnerGroup{ + {ID: Int64(1), Name: String("Default"), Visibility: String("all"), Default: Bool(true), RunnersURL: String("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/1/runners"), Inherited: Bool(false), AllowsPublicRepositories: Bool(true), RestrictedToWorkflows: Bool(false), SelectedWorkflows: []string{}}, + {ID: Int64(2), Name: String("octo-runner-group"), Visibility: String("selected"), Default: Bool(false), SelectedOrganizationsURL: String("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/organizations"), RunnersURL: String("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/runners"), Inherited: Bool(true), AllowsPublicRepositories: Bool(true), RestrictedToWorkflows: Bool(false), SelectedWorkflows: []string{}}, + {ID: Int64(3), Name: String("expensive-hardware"), Visibility: String("private"), Default: Bool(false), RunnersURL: String("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/3/runners"), Inherited: Bool(false), AllowsPublicRepositories: Bool(true), RestrictedToWorkflows: Bool(false), SelectedWorkflows: []string{}}, + }, + } + if !cmp.Equal(groups, want) { + t.Errorf("Enterprise.ListRunnerGroups returned %+v, want %+v", groups, want) + } + + const methodName = "ListRunnerGroups" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Enterprise.ListRunnerGroups(ctx, "\n", opts) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Enterprise.ListRunnerGroups(ctx, "o", opts) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestEnterpriseService_GetRunnerGroup(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/enterprises/o/actions/runner-groups/2", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + fmt.Fprint(w, `{"id":2,"name":"octo-runner-group","visibility":"selected","default":false,"selected_organizations_url":"https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/organizations","runners_url":"https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/runners","inherited":false,"allows_public_repositories":true,"restricted_to_workflows":false,"selected_workflows":[]}`) + }) + + ctx := context.Background() + group, _, err := client.Enterprise.GetEnterpriseRunnerGroup(ctx, "o", 2) + if err != nil { + t.Errorf("Enterprise.GetRunnerGroup returned error: %v", err) + } + + want := &EnterpriseRunnerGroup{ + ID: Int64(2), + Name: String("octo-runner-group"), + Visibility: String("selected"), + Default: Bool(false), + SelectedOrganizationsURL: String("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/organizations"), + RunnersURL: String("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/runners"), + Inherited: Bool(false), + AllowsPublicRepositories: Bool(true), + RestrictedToWorkflows: Bool(false), + SelectedWorkflows: []string{}, + } + + if !cmp.Equal(group, want) { + t.Errorf("Enterprise.GetRunnerGroup returned %+v, want %+v", group, want) + } + + const methodName = "GetRunnerGroup" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Enterprise.GetEnterpriseRunnerGroup(ctx, "\n", 2) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Enterprise.GetEnterpriseRunnerGroup(ctx, "o", 2) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestEnterpriseService_DeleteRunnerGroup(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/enterprises/o/actions/runner-groups/2", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "DELETE") + }) + + ctx := context.Background() + _, err := client.Enterprise.DeleteEnterpriseRunnerGroup(ctx, "o", 2) + if err != nil { + t.Errorf("Enterprise.DeleteRunnerGroup returned error: %v", err) + } + + const methodName = "DeleteRunnerGroup" + testBadOptions(t, methodName, func() (err error) { + _, err = client.Enterprise.DeleteEnterpriseRunnerGroup(ctx, "\n", 2) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + return client.Enterprise.DeleteEnterpriseRunnerGroup(ctx, "o", 2) + }) +} + +func TestEnterpriseService_CreateRunnerGroup(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/enterprises/o/actions/runner-groups", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "POST") + fmt.Fprint(w, `{"id":2,"name":"octo-runner-group","visibility":"selected","default":false,"selected_organizations_url":"https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/organizations","runners_url":"https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/runners","inherited":false,"allows_public_repositories":true,"restricted_to_workflows":false,"selected_workflows":[]}`) + }) + + ctx := context.Background() + req := CreateEnterpriseRunnerGroupRequest{ + Name: String("octo-runner-group"), + Visibility: String("selected"), + AllowsPublicRepositories: Bool(true), + RestrictedToWorkflows: Bool(false), + SelectedWorkflows: []string{}, + } + group, _, err := client.Enterprise.CreateEnterpriseRunnerGroup(ctx, "o", req) + if err != nil { + t.Errorf("Enterprise.CreateRunnerGroup returned error: %v", err) + } + + want := &EnterpriseRunnerGroup{ + ID: Int64(2), + Name: String("octo-runner-group"), + Visibility: String("selected"), + Default: Bool(false), + SelectedOrganizationsURL: String("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/organizations"), + RunnersURL: String("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/runners"), + Inherited: Bool(false), + AllowsPublicRepositories: Bool(true), + RestrictedToWorkflows: Bool(false), + SelectedWorkflows: []string{}, + } + + if !cmp.Equal(group, want) { + t.Errorf("Enterprise.CreateRunnerGroup returned %+v, want %+v", group, want) + } + + const methodName = "CreateRunnerGroup" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Enterprise.CreateEnterpriseRunnerGroup(ctx, "\n", req) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Enterprise.CreateEnterpriseRunnerGroup(ctx, "o", req) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestEnterpriseService_UpdateRunnerGroup(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/enterprises/o/actions/runner-groups/2", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "PATCH") + fmt.Fprint(w, `{"id":2,"name":"octo-runner-group","visibility":"selected","default":false,"selected_organizations_url":"https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/organizations","runners_url":"https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/runners","inherited":false,"allows_public_repositories":true,"restricted_to_workflows":false,"selected_workflows":[]}`) + }) + + ctx := context.Background() + req := UpdateEnterpriseRunnerGroupRequest{ + Name: String("octo-runner-group"), + Visibility: String("selected"), + AllowsPublicRepositories: Bool(true), + RestrictedToWorkflows: Bool(false), + SelectedWorkflows: []string{}, + } + group, _, err := client.Enterprise.UpdateEnterpriseRunnerGroup(ctx, "o", 2, req) + if err != nil { + t.Errorf("Enterprise.UpdateRunnerGroup returned error: %v", err) + } + + want := &EnterpriseRunnerGroup{ + ID: Int64(2), + Name: String("octo-runner-group"), + Visibility: String("selected"), + Default: Bool(false), + SelectedOrganizationsURL: String("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/organizations"), + RunnersURL: String("https://api.github.com/enterprises/octo-enterprise/actions/runner_groups/2/runners"), + Inherited: Bool(false), + AllowsPublicRepositories: Bool(true), + RestrictedToWorkflows: Bool(false), + SelectedWorkflows: []string{}, + } + + if !cmp.Equal(group, want) { + t.Errorf("Enterprise.UpdateRunnerGroup returned %+v, want %+v", group, want) + } + + const methodName = "UpdateRunnerGroup" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Enterprise.UpdateEnterpriseRunnerGroup(ctx, "\n", 2, req) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Enterprise.UpdateEnterpriseRunnerGroup(ctx, "o", 2, req) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestEnterpriseService_ListOrganizationAccessRunnerGroup(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/enterprises/o/actions/runner-groups/2/organizations", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + testFormValues(t, r, values{"per_page": "1", "page": "1"}) + fmt.Fprint(w, `{"total_count": 1, "organizations": [{"id": 43, "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5", "name": "Hello-World", "login": "octocat"}]}`) + }) + + ctx := context.Background() + opts := &ListOptions{Page: 1, PerPage: 1} + groups, _, err := client.Enterprise.ListOrganizationAccessRunnerGroup(ctx, "o", 2, opts) + if err != nil { + t.Errorf("Enterprise.ListOrganizationAccessRunnerGroup returned error: %v", err) + } + + want := &ListOrganizations{ + TotalCount: Int(1), + Organizations: []*Organization{ + {ID: Int64(43), NodeID: String("MDEwOlJlcG9zaXRvcnkxMjk2MjY5"), Name: String("Hello-World"), Login: String("octocat")}, + }, + } + if !cmp.Equal(groups, want) { + t.Errorf("Enterprise.ListOrganizationAccessRunnerGroup returned %+v, want %+v", groups, want) + } + + const methodName = "ListOrganizationAccessRunnerGroup" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Enterprise.ListOrganizationAccessRunnerGroup(ctx, "\n", 2, opts) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Enterprise.ListOrganizationAccessRunnerGroup(ctx, "o", 2, opts) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestEnterpriseService_SetOrganizationAccessRunnerGroup(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/enterprises/o/actions/runner-groups/2/organizations", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "PUT") + }) + + req := SetOrgAccessRunnerGroupRequest{ + SelectedOrganizationIDs: []int64{ + 1, + 2, + }, + } + + ctx := context.Background() + _, err := client.Enterprise.SetOrganizationAccessRunnerGroup(ctx, "o", 2, req) + if err != nil { + t.Errorf("Enterprise.SetOrganizationAccessRunnerGroup returned error: %v", err) + } + + const methodName = "SetRepositoryAccessRunnerGroup" + testBadOptions(t, methodName, func() (err error) { + _, err = client.Enterprise.SetOrganizationAccessRunnerGroup(ctx, "\n", 2, req) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + return client.Enterprise.SetOrganizationAccessRunnerGroup(ctx, "o", 2, req) + }) +} + +func TestEnterpriseService_AddOrganizationAccessRunnerGroup(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/enterprises/o/actions/runner-groups/2/organizations/42", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "PUT") + }) + + ctx := context.Background() + _, err := client.Enterprise.AddOrganizationAccessRunnerGroup(ctx, "o", 2, 42) + if err != nil { + t.Errorf("Enterprise.AddOrganizationAccessRunnerGroup returned error: %v", err) + } + + const methodName = "AddOrganizationAccessRunnerGroup" + testBadOptions(t, methodName, func() (err error) { + _, err = client.Enterprise.AddOrganizationAccessRunnerGroup(ctx, "\n", 2, 42) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + return client.Enterprise.AddOrganizationAccessRunnerGroup(ctx, "o", 2, 42) + }) +} + +func TestEnterpriseService_RemoveOrganizationAccessRunnerGroup(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/enterprises/o/actions/runner-groups/2/organizations/42", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "DELETE") + }) + + ctx := context.Background() + _, err := client.Enterprise.RemoveOrganizationAccessRunnerGroup(ctx, "o", 2, 42) + if err != nil { + t.Errorf("Enterprise.RemoveOrganizationAccessRunnerGroup returned error: %v", err) + } + + const methodName = "RemoveOrganizationAccessRunnerGroup" + testBadOptions(t, methodName, func() (err error) { + _, err = client.Enterprise.RemoveOrganizationAccessRunnerGroup(ctx, "\n", 2, 42) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + return client.Enterprise.RemoveOrganizationAccessRunnerGroup(ctx, "o", 2, 42) + }) +} + +func TestEnterpriseService_ListEnterpriseRunnerGroupRunners(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/enterprises/o/actions/runner-groups/2/runners", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + testFormValues(t, r, values{"per_page": "2", "page": "2"}) + fmt.Fprint(w, `{"total_count":2,"runners":[{"id":23,"name":"MBP","os":"macos","status":"online"},{"id":24,"name":"iMac","os":"macos","status":"offline"}]}`) + }) + + opts := &ListOptions{Page: 2, PerPage: 2} + ctx := context.Background() + runners, _, err := client.Enterprise.ListRunnerGroupRunners(ctx, "o", 2, opts) + if err != nil { + t.Errorf("Enterprise.ListEnterpriseRunnerGroupRunners returned error: %v", err) + } + + want := &Runners{ + TotalCount: 2, + Runners: []*Runner{ + {ID: Int64(23), Name: String("MBP"), OS: String("macos"), Status: String("online")}, + {ID: Int64(24), Name: String("iMac"), OS: String("macos"), Status: String("offline")}, + }, + } + if !cmp.Equal(runners, want) { + t.Errorf("Enterprise.ListEnterpriseRunnerGroupRunners returned %+v, want %+v", runners, want) + } + + const methodName = "ListEnterpriseRunnerGroupRunners" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Enterprise.ListRunnerGroupRunners(ctx, "\n", 2, opts) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Enterprise.ListRunnerGroupRunners(ctx, "o", 2, opts) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestEnterpriseService_SetEnterpriseRunnerGroupRunners(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/enterprises/o/actions/runner-groups/2/runners", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "PUT") + }) + + req := SetRunnerGroupRunnersRequest{ + Runners: []int64{ + 1, + 2, + }, + } + + ctx := context.Background() + _, err := client.Enterprise.SetRunnerGroupRunners(ctx, "o", 2, req) + if err != nil { + t.Errorf("Enterprise.SetEnterpriseRunnerGroupRunners returned error: %v", err) + } + + const methodName = "SetEnterpriseRunnerGroupRunners" + testBadOptions(t, methodName, func() (err error) { + _, err = client.Enterprise.SetRunnerGroupRunners(ctx, "\n", 2, req) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + return client.Enterprise.SetRunnerGroupRunners(ctx, "o", 2, req) + }) +} + +func TestEnterpriseService_AddEnterpriseRunnerGroupRunners(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/enterprises/o/actions/runner-groups/2/runners/42", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "PUT") + }) + + ctx := context.Background() + _, err := client.Enterprise.AddRunnerGroupRunners(ctx, "o", 2, 42) + if err != nil { + t.Errorf("Enterprise.AddEnterpriseRunnerGroupRunners returned error: %v", err) + } + + const methodName = "AddEnterpriseRunnerGroupRunners" + testBadOptions(t, methodName, func() (err error) { + _, err = client.Enterprise.AddRunnerGroupRunners(ctx, "\n", 2, 42) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + return client.Enterprise.AddRunnerGroupRunners(ctx, "o", 2, 42) + }) +} + +func TestEnterpriseService_RemoveEnterpriseRunnerGroupRunners(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/enterprises/o/actions/runner-groups/2/runners/42", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "DELETE") + }) + + ctx := context.Background() + _, err := client.Enterprise.RemoveRunnerGroupRunners(ctx, "o", 2, 42) + if err != nil { + t.Errorf("Enterprise.RemoveEnterpriseRunnerGroupRunners returned error: %v", err) + } + + const methodName = "RemoveEnterpriseRunnerGroupRunners" + testBadOptions(t, methodName, func() (err error) { + _, err = client.Enterprise.RemoveRunnerGroupRunners(ctx, "\n", 2, 42) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + return client.Enterprise.RemoveRunnerGroupRunners(ctx, "o", 2, 42) + }) +} + +func TestEnterpriseRunnerGroup_Marshal(t *testing.T) { + testJSONMarshal(t, &EnterpriseRunnerGroup{}, "{}") + + u := &EnterpriseRunnerGroup{ + ID: Int64(1), + Name: String("n"), + Visibility: String("v"), + Default: Bool(true), + SelectedOrganizationsURL: String("s"), + RunnersURL: String("r"), + Inherited: Bool(true), + AllowsPublicRepositories: Bool(true), + RestrictedToWorkflows: Bool(false), + SelectedWorkflows: []string{}, + } + + want := `{ + "id": 1, + "name": "n", + "visibility": "v", + "default": true, + "selected_organizations_url": "s", + "runners_url": "r", + "inherited": true, + "allows_public_repositories": true, + "restricted_to_workflows": false, + "selected_workflows": [] + }` + + testJSONMarshal(t, u, want) +} + +func TestEnterpriseRunnerGroups_Marshal(t *testing.T) { + testJSONMarshal(t, &EnterpriseRunnerGroups{}, "{}") + + u := &EnterpriseRunnerGroups{ + TotalCount: Int(1), + RunnerGroups: []*EnterpriseRunnerGroup{ + { + ID: Int64(1), + Name: String("n"), + Visibility: String("v"), + Default: Bool(true), + SelectedOrganizationsURL: String("s"), + RunnersURL: String("r"), + Inherited: Bool(true), + AllowsPublicRepositories: Bool(true), + RestrictedToWorkflows: Bool(false), + SelectedWorkflows: []string{}, + }, + }, + } + + want := `{ + "total_count": 1, + "runner_groups": [{ + "id": 1, + "name": "n", + "visibility": "v", + "default": true, + "selected_organizations_url": "s", + "runners_url": "r", + "inherited": true, + "allows_public_repositories": true, + "restricted_to_workflows": false, + "selected_workflows": [] + }] + }` + + testJSONMarshal(t, u, want) +} + +func TestCreateEnterpriseRunnerGroupRequest_Marshal(t *testing.T) { + testJSONMarshal(t, &CreateEnterpriseRunnerGroupRequest{}, "{}") + + u := &CreateEnterpriseRunnerGroupRequest{ + Name: String("n"), + Visibility: String("v"), + SelectedOrganizationIDs: []int64{1}, + Runners: []int64{1}, + AllowsPublicRepositories: Bool(true), + RestrictedToWorkflows: Bool(true), + SelectedWorkflows: []string{"a", "b"}, + } + + want := `{ + "name": "n", + "visibility": "v", + "selected_organization_ids": [1], + "runners": [1], + "allows_public_repositories": true, + "restricted_to_workflows": true, + "selected_workflows": ["a","b"] + }` + + testJSONMarshal(t, u, want) +} + +func TestUpdateEnterpriseRunnerGroupRequest_Marshal(t *testing.T) { + testJSONMarshal(t, &UpdateEnterpriseRunnerGroupRequest{}, "{}") + + u := &UpdateEnterpriseRunnerGroupRequest{ + Name: String("n"), + Visibility: String("v"), + AllowsPublicRepositories: Bool(true), + RestrictedToWorkflows: Bool(false), + SelectedWorkflows: []string{}, + } + + want := `{ + "name": "n", + "visibility": "v", + "allows_public_repositories": true, + "restricted_to_workflows": false, + "selected_workflows": [] + }` + + testJSONMarshal(t, u, want) +} + +func TestSetOrgAccessRunnerGroupRequest_Marshal(t *testing.T) { + testJSONMarshal(t, &SetOrgAccessRunnerGroupRequest{}, "{}") + + u := &SetOrgAccessRunnerGroupRequest{ + SelectedOrganizationIDs: []int64{1}, + } + + want := `{ + "selected_organization_ids": [1] + }` + + testJSONMarshal(t, u, want) +} diff --git a/github/github-accessors.go b/github/github-accessors.go index 560e0892eda..a685a3efce5 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -4574,6 +4574,38 @@ func (c *CreateCodespaceOptions) GetWorkingDirectory() string { return *c.WorkingDirectory } +// GetAllowsPublicRepositories returns the AllowsPublicRepositories field if it's non-nil, zero value otherwise. +func (c *CreateEnterpriseRunnerGroupRequest) GetAllowsPublicRepositories() bool { + if c == nil || c.AllowsPublicRepositories == nil { + return false + } + return *c.AllowsPublicRepositories +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (c *CreateEnterpriseRunnerGroupRequest) GetName() string { + if c == nil || c.Name == nil { + return "" + } + return *c.Name +} + +// GetRestrictedToWorkflows returns the RestrictedToWorkflows field if it's non-nil, zero value otherwise. +func (c *CreateEnterpriseRunnerGroupRequest) GetRestrictedToWorkflows() bool { + if c == nil || c.RestrictedToWorkflows == nil { + return false + } + return *c.RestrictedToWorkflows +} + +// GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. +func (c *CreateEnterpriseRunnerGroupRequest) GetVisibility() string { + if c == nil || c.Visibility == nil { + return "" + } + return *c.Visibility +} + // GetDescription returns the Description field if it's non-nil, zero value otherwise. func (c *CreateEvent) GetDescription() string { if c == nil || c.Description == nil { @@ -6630,6 +6662,94 @@ func (e *Enterprise) GetWebsiteURL() string { return *e.WebsiteURL } +// GetAllowsPublicRepositories returns the AllowsPublicRepositories field if it's non-nil, zero value otherwise. +func (e *EnterpriseRunnerGroup) GetAllowsPublicRepositories() bool { + if e == nil || e.AllowsPublicRepositories == nil { + return false + } + return *e.AllowsPublicRepositories +} + +// GetDefault returns the Default field if it's non-nil, zero value otherwise. +func (e *EnterpriseRunnerGroup) GetDefault() bool { + if e == nil || e.Default == nil { + return false + } + return *e.Default +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (e *EnterpriseRunnerGroup) GetID() int64 { + if e == nil || e.ID == nil { + return 0 + } + return *e.ID +} + +// GetInherited returns the Inherited field if it's non-nil, zero value otherwise. +func (e *EnterpriseRunnerGroup) GetInherited() bool { + if e == nil || e.Inherited == nil { + return false + } + return *e.Inherited +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (e *EnterpriseRunnerGroup) GetName() string { + if e == nil || e.Name == nil { + return "" + } + return *e.Name +} + +// GetRestrictedToWorkflows returns the RestrictedToWorkflows field if it's non-nil, zero value otherwise. +func (e *EnterpriseRunnerGroup) GetRestrictedToWorkflows() bool { + if e == nil || e.RestrictedToWorkflows == nil { + return false + } + return *e.RestrictedToWorkflows +} + +// GetRunnersURL returns the RunnersURL field if it's non-nil, zero value otherwise. +func (e *EnterpriseRunnerGroup) GetRunnersURL() string { + if e == nil || e.RunnersURL == nil { + return "" + } + return *e.RunnersURL +} + +// GetSelectedOrganizationsURL returns the SelectedOrganizationsURL field if it's non-nil, zero value otherwise. +func (e *EnterpriseRunnerGroup) GetSelectedOrganizationsURL() string { + if e == nil || e.SelectedOrganizationsURL == nil { + return "" + } + return *e.SelectedOrganizationsURL +} + +// GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. +func (e *EnterpriseRunnerGroup) GetVisibility() string { + if e == nil || e.Visibility == nil { + return "" + } + return *e.Visibility +} + +// GetWorkflowRestrictionsReadOnly returns the WorkflowRestrictionsReadOnly field if it's non-nil, zero value otherwise. +func (e *EnterpriseRunnerGroup) GetWorkflowRestrictionsReadOnly() bool { + if e == nil || e.WorkflowRestrictionsReadOnly == nil { + return false + } + return *e.WorkflowRestrictionsReadOnly +} + +// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. +func (e *EnterpriseRunnerGroups) GetTotalCount() int { + if e == nil || e.TotalCount == nil { + return 0 + } + return *e.TotalCount +} + // GetAdvancedSecurityEnabledForNewRepositories returns the AdvancedSecurityEnabledForNewRepositories field if it's non-nil, zero value otherwise. func (e *EnterpriseSecurityAnalysisSettings) GetAdvancedSecurityEnabledForNewRepositories() bool { if e == nil || e.AdvancedSecurityEnabledForNewRepositories == nil { @@ -10398,6 +10518,14 @@ func (l *ListExternalGroupsOptions) GetDisplayName() string { return *l.DisplayName } +// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. +func (l *ListOrganizations) GetTotalCount() int { + if l == nil || l.TotalCount == nil { + return 0 + } + return *l.TotalCount +} + // GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. func (l *ListRepositories) GetTotalCount() int { if l == nil || l.TotalCount == nil { @@ -22822,6 +22950,38 @@ func (u *UpdateDefaultSetupConfigurationResponse) GetRunURL() string { return *u.RunURL } +// GetAllowsPublicRepositories returns the AllowsPublicRepositories field if it's non-nil, zero value otherwise. +func (u *UpdateEnterpriseRunnerGroupRequest) GetAllowsPublicRepositories() bool { + if u == nil || u.AllowsPublicRepositories == nil { + return false + } + return *u.AllowsPublicRepositories +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (u *UpdateEnterpriseRunnerGroupRequest) GetName() string { + if u == nil || u.Name == nil { + return "" + } + return *u.Name +} + +// GetRestrictedToWorkflows returns the RestrictedToWorkflows field if it's non-nil, zero value otherwise. +func (u *UpdateEnterpriseRunnerGroupRequest) GetRestrictedToWorkflows() bool { + if u == nil || u.RestrictedToWorkflows == nil { + return false + } + return *u.RestrictedToWorkflows +} + +// GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. +func (u *UpdateEnterpriseRunnerGroupRequest) GetVisibility() string { + if u == nil || u.Visibility == nil { + return "" + } + return *u.Visibility +} + // GetAllowsPublicRepositories returns the AllowsPublicRepositories field if it's non-nil, zero value otherwise. func (u *UpdateRunnerGroupRequest) GetAllowsPublicRepositories() bool { if u == nil || u.AllowsPublicRepositories == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 262cdd5a06b..10ef017b3cb 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -5400,6 +5400,46 @@ func TestCreateCodespaceOptions_GetWorkingDirectory(tt *testing.T) { c.GetWorkingDirectory() } +func TestCreateEnterpriseRunnerGroupRequest_GetAllowsPublicRepositories(tt *testing.T) { + var zeroValue bool + c := &CreateEnterpriseRunnerGroupRequest{AllowsPublicRepositories: &zeroValue} + c.GetAllowsPublicRepositories() + c = &CreateEnterpriseRunnerGroupRequest{} + c.GetAllowsPublicRepositories() + c = nil + c.GetAllowsPublicRepositories() +} + +func TestCreateEnterpriseRunnerGroupRequest_GetName(tt *testing.T) { + var zeroValue string + c := &CreateEnterpriseRunnerGroupRequest{Name: &zeroValue} + c.GetName() + c = &CreateEnterpriseRunnerGroupRequest{} + c.GetName() + c = nil + c.GetName() +} + +func TestCreateEnterpriseRunnerGroupRequest_GetRestrictedToWorkflows(tt *testing.T) { + var zeroValue bool + c := &CreateEnterpriseRunnerGroupRequest{RestrictedToWorkflows: &zeroValue} + c.GetRestrictedToWorkflows() + c = &CreateEnterpriseRunnerGroupRequest{} + c.GetRestrictedToWorkflows() + c = nil + c.GetRestrictedToWorkflows() +} + +func TestCreateEnterpriseRunnerGroupRequest_GetVisibility(tt *testing.T) { + var zeroValue string + c := &CreateEnterpriseRunnerGroupRequest{Visibility: &zeroValue} + c.GetVisibility() + c = &CreateEnterpriseRunnerGroupRequest{} + c.GetVisibility() + c = nil + c.GetVisibility() +} + func TestCreateEvent_GetDescription(tt *testing.T) { var zeroValue string c := &CreateEvent{Description: &zeroValue} @@ -7763,6 +7803,116 @@ func TestEnterprise_GetWebsiteURL(tt *testing.T) { e.GetWebsiteURL() } +func TestEnterpriseRunnerGroup_GetAllowsPublicRepositories(tt *testing.T) { + var zeroValue bool + e := &EnterpriseRunnerGroup{AllowsPublicRepositories: &zeroValue} + e.GetAllowsPublicRepositories() + e = &EnterpriseRunnerGroup{} + e.GetAllowsPublicRepositories() + e = nil + e.GetAllowsPublicRepositories() +} + +func TestEnterpriseRunnerGroup_GetDefault(tt *testing.T) { + var zeroValue bool + e := &EnterpriseRunnerGroup{Default: &zeroValue} + e.GetDefault() + e = &EnterpriseRunnerGroup{} + e.GetDefault() + e = nil + e.GetDefault() +} + +func TestEnterpriseRunnerGroup_GetID(tt *testing.T) { + var zeroValue int64 + e := &EnterpriseRunnerGroup{ID: &zeroValue} + e.GetID() + e = &EnterpriseRunnerGroup{} + e.GetID() + e = nil + e.GetID() +} + +func TestEnterpriseRunnerGroup_GetInherited(tt *testing.T) { + var zeroValue bool + e := &EnterpriseRunnerGroup{Inherited: &zeroValue} + e.GetInherited() + e = &EnterpriseRunnerGroup{} + e.GetInherited() + e = nil + e.GetInherited() +} + +func TestEnterpriseRunnerGroup_GetName(tt *testing.T) { + var zeroValue string + e := &EnterpriseRunnerGroup{Name: &zeroValue} + e.GetName() + e = &EnterpriseRunnerGroup{} + e.GetName() + e = nil + e.GetName() +} + +func TestEnterpriseRunnerGroup_GetRestrictedToWorkflows(tt *testing.T) { + var zeroValue bool + e := &EnterpriseRunnerGroup{RestrictedToWorkflows: &zeroValue} + e.GetRestrictedToWorkflows() + e = &EnterpriseRunnerGroup{} + e.GetRestrictedToWorkflows() + e = nil + e.GetRestrictedToWorkflows() +} + +func TestEnterpriseRunnerGroup_GetRunnersURL(tt *testing.T) { + var zeroValue string + e := &EnterpriseRunnerGroup{RunnersURL: &zeroValue} + e.GetRunnersURL() + e = &EnterpriseRunnerGroup{} + e.GetRunnersURL() + e = nil + e.GetRunnersURL() +} + +func TestEnterpriseRunnerGroup_GetSelectedOrganizationsURL(tt *testing.T) { + var zeroValue string + e := &EnterpriseRunnerGroup{SelectedOrganizationsURL: &zeroValue} + e.GetSelectedOrganizationsURL() + e = &EnterpriseRunnerGroup{} + e.GetSelectedOrganizationsURL() + e = nil + e.GetSelectedOrganizationsURL() +} + +func TestEnterpriseRunnerGroup_GetVisibility(tt *testing.T) { + var zeroValue string + e := &EnterpriseRunnerGroup{Visibility: &zeroValue} + e.GetVisibility() + e = &EnterpriseRunnerGroup{} + e.GetVisibility() + e = nil + e.GetVisibility() +} + +func TestEnterpriseRunnerGroup_GetWorkflowRestrictionsReadOnly(tt *testing.T) { + var zeroValue bool + e := &EnterpriseRunnerGroup{WorkflowRestrictionsReadOnly: &zeroValue} + e.GetWorkflowRestrictionsReadOnly() + e = &EnterpriseRunnerGroup{} + e.GetWorkflowRestrictionsReadOnly() + e = nil + e.GetWorkflowRestrictionsReadOnly() +} + +func TestEnterpriseRunnerGroups_GetTotalCount(tt *testing.T) { + var zeroValue int + e := &EnterpriseRunnerGroups{TotalCount: &zeroValue} + e.GetTotalCount() + e = &EnterpriseRunnerGroups{} + e.GetTotalCount() + e = nil + e.GetTotalCount() +} + func TestEnterpriseSecurityAnalysisSettings_GetAdvancedSecurityEnabledForNewRepositories(tt *testing.T) { var zeroValue bool e := &EnterpriseSecurityAnalysisSettings{AdvancedSecurityEnabledForNewRepositories: &zeroValue} @@ -12188,6 +12338,16 @@ func TestListExternalGroupsOptions_GetDisplayName(tt *testing.T) { l.GetDisplayName() } +func TestListOrganizations_GetTotalCount(tt *testing.T) { + var zeroValue int + l := &ListOrganizations{TotalCount: &zeroValue} + l.GetTotalCount() + l = &ListOrganizations{} + l.GetTotalCount() + l = nil + l.GetTotalCount() +} + func TestListRepositories_GetTotalCount(tt *testing.T) { var zeroValue int l := &ListRepositories{TotalCount: &zeroValue} @@ -26560,6 +26720,46 @@ func TestUpdateDefaultSetupConfigurationResponse_GetRunURL(tt *testing.T) { u.GetRunURL() } +func TestUpdateEnterpriseRunnerGroupRequest_GetAllowsPublicRepositories(tt *testing.T) { + var zeroValue bool + u := &UpdateEnterpriseRunnerGroupRequest{AllowsPublicRepositories: &zeroValue} + u.GetAllowsPublicRepositories() + u = &UpdateEnterpriseRunnerGroupRequest{} + u.GetAllowsPublicRepositories() + u = nil + u.GetAllowsPublicRepositories() +} + +func TestUpdateEnterpriseRunnerGroupRequest_GetName(tt *testing.T) { + var zeroValue string + u := &UpdateEnterpriseRunnerGroupRequest{Name: &zeroValue} + u.GetName() + u = &UpdateEnterpriseRunnerGroupRequest{} + u.GetName() + u = nil + u.GetName() +} + +func TestUpdateEnterpriseRunnerGroupRequest_GetRestrictedToWorkflows(tt *testing.T) { + var zeroValue bool + u := &UpdateEnterpriseRunnerGroupRequest{RestrictedToWorkflows: &zeroValue} + u.GetRestrictedToWorkflows() + u = &UpdateEnterpriseRunnerGroupRequest{} + u.GetRestrictedToWorkflows() + u = nil + u.GetRestrictedToWorkflows() +} + +func TestUpdateEnterpriseRunnerGroupRequest_GetVisibility(tt *testing.T) { + var zeroValue string + u := &UpdateEnterpriseRunnerGroupRequest{Visibility: &zeroValue} + u.GetVisibility() + u = &UpdateEnterpriseRunnerGroupRequest{} + u.GetVisibility() + u = nil + u.GetVisibility() +} + func TestUpdateRunnerGroupRequest_GetAllowsPublicRepositories(tt *testing.T) { var zeroValue bool u := &UpdateRunnerGroupRequest{AllowsPublicRepositories: &zeroValue} From 66b1147e57320137b57cbaf8034158ba0af47eeb Mon Sep 17 00:00:00 2001 From: Gabriel Date: Wed, 6 Sep 2023 18:50:07 +0300 Subject: [PATCH 015/145] Add GenerateEnterpriseJITConfig (#2890) --- github/enterprise_actions_runners.go | 20 ++++++++++ github/enterprise_actions_runners_test.go | 45 +++++++++++++++++++++++ 2 files changed, 65 insertions(+) diff --git a/github/enterprise_actions_runners.go b/github/enterprise_actions_runners.go index daafc5e6285..6fc30d50258 100644 --- a/github/enterprise_actions_runners.go +++ b/github/enterprise_actions_runners.go @@ -29,6 +29,26 @@ func (s *EnterpriseService) ListRunnerApplicationDownloads(ctx context.Context, return rads, resp, nil } +// GenerateEnterpriseJITConfig generates a just-in-time configuration for an enterprise. +// +// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runners?apiVersion=2022-11-28#create-configuration-for-a-just-in-time-runner-for-an-enterprise +func (s *EnterpriseService) GenerateEnterpriseJITConfig(ctx context.Context, enterprise string, request *GenerateJITConfigRequest) (*JITRunnerConfig, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/runners/generate-jitconfig", enterprise) + + req, err := s.client.NewRequest("POST", u, request) + if err != nil { + return nil, nil, err + } + + jitConfig := new(JITRunnerConfig) + resp, err := s.client.Do(ctx, req, jitConfig) + if err != nil { + return nil, resp, err + } + + return jitConfig, resp, nil +} + // CreateRegistrationToken creates a token that can be used to add a self-hosted runner. // // GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runners#create-a-registration-token-for-an-enterprise diff --git a/github/enterprise_actions_runners_test.go b/github/enterprise_actions_runners_test.go index b7c3f78b2d3..a1d3f17a895 100644 --- a/github/enterprise_actions_runners_test.go +++ b/github/enterprise_actions_runners_test.go @@ -7,6 +7,7 @@ package github import ( "context" + "encoding/json" "fmt" "net/http" "testing" @@ -15,6 +16,50 @@ import ( "github.com/google/go-cmp/cmp" ) +func TestEnterpriseService_GenerateEnterpriseJITConfig(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + input := &GenerateJITConfigRequest{Name: "test", RunnerGroupID: 1, Labels: []string{"one", "two"}} + + mux.HandleFunc("/enterprises/o/actions/runners/generate-jitconfig", func(w http.ResponseWriter, r *http.Request) { + v := new(GenerateJITConfigRequest) + json.NewDecoder(r.Body).Decode(v) + + testMethod(t, r, "POST") + if !cmp.Equal(v, input) { + t.Errorf("Request body = %+v, want %+v", v, input) + } + + fmt.Fprint(w, `{"encoded_jit_config":"foo"}`) + }) + + ctx := context.Background() + jitConfig, _, err := client.Enterprise.GenerateEnterpriseJITConfig(ctx, "o", input) + if err != nil { + t.Errorf("Enterprise.GenerateEnterpriseJITConfig returned error: %v", err) + } + + want := &JITRunnerConfig{EncodedJITConfig: String("foo")} + if !cmp.Equal(jitConfig, want) { + t.Errorf("Enterprise.GenerateEnterpriseJITConfig returned %+v, want %+v", jitConfig, want) + } + + const methodName = "GenerateEnterpriseJITConfig" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Enterprise.GenerateEnterpriseJITConfig(ctx, "\n", input) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Enterprise.GenerateEnterpriseJITConfig(ctx, "o", input) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + func TestEnterpriseService_CreateRegistrationToken(t *testing.T) { client, mux, _, teardown := setup() defer teardown() From fd33b81221685302178ba197dbabe71326ca9051 Mon Sep 17 00:00:00 2001 From: WillAbides <233500+WillAbides@users.noreply.github.com> Date: Fri, 8 Sep 2023 07:55:37 -0500 Subject: [PATCH 016/145] Fix linting (#2903) --- .github/workflows/linter.yml | 3 +- .golangci.yml | 49 +++++++------- example/basicauth/main.go | 2 +- example/commitpr/main.go | 2 +- example/tagprotection/main.go | 2 +- example/tokenauth/main.go | 2 +- github/actions_runners_test.go | 4 +- github/actions_secrets.go | 2 +- github/actions_workflow_runs_test.go | 2 +- github/actions_workflows_test.go | 4 +- github/activity_notifications_test.go | 2 +- github/activity_test.go | 2 +- github/activity_watching_test.go | 2 +- github/admin_orgs_test.go | 6 +- github/admin_test.go | 4 +- github/admin_users_test.go | 2 +- github/apps_test.go | 4 +- github/code-scanning_test.go | 6 +- github/enterprise_actions_runners_test.go | 5 +- ...erprise_code_security_and_analysis_test.go | 2 +- github/gists_comments_test.go | 4 +- github/gists_test.go | 4 +- github/git_blobs_test.go | 2 +- github/git_commits_test.go | 6 +- github/git_refs_test.go | 6 +- github/git_tags_test.go | 2 +- github/github.go | 12 ++-- github/github_test.go | 38 ++++++++--- github/interactions_orgs_test.go | 2 +- github/interactions_repos_test.go | 2 +- github/issue_import_test.go | 18 ++--- github/issues_assignees_test.go | 4 +- github/issues_comments_test.go | 4 +- github/issues_labels_test.go | 8 +-- github/issues_milestones_test.go | 4 +- github/issues_test.go | 4 +- github/migrations_source_import_test.go | 8 +-- github/migrations_test.go | 8 +-- github/migrations_user_test.go | 6 +- github/misc_test.go | 2 +- github/orgs_actions_allowed_test.go | 2 +- github/orgs_actions_permissions_test.go | 2 +- github/orgs_hooks_configuration_test.go | 2 +- github/orgs_hooks_test.go | 4 +- github/orgs_members_test.go | 6 +- github/orgs_personal_access_tokens_test.go | 2 +- github/orgs_projects_test.go | 2 +- github/orgs_test.go | 2 +- github/projects_test.go | 16 ++--- github/pulls_comments_test.go | 6 +- github/pulls_reviews_test.go | 8 +-- github/pulls_test.go | 5 +- github/reactions_test.go | 24 +++---- github/repos_actions_access_test.go | 2 +- github/repos_actions_allowed_test.go | 2 +- github/repos_actions_permissions_test.go | 2 +- github/repos_autolinks_test.go | 4 +- github/repos_collaborators_test.go | 4 +- github/repos_comments_test.go | 4 +- github/repos_commits_test.go | 6 +- github/repos_deployments_test.go | 4 +- github/repos_environments_test.go | 6 +- github/repos_hooks_configuration_test.go | 2 +- github/repos_hooks_test.go | 4 +- github/repos_keys_test.go | 2 +- github/repos_merging_test.go | 4 +- github/repos_pages_test.go | 8 +-- github/repos_prereceive_hooks_test.go | 2 +- github/repos_projects_test.go | 2 +- github/repos_releases.go | 4 +- github/repos_releases_test.go | 36 +++++++++- github/repos_statuses_test.go | 2 +- github/repos_tags_test.go | 2 +- github/repos_test.go | 37 ++++------- github/secret_scanning_test.go | 2 +- github/strings.go | 4 +- github/teams_discussion_comments_test.go | 4 +- github/teams_discussions_test.go | 8 +-- github/teams_members_test.go | 8 +-- github/teams_test.go | 18 ++--- github/users_administration_test.go | 2 +- github/users_emails_test.go | 6 +- github/users_gpg_keys_test.go | 2 +- github/users_keys_test.go | 2 +- github/users_projects_test.go | 2 +- github/users_ssh_signing_keys_test.go | 2 +- github/users_test.go | 2 +- scrape/apps_test.go | 4 +- scrape/forms_test.go | 10 ++- scrape/scrape_test.go | 16 +++-- test/fields/fields.go | 5 -- test/integration/authorizations_test.go | 66 ------------------- update-urls/activity-events_test.go | 5 +- update-urls/main.go | 12 ++-- update-urls/reactions_test.go | 5 +- 95 files changed, 323 insertions(+), 333 deletions(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 1430245422d..4f3cdf8e4df 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -9,7 +9,6 @@ jobs: lint: strategy: matrix: - go-version: [1.x] platform: [ubuntu-latest] # golangci-lint will only process a single module, so we need to call it @@ -17,7 +16,7 @@ jobs: # since that needs libsodium to run. working-directory: - "" - # - example # Fails with "no go files to analyze" + - example - scrape - update-urls runs-on: ${{ matrix.platform }} diff --git a/.golangci.yml b/.golangci.yml index 4d3fc17813b..3e286f045f4 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,34 +1,39 @@ +run: + build-tags: + - integration linters: - # TODO: fix errors so that all of the linters below pass. - # The linters that are commented out, as well as those explicitly disabled, - # are currently failing. We should fix those failures or define exclusion - # rules, and then enable those linters. enable: - dogsled - dupl - gofmt - goimports - # - gosec + - gosec - misspell - nakedret - stylecheck - # - unconvert - # - unparam + - unconvert + - unparam - whitespace - disable: - - errcheck - - gosimple - - staticcheck - - ineffassign - - unused +linters-settings: + gosec: + excludes: + # performance issue: see https://github.com/golangci/golangci-lint/issues/4039 + # and https://github.com/securego/gosec/issues/1007 + - G602 issues: - exclude: - - composites exclude-rules: - - linters: - - dogsled - text: "declaration has 3 blank identifiers" - path: _test\.go - - linters: - - dupl - path: _test\.go + - linters: + - dupl + - unparam + - gosec + - dogsled + path: _test\.go + + # We need to pass nil Context in order to test DoBare erroring on nil ctx. + - linters: [ staticcheck ] + text: 'SA1012: do not pass a nil Context' + path: _test\.go + + # We need to use sha1 for validating signatures + - linters: [ gosec ] + text: 'G505: Blocklisted import crypto/sha1: weak cryptographic primitive' diff --git a/example/basicauth/main.go b/example/basicauth/main.go index 6cda7d6eb85..e677aa94a42 100644 --- a/example/basicauth/main.go +++ b/example/basicauth/main.go @@ -32,7 +32,7 @@ func main() { username, _ := r.ReadString('\n') fmt.Print("GitHub Password: ") - bytePassword, _ := term.ReadPassword(int(syscall.Stdin)) + bytePassword, _ := term.ReadPassword(syscall.Stdin) password := string(bytePassword) tp := github.BasicAuthTransport{ diff --git a/example/commitpr/main.go b/example/commitpr/main.go index 1a94e1489d5..328afda5469 100644 --- a/example/commitpr/main.go +++ b/example/commitpr/main.go @@ -133,7 +133,7 @@ func pushCommit(ref *github.Reference, tree *github.Tree) (err error) { // Create the commit using the tree. date := time.Now() - author := &github.CommitAuthor{Date: &github.Timestamp{date}, Name: authorName, Email: authorEmail} + author := &github.CommitAuthor{Date: &github.Timestamp{Time: date}, Name: authorName, Email: authorEmail} commit := &github.Commit{Author: author, Message: commitMessage, Tree: tree, Parents: []*github.Commit{parent.Commit}} newCommit, _, err := client.Git.CreateCommit(ctx, *sourceOwner, *sourceRepo, commit) if err != nil { diff --git a/example/tagprotection/main.go b/example/tagprotection/main.go index 056ffae4ea9..3b9b723dd0f 100644 --- a/example/tagprotection/main.go +++ b/example/tagprotection/main.go @@ -39,7 +39,7 @@ func main() { pattern = strings.TrimSpace(pattern) fmt.Print("GitHub Token: ") - byteToken, _ := term.ReadPassword(int(syscall.Stdin)) + byteToken, _ := term.ReadPassword(syscall.Stdin) println() token := string(byteToken) diff --git a/example/tokenauth/main.go b/example/tokenauth/main.go index 6fe51804f2e..91ad5e5067a 100644 --- a/example/tokenauth/main.go +++ b/example/tokenauth/main.go @@ -21,7 +21,7 @@ import ( func main() { fmt.Print("GitHub Token: ") - byteToken, _ := term.ReadPassword(int(syscall.Stdin)) + byteToken, _ := term.ReadPassword(syscall.Stdin) println() token := string(byteToken) diff --git a/github/actions_runners_test.go b/github/actions_runners_test.go index 8063152f93a..d059d6e82ac 100644 --- a/github/actions_runners_test.go +++ b/github/actions_runners_test.go @@ -65,7 +65,7 @@ func TestActionsService_GenerateOrgJITConfig(t *testing.T) { mux.HandleFunc("/orgs/o/actions/runners/generate-jitconfig", func(w http.ResponseWriter, r *http.Request) { v := new(GenerateJITConfigRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") if !cmp.Equal(v, input) { @@ -109,7 +109,7 @@ func TestActionsService_GenerateRepoJITConfig(t *testing.T) { mux.HandleFunc("/repos/o/r/actions/runners/generate-jitconfig", func(w http.ResponseWriter, r *http.Request) { v := new(GenerateJITConfigRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") if !cmp.Equal(v, input) { diff --git a/github/actions_secrets.go b/github/actions_secrets.go index 316badb70d6..49985e12afa 100644 --- a/github/actions_secrets.go +++ b/github/actions_secrets.go @@ -23,7 +23,7 @@ type PublicKey struct { // do not error out when unmarshaling. func (p *PublicKey) UnmarshalJSON(data []byte) error { var pk struct { - KeyID interface{} `json:"key_id,string"` + KeyID interface{} `json:"key_id"` Key *string `json:"key"` } diff --git a/github/actions_workflow_runs_test.go b/github/actions_workflow_runs_test.go index 3104e6dfafd..92cd3ad4f2f 100644 --- a/github/actions_workflow_runs_test.go +++ b/github/actions_workflow_runs_test.go @@ -1247,7 +1247,7 @@ func TestActionService_PendingDeployments(t *testing.T) { mux.HandleFunc("/repos/o/r/actions/runs/399444496/pending_deployments", func(w http.ResponseWriter, r *http.Request) { v := new(PendingDeploymentsRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") if !cmp.Equal(v, input) { diff --git a/github/actions_workflows_test.go b/github/actions_workflows_test.go index 5e0dbbc9c13..66ad164f4ac 100644 --- a/github/actions_workflows_test.go +++ b/github/actions_workflows_test.go @@ -243,7 +243,7 @@ func TestActionsService_CreateWorkflowDispatchEventByID(t *testing.T) { } mux.HandleFunc("/repos/o/r/actions/workflows/72844/dispatches", func(w http.ResponseWriter, r *http.Request) { var v CreateWorkflowDispatchEventRequest - json.NewDecoder(r.Body).Decode(&v) + assertNilError(t, json.NewDecoder(r.Body).Decode(&v)) testMethod(t, r, "POST") if !cmp.Equal(v, event) { @@ -287,7 +287,7 @@ func TestActionsService_CreateWorkflowDispatchEventByFileName(t *testing.T) { } mux.HandleFunc("/repos/o/r/actions/workflows/main.yml/dispatches", func(w http.ResponseWriter, r *http.Request) { var v CreateWorkflowDispatchEventRequest - json.NewDecoder(r.Body).Decode(&v) + assertNilError(t, json.NewDecoder(r.Body).Decode(&v)) testMethod(t, r, "POST") if !cmp.Equal(v, event) { diff --git a/github/activity_notifications_test.go b/github/activity_notifications_test.go index 830c8b10cf8..815238ebb5e 100644 --- a/github/activity_notifications_test.go +++ b/github/activity_notifications_test.go @@ -251,7 +251,7 @@ func TestActivityService_SetThreadSubscription(t *testing.T) { mux.HandleFunc("/notifications/threads/1/subscription", func(w http.ResponseWriter, r *http.Request) { v := new(Subscription) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PUT") if !cmp.Equal(v, input) { diff --git a/github/activity_test.go b/github/activity_test.go index ef7cf32fca5..e2d800220d8 100644 --- a/github/activity_test.go +++ b/github/activity_test.go @@ -21,7 +21,7 @@ func TestActivityService_List(t *testing.T) { testMethod(t, r, "GET") w.WriteHeader(http.StatusOK) - w.Write(feedsJSON) + assertWrite(t, w, feedsJSON) }) ctx := context.Background() diff --git a/github/activity_watching_test.go b/github/activity_watching_test.go index 15b0f330783..da43f5a481e 100644 --- a/github/activity_watching_test.go +++ b/github/activity_watching_test.go @@ -196,7 +196,7 @@ func TestActivityService_SetRepositorySubscription(t *testing.T) { mux.HandleFunc("/repos/o/r/subscription", func(w http.ResponseWriter, r *http.Request) { v := new(Subscription) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PUT") if !cmp.Equal(v, input) { diff --git a/github/admin_orgs_test.go b/github/admin_orgs_test.go index 0282425bf06..55963441c7a 100644 --- a/github/admin_orgs_test.go +++ b/github/admin_orgs_test.go @@ -25,7 +25,7 @@ func TestAdminOrgs_Create(t *testing.T) { mux.HandleFunc("/admin/organizations", func(w http.ResponseWriter, r *http.Request) { v := new(createOrgRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") want := &createOrgRequest{Login: String("github"), Admin: String("ghAdmin")} @@ -67,7 +67,7 @@ func TestAdminOrgs_Rename(t *testing.T) { mux.HandleFunc("/admin/organizations/o", func(w http.ResponseWriter, r *http.Request) { v := new(renameOrgRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PATCH") want := &renameOrgRequest{Login: String("the-new-octocats")} @@ -105,7 +105,7 @@ func TestAdminOrgs_RenameByName(t *testing.T) { mux.HandleFunc("/admin/organizations/o", func(w http.ResponseWriter, r *http.Request) { v := new(renameOrgRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PATCH") want := &renameOrgRequest{Login: String("the-new-octocats")} diff --git a/github/admin_test.go b/github/admin_test.go index 207121c35cc..dbe0bd2802b 100644 --- a/github/admin_test.go +++ b/github/admin_test.go @@ -25,7 +25,7 @@ func TestAdminService_UpdateUserLDAPMapping(t *testing.T) { mux.HandleFunc("/admin/ldap/users/u/mapping", func(w http.ResponseWriter, r *http.Request) { v := new(UserLDAPMapping) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PATCH") if !cmp.Equal(v, input) { @@ -73,7 +73,7 @@ func TestAdminService_UpdateTeamLDAPMapping(t *testing.T) { mux.HandleFunc("/admin/ldap/teams/1/mapping", func(w http.ResponseWriter, r *http.Request) { v := new(TeamLDAPMapping) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PATCH") if !cmp.Equal(v, input) { diff --git a/github/admin_users_test.go b/github/admin_users_test.go index 354943d50a2..2dac611709e 100644 --- a/github/admin_users_test.go +++ b/github/admin_users_test.go @@ -22,7 +22,7 @@ func TestAdminUsers_Create(t *testing.T) { mux.HandleFunc("/admin/users", func(w http.ResponseWriter, r *http.Request) { v := new(createUserRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") want := &createUserRequest{Login: String("github"), Email: String("email@domain.com")} diff --git a/github/apps_test.go b/github/apps_test.go index d3e7c434233..f87d5006873 100644 --- a/github/apps_test.go +++ b/github/apps_test.go @@ -400,7 +400,7 @@ func TestAppsService_CreateInstallationTokenWithOptions(t *testing.T) { mux.HandleFunc("/app/installations/1/access_tokens", func(w http.ResponseWriter, r *http.Request) { v := new(InstallationTokenOptions) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) if !cmp.Equal(v, installationTokenOptions) { t.Errorf("request sent %+v, want %+v", v, installationTokenOptions) @@ -431,7 +431,7 @@ func TestAppsService_CreateAttachement(t *testing.T) { testHeader(t, r, "Accept", mediaTypeContentAttachmentsPreview) w.WriteHeader(http.StatusOK) - w.Write([]byte(`{"id":1,"title":"title1","body":"body1"}`)) + assertWrite(t, w, []byte(`{"id":1,"title":"title1","body":"body1"}`)) }) ctx := context.Background() diff --git a/github/code-scanning_test.go b/github/code-scanning_test.go index e42f1d8b37f..4fbe45e7813 100644 --- a/github/code-scanning_test.go +++ b/github/code-scanning_test.go @@ -60,7 +60,7 @@ func TestCodeScanningService_UploadSarif(t *testing.T) { mux.HandleFunc("/repos/o/r/code-scanning/sarifs", func(w http.ResponseWriter, r *http.Request) { v := new(SarifAnalysis) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") want := &SarifAnalysis{CommitSHA: String("abc"), Ref: String("ref/head/main"), Sarif: String("abc"), CheckoutURI: String("uri"), StartedAt: &Timestamp{time.Date(2006, time.January, 02, 15, 04, 05, 0, time.UTC)}, ToolName: String("codeql-cli")} if !cmp.Equal(v, want) { @@ -316,7 +316,7 @@ func TestCodeScanningService_ListAlertsForOrg(t *testing.T) { }, } if !cmp.Equal(alerts, want) { - t.Errorf("CodeScanning.ListAlertsForOrg returned %+v, want %+v", *&alerts, *&want) + t.Errorf("CodeScanning.ListAlertsForOrg returned %+v, want %+v", alerts, want) } const methodName = "ListAlertsForOrg" @@ -442,7 +442,7 @@ func TestCodeScanningService_ListAlertsForOrgLisCursorOptions(t *testing.T) { }, } if !cmp.Equal(alerts, want) { - t.Errorf("CodeScanning.ListAlertsForOrg returned %+v, want %+v", *&alerts, *&want) + t.Errorf("CodeScanning.ListAlertsForOrg returned %+v, want %+v", alerts, want) } const methodName = "ListAlertsForOrg" diff --git a/github/enterprise_actions_runners_test.go b/github/enterprise_actions_runners_test.go index a1d3f17a895..36b2aaefe89 100644 --- a/github/enterprise_actions_runners_test.go +++ b/github/enterprise_actions_runners_test.go @@ -24,7 +24,10 @@ func TestEnterpriseService_GenerateEnterpriseJITConfig(t *testing.T) { mux.HandleFunc("/enterprises/o/actions/runners/generate-jitconfig", func(w http.ResponseWriter, r *http.Request) { v := new(GenerateJITConfigRequest) - json.NewDecoder(r.Body).Decode(v) + err := json.NewDecoder(r.Body).Decode(v) + if err != nil { + t.Errorf("Request body decode failed: %v", err) + } testMethod(t, r, "POST") if !cmp.Equal(v, input) { diff --git a/github/enterprise_code_security_and_analysis_test.go b/github/enterprise_code_security_and_analysis_test.go index 24bf89c51e3..25dbd941702 100644 --- a/github/enterprise_code_security_and_analysis_test.go +++ b/github/enterprise_code_security_and_analysis_test.go @@ -77,7 +77,7 @@ func TestEnterpriseService_UpdateCodeSecurityAndAnalysis(t *testing.T) { mux.HandleFunc("/enterprises/e/code_security_and_analysis", func(w http.ResponseWriter, r *http.Request) { v := new(EnterpriseSecurityAnalysisSettings) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PATCH") if !cmp.Equal(v, input) { diff --git a/github/gists_comments_test.go b/github/gists_comments_test.go index c9c97068979..593c9eeddc6 100644 --- a/github/gists_comments_test.go +++ b/github/gists_comments_test.go @@ -169,7 +169,7 @@ func TestGistsService_CreateComment(t *testing.T) { mux.HandleFunc("/gists/1/comments", func(w http.ResponseWriter, r *http.Request) { v := new(GistComment) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") if !cmp.Equal(v, input) { @@ -222,7 +222,7 @@ func TestGistsService_EditComment(t *testing.T) { mux.HandleFunc("/gists/1/comments/2", func(w http.ResponseWriter, r *http.Request) { v := new(GistComment) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PATCH") if !cmp.Equal(v, input) { diff --git a/github/gists_test.go b/github/gists_test.go index 3066d585a25..995363ec4cc 100644 --- a/github/gists_test.go +++ b/github/gists_test.go @@ -484,7 +484,7 @@ func TestGistsService_Create(t *testing.T) { mux.HandleFunc("/gists", func(w http.ResponseWriter, r *http.Request) { v := new(Gist) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") if !cmp.Equal(v, input) { @@ -546,7 +546,7 @@ func TestGistsService_Edit(t *testing.T) { mux.HandleFunc("/gists/1", func(w http.ResponseWriter, r *http.Request) { v := new(Gist) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PATCH") if !cmp.Equal(v, input) { diff --git a/github/git_blobs_test.go b/github/git_blobs_test.go index c2cc455ab89..94cdd34e7a3 100644 --- a/github/git_blobs_test.go +++ b/github/git_blobs_test.go @@ -118,7 +118,7 @@ func TestGitService_CreateBlob(t *testing.T) { mux.HandleFunc("/repos/o/r/git/blobs", func(w http.ResponseWriter, r *http.Request) { v := new(Blob) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") diff --git a/github/git_commits_test.go b/github/git_commits_test.go index efdb0a27dc8..ddb1672ea72 100644 --- a/github/git_commits_test.go +++ b/github/git_commits_test.go @@ -174,7 +174,7 @@ func TestGitService_CreateCommit(t *testing.T) { mux.HandleFunc("/repos/o/r/git/commits", func(w http.ResponseWriter, r *http.Request) { v := new(createCommit) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") @@ -232,7 +232,7 @@ func TestGitService_CreateSignedCommit(t *testing.T) { mux.HandleFunc("/repos/o/r/git/commits", func(w http.ResponseWriter, r *http.Request) { v := new(createCommit) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") @@ -335,7 +335,7 @@ Commit Message.`) mux.HandleFunc("/repos/o/r/git/commits", func(w http.ResponseWriter, r *http.Request) { v := new(createCommit) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") diff --git a/github/git_refs_test.go b/github/git_refs_test.go index d37504945d1..1014a44aa5b 100644 --- a/github/git_refs_test.go +++ b/github/git_refs_test.go @@ -393,7 +393,7 @@ func TestGitService_CreateRef(t *testing.T) { mux.HandleFunc("/repos/o/r/git/refs", func(w http.ResponseWriter, r *http.Request) { v := new(createRefRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") if !cmp.Equal(v, args) { @@ -482,7 +482,7 @@ func TestGitService_UpdateRef(t *testing.T) { mux.HandleFunc("/repos/o/r/git/refs/heads/b", func(w http.ResponseWriter, r *http.Request) { v := new(updateRefRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PATCH") if !cmp.Equal(v, args) { @@ -635,7 +635,7 @@ func TestGitService_UpdateRef_pathEscape(t *testing.T) { mux.HandleFunc("/repos/o/r/git/refs/heads/b#1", func(w http.ResponseWriter, r *http.Request) { v := new(updateRefRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PATCH") if !cmp.Equal(v, args) { diff --git a/github/git_tags_test.go b/github/git_tags_test.go index 0d45ee26893..44084141a06 100644 --- a/github/git_tags_test.go +++ b/github/git_tags_test.go @@ -58,7 +58,7 @@ func TestGitService_CreateTag(t *testing.T) { mux.HandleFunc("/repos/o/r/git/tags", func(w http.ResponseWriter, r *http.Request) { v := new(createTagRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") if !cmp.Equal(v, input) { diff --git a/github/github.go b/github/github.go index df01144460f..e16bb084466 100644 --- a/github/github.go +++ b/github/github.go @@ -810,7 +810,7 @@ func (c *Client) BareDo(ctx context.Context, req *http.Request) (*Response, erro }, err } // If we've hit a secondary rate limit, don't make further requests before Retry After. - if err := c.checkSecondaryRateLimitBeforeDo(ctx, req); err != nil { + if err := c.checkSecondaryRateLimitBeforeDo(req); err != nil { return &Response{ Response: err.Response, }, err @@ -942,7 +942,7 @@ func (c *Client) checkRateLimitBeforeDo(req *http.Request, rateLimitCategory rat // current client state in order to quickly check if *AbuseRateLimitError can be immediately returned // from Client.Do, and if so, returns it so that Client.Do can skip making a network API call unnecessarily. // Otherwise it returns nil, and Client.Do should proceed normally. -func (c *Client) checkSecondaryRateLimitBeforeDo(ctx context.Context, req *http.Request) *AbuseRateLimitError { +func (c *Client) checkSecondaryRateLimitBeforeDo(req *http.Request) *AbuseRateLimitError { c.rateMu.Lock() secondary := c.secondaryRateLimitReset c.rateMu.Unlock() @@ -1219,7 +1219,11 @@ func CheckResponse(r *http.Response) error { errorResponse := &ErrorResponse{Response: r} data, err := io.ReadAll(r.Body) if err == nil && data != nil { - json.Unmarshal(data, errorResponse) + err = json.Unmarshal(data, errorResponse) + if err != nil { + // reset the response as if this never happened + errorResponse = &ErrorResponse{Response: r} + } } // Re-populate error response body because GitHub error responses are often // undocumented and inconsistent. @@ -1574,7 +1578,7 @@ func (c *Client) roundTripWithOptionalFollowRedirect(ctx context.Context, u stri // If redirect response is returned, follow it if followRedirects && resp.StatusCode == http.StatusMovedPermanently { - resp.Body.Close() + _ = resp.Body.Close() u = resp.Header.Get("Location") resp, err = c.roundTripWithOptionalFollowRedirect(ctx, u, false, opts...) } diff --git a/github/github_test.go b/github/github_test.go index af506e65243..7d92946dfd0 100644 --- a/github/github_test.go +++ b/github/github_test.go @@ -109,7 +109,7 @@ func testFormValues(t *testing.T, r *http.Request, values values) { want.Set(k, v) } - r.ParseForm() + assertNilError(t, r.ParseForm()) if got := r.Form; !cmp.Equal(got, want) { t.Errorf("Request parameters: %v, want %v", got, want) } @@ -275,6 +275,19 @@ func testErrorResponseForStatusCode(t *testing.T, code int) { } } +func assertNilError(t *testing.T, err error) { + t.Helper() + if err != nil { + t.Errorf("unexpected error: %v", err) + } +} + +func assertWrite(t *testing.T, w io.Writer, data []byte) { + t.Helper() + _, err := w.Write(data) + assertNilError(t, err) +} + func TestNewClient(t *testing.T) { c := NewClient(nil) @@ -991,7 +1004,8 @@ func TestDo(t *testing.T) { req, _ := client.NewRequest("GET", ".", nil) body := new(foo) ctx := context.Background() - client.Do(ctx, req, body) + _, err := client.Do(ctx, req, body) + assertNilError(t, err) want := &foo{"a"} if !cmp.Equal(body, want) { @@ -1266,11 +1280,14 @@ func TestDo_rateLimit_noNetworkCall(t *testing.T) { // First request is made, and it makes the client aware of rate reset time being in the future. req, _ := client.NewRequest("GET", "first", nil) ctx := context.Background() - client.Do(ctx, req, nil) + _, err := client.Do(ctx, req, nil) + if err == nil { + t.Error("Expected error to be returned.") + } // Second request should not cause a network call to be made, since client can predict a rate limit error. req, _ = client.NewRequest("GET", "second", nil) - _, err := client.Do(ctx, req, nil) + _, err = client.Do(ctx, req, nil) if madeNetworkCall { t.Fatal("Network call was made, even though rate limit is known to still be exceeded.") @@ -1323,11 +1340,14 @@ func TestDo_rateLimit_ignoredFromCache(t *testing.T) { // First request is made so afterwards we can check the returned rate limit headers were ignored. req, _ := client.NewRequest("GET", "first", nil) ctx := context.Background() - client.Do(ctx, req, nil) + _, err := client.Do(ctx, req, nil) + if err == nil { + t.Error("Expected error to be returned.") + } // Second request should not by hindered by rate limits. req, _ = client.NewRequest("GET", "second", nil) - _, err := client.Do(ctx, req, nil) + _, err = client.Do(ctx, req, nil) if err != nil { t.Fatalf("Second request failed, even though the rate limits from the cache should've been ignored: %v", err) @@ -2393,7 +2413,8 @@ func TestUnauthenticatedRateLimitedTransport(t *testing.T) { unauthedClient.BaseURL = client.BaseURL req, _ := unauthedClient.NewRequest("GET", ".", nil) ctx := context.Background() - unauthedClient.Do(ctx, req, nil) + _, err := unauthedClient.Do(ctx, req, nil) + assertNilError(t, err) } func TestUnauthenticatedRateLimitedTransport_missingFields(t *testing.T) { @@ -2468,7 +2489,8 @@ func TestBasicAuthTransport(t *testing.T) { basicAuthClient.BaseURL = client.BaseURL req, _ := basicAuthClient.NewRequest("GET", ".", nil) ctx := context.Background() - basicAuthClient.Do(ctx, req, nil) + _, err := basicAuthClient.Do(ctx, req, nil) + assertNilError(t, err) } func TestBasicAuthTransport_transport(t *testing.T) { diff --git a/github/interactions_orgs_test.go b/github/interactions_orgs_test.go index 9258c92f502..f014bd5feed 100644 --- a/github/interactions_orgs_test.go +++ b/github/interactions_orgs_test.go @@ -59,7 +59,7 @@ func TestInteractionsService_UpdateRestrictionsForOrg(t *testing.T) { mux.HandleFunc("/orgs/o/interaction-limits", func(w http.ResponseWriter, r *http.Request) { v := new(InteractionRestriction) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PUT") testHeader(t, r, "Accept", mediaTypeInteractionRestrictionsPreview) diff --git a/github/interactions_repos_test.go b/github/interactions_repos_test.go index 0a9f51245e4..fd48ae7130d 100644 --- a/github/interactions_repos_test.go +++ b/github/interactions_repos_test.go @@ -59,7 +59,7 @@ func TestInteractionsService_UpdateRestrictionsForRepo(t *testing.T) { mux.HandleFunc("/repos/o/r/interaction-limits", func(w http.ResponseWriter, r *http.Request) { v := new(InteractionRestriction) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PUT") testHeader(t, r, "Accept", mediaTypeInteractionRestrictionsPreview) diff --git a/github/issue_import_test.go b/github/issue_import_test.go index 48f96ab3a5c..17c7c17ffe4 100644 --- a/github/issue_import_test.go +++ b/github/issue_import_test.go @@ -38,14 +38,14 @@ func TestIssueImportService_Create(t *testing.T) { mux.HandleFunc("/repos/o/r/import/issues", func(w http.ResponseWriter, r *http.Request) { v := new(IssueImportRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") testHeader(t, r, "Accept", mediaTypeIssueImportAPI) if !cmp.Equal(v, input) { t.Errorf("Request body = %+v, want %+v", v, input) } - w.Write(issueImportResponseJSON) + assertWrite(t, w, issueImportResponseJSON) }) ctx := context.Background() @@ -96,7 +96,7 @@ func TestIssueImportService_Create_defered(t *testing.T) { mux.HandleFunc("/repos/o/r/import/issues", func(w http.ResponseWriter, r *http.Request) { v := new(IssueImportRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") testHeader(t, r, "Accept", mediaTypeIssueImportAPI) if !cmp.Equal(v, input) { @@ -104,7 +104,7 @@ func TestIssueImportService_Create_defered(t *testing.T) { } w.WriteHeader(http.StatusAccepted) - w.Write(issueImportResponseJSON) + assertWrite(t, w, issueImportResponseJSON) }) ctx := context.Background() @@ -142,7 +142,7 @@ func TestIssueImportService_Create_badResponse(t *testing.T) { mux.HandleFunc("/repos/o/r/import/issues", func(w http.ResponseWriter, r *http.Request) { v := new(IssueImportRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") testHeader(t, r, "Accept", mediaTypeIssueImportAPI) if !cmp.Equal(v, input) { @@ -150,7 +150,7 @@ func TestIssueImportService_Create_badResponse(t *testing.T) { } w.WriteHeader(http.StatusAccepted) - w.Write([]byte("{[}")) + assertWrite(t, w, []byte("{[}")) }) ctx := context.Background() @@ -178,7 +178,7 @@ func TestIssueImportService_CheckStatus(t *testing.T) { testMethod(t, r, "GET") testHeader(t, r, "Accept", mediaTypeIssueImportAPI) w.WriteHeader(http.StatusOK) - w.Write(issueImportResponseJSON) + assertWrite(t, w, issueImportResponseJSON) }) ctx := context.Background() @@ -224,7 +224,7 @@ func TestIssueImportService_CheckStatusSince(t *testing.T) { testMethod(t, r, "GET") testHeader(t, r, "Accept", mediaTypeIssueImportAPI) w.WriteHeader(http.StatusOK) - w.Write([]byte(fmt.Sprintf("[%s]", issueImportResponseJSON))) + assertWrite(t, w, []byte(fmt.Sprintf("[%s]", issueImportResponseJSON))) }) ctx := context.Background() @@ -261,7 +261,7 @@ func TestIssueImportService_CheckStatusSince_badResponse(t *testing.T) { testMethod(t, r, "GET") testHeader(t, r, "Accept", mediaTypeIssueImportAPI) w.WriteHeader(http.StatusOK) - w.Write([]byte("{badly-formed JSON")) + assertWrite(t, w, []byte("{badly-formed JSON")) }) ctx := context.Background() diff --git a/github/issues_assignees_test.go b/github/issues_assignees_test.go index 26773b1154f..5273136143e 100644 --- a/github/issues_assignees_test.go +++ b/github/issues_assignees_test.go @@ -176,7 +176,7 @@ func TestIssuesService_AddAssignees(t *testing.T) { var assignees struct { Assignees []string `json:"assignees,omitempty"` } - json.NewDecoder(r.Body).Decode(&assignees) + assertNilError(t, json.NewDecoder(r.Body).Decode(&assignees)) testMethod(t, r, "POST") want := []string{"user1", "user2"} @@ -220,7 +220,7 @@ func TestIssuesService_RemoveAssignees(t *testing.T) { var assignees struct { Assignees []string `json:"assignees,omitempty"` } - json.NewDecoder(r.Body).Decode(&assignees) + assertNilError(t, json.NewDecoder(r.Body).Decode(&assignees)) testMethod(t, r, "DELETE") want := []string{"user1", "user2"} diff --git a/github/issues_comments_test.go b/github/issues_comments_test.go index d35deedaf17..70f923481b5 100644 --- a/github/issues_comments_test.go +++ b/github/issues_comments_test.go @@ -163,7 +163,7 @@ func TestIssuesService_CreateComment(t *testing.T) { mux.HandleFunc("/repos/o/r/issues/1/comments", func(w http.ResponseWriter, r *http.Request) { v := new(IssueComment) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") if !cmp.Equal(v, input) { @@ -216,7 +216,7 @@ func TestIssuesService_EditComment(t *testing.T) { mux.HandleFunc("/repos/o/r/issues/comments/1", func(w http.ResponseWriter, r *http.Request) { v := new(IssueComment) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PATCH") if !cmp.Equal(v, input) { diff --git a/github/issues_labels_test.go b/github/issues_labels_test.go index 06f4c6b6768..88b7be7168e 100644 --- a/github/issues_labels_test.go +++ b/github/issues_labels_test.go @@ -113,7 +113,7 @@ func TestIssuesService_CreateLabel(t *testing.T) { mux.HandleFunc("/repos/o/r/labels", func(w http.ResponseWriter, r *http.Request) { v := new(Label) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") if !cmp.Equal(v, input) { @@ -166,7 +166,7 @@ func TestIssuesService_EditLabel(t *testing.T) { mux.HandleFunc("/repos/o/r/labels/n", func(w http.ResponseWriter, r *http.Request) { v := new(Label) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PATCH") if !cmp.Equal(v, input) { @@ -302,7 +302,7 @@ func TestIssuesService_AddLabelsToIssue(t *testing.T) { mux.HandleFunc("/repos/o/r/issues/1/labels", func(w http.ResponseWriter, r *http.Request) { var v []string - json.NewDecoder(r.Body).Decode(&v) + assertNilError(t, json.NewDecoder(r.Body).Decode(&v)) testMethod(t, r, "POST") if !cmp.Equal(v, input) { @@ -389,7 +389,7 @@ func TestIssuesService_ReplaceLabelsForIssue(t *testing.T) { mux.HandleFunc("/repos/o/r/issues/1/labels", func(w http.ResponseWriter, r *http.Request) { var v []string - json.NewDecoder(r.Body).Decode(&v) + assertNilError(t, json.NewDecoder(r.Body).Decode(&v)) testMethod(t, r, "PUT") if !cmp.Equal(v, input) { diff --git a/github/issues_milestones_test.go b/github/issues_milestones_test.go index b6472f34688..decaf2c1127 100644 --- a/github/issues_milestones_test.go +++ b/github/issues_milestones_test.go @@ -118,7 +118,7 @@ func TestIssuesService_CreateMilestone(t *testing.T) { mux.HandleFunc("/repos/o/r/milestones", func(w http.ResponseWriter, r *http.Request) { v := new(Milestone) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") if !cmp.Equal(v, input) { @@ -171,7 +171,7 @@ func TestIssuesService_EditMilestone(t *testing.T) { mux.HandleFunc("/repos/o/r/milestones/1", func(w http.ResponseWriter, r *http.Request) { v := new(Milestone) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PATCH") if !cmp.Equal(v, input) { diff --git a/github/issues_test.go b/github/issues_test.go index 37b2c2ad0f7..aa767d6508a 100644 --- a/github/issues_test.go +++ b/github/issues_test.go @@ -265,7 +265,7 @@ func TestIssuesService_Create(t *testing.T) { mux.HandleFunc("/repos/o/r/issues", func(w http.ResponseWriter, r *http.Request) { v := new(IssueRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") if !cmp.Equal(v, input) { @@ -318,7 +318,7 @@ func TestIssuesService_Edit(t *testing.T) { mux.HandleFunc("/repos/o/r/issues/1", func(w http.ResponseWriter, r *http.Request) { v := new(IssueRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PATCH") if !cmp.Equal(v, input) { diff --git a/github/migrations_source_import_test.go b/github/migrations_source_import_test.go index bcb49de1c90..d357ff10b8a 100644 --- a/github/migrations_source_import_test.go +++ b/github/migrations_source_import_test.go @@ -28,7 +28,7 @@ func TestMigrationService_StartImport(t *testing.T) { mux.HandleFunc("/repos/o/r/import", func(w http.ResponseWriter, r *http.Request) { v := new(Import) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PUT") if !cmp.Equal(v, input) { @@ -111,7 +111,7 @@ func TestMigrationService_UpdateImport(t *testing.T) { mux.HandleFunc("/repos/o/r/import", func(w http.ResponseWriter, r *http.Request) { v := new(Import) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PATCH") if !cmp.Equal(v, input) { @@ -192,7 +192,7 @@ func TestMigrationService_MapCommitAuthor(t *testing.T) { mux.HandleFunc("/repos/o/r/import/authors/1", func(w http.ResponseWriter, r *http.Request) { v := new(SourceImportAuthor) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PATCH") if !cmp.Equal(v, input) { @@ -235,7 +235,7 @@ func TestMigrationService_SetLFSPreference(t *testing.T) { mux.HandleFunc("/repos/o/r/import/lfs", func(w http.ResponseWriter, r *http.Request) { v := new(Import) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PATCH") if !cmp.Equal(v, input) { diff --git a/github/migrations_test.go b/github/migrations_test.go index 4a5c0fc6c06..7ddc6300a8a 100644 --- a/github/migrations_test.go +++ b/github/migrations_test.go @@ -24,7 +24,7 @@ func TestMigrationService_StartMigration(t *testing.T) { testHeader(t, r, "Accept", mediaTypeMigrationsPreview) w.WriteHeader(http.StatusCreated) - w.Write(migrationJSON) + assertWrite(t, w, migrationJSON) }) opt := &MigrationOptions{ @@ -64,7 +64,7 @@ func TestMigrationService_ListMigrations(t *testing.T) { testHeader(t, r, "Accept", mediaTypeMigrationsPreview) w.WriteHeader(http.StatusOK) - w.Write([]byte(fmt.Sprintf("[%s]", migrationJSON))) + assertWrite(t, w, []byte(fmt.Sprintf("[%s]", migrationJSON))) }) ctx := context.Background() @@ -100,7 +100,7 @@ func TestMigrationService_MigrationStatus(t *testing.T) { testHeader(t, r, "Accept", mediaTypeMigrationsPreview) w.WriteHeader(http.StatusOK) - w.Write(migrationJSON) + assertWrite(t, w, migrationJSON) }) ctx := context.Background() @@ -141,7 +141,7 @@ func TestMigrationService_MigrationArchiveURL(t *testing.T) { testMethod(t, r, "GET") w.WriteHeader(http.StatusOK) - w.Write([]byte("0123456789abcdef")) + assertWrite(t, w, []byte("0123456789abcdef")) }) ctx := context.Background() diff --git a/github/migrations_user_test.go b/github/migrations_user_test.go index 358bb9bdcf3..0a303ce6348 100644 --- a/github/migrations_user_test.go +++ b/github/migrations_user_test.go @@ -24,7 +24,7 @@ func TestMigrationService_StartUserMigration(t *testing.T) { testHeader(t, r, "Accept", mediaTypeMigrationsPreview) w.WriteHeader(http.StatusCreated) - w.Write(userMigrationJSON) + assertWrite(t, w, userMigrationJSON) }) opt := &UserMigrationOptions{ @@ -62,7 +62,7 @@ func TestMigrationService_ListUserMigrations(t *testing.T) { testHeader(t, r, "Accept", mediaTypeMigrationsPreview) w.WriteHeader(http.StatusOK) - w.Write([]byte(fmt.Sprintf("[%s]", userMigrationJSON))) + assertWrite(t, w, []byte(fmt.Sprintf("[%s]", userMigrationJSON))) }) ctx := context.Background() @@ -95,7 +95,7 @@ func TestMigrationService_UserMigrationStatus(t *testing.T) { testHeader(t, r, "Accept", mediaTypeMigrationsPreview) w.WriteHeader(http.StatusOK) - w.Write(userMigrationJSON) + assertWrite(t, w, userMigrationJSON) }) ctx := context.Background() diff --git a/github/misc_test.go b/github/misc_test.go index 4e88ec54529..69427ebf246 100644 --- a/github/misc_test.go +++ b/github/misc_test.go @@ -26,7 +26,7 @@ func TestMarkdown(t *testing.T) { } mux.HandleFunc("/markdown", func(w http.ResponseWriter, r *http.Request) { v := new(markdownRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") if !cmp.Equal(v, input) { diff --git a/github/orgs_actions_allowed_test.go b/github/orgs_actions_allowed_test.go index 6af05213523..6461dcf9a39 100644 --- a/github/orgs_actions_allowed_test.go +++ b/github/orgs_actions_allowed_test.go @@ -56,7 +56,7 @@ func TestOrganizationsService_EditActionsAllowed(t *testing.T) { mux.HandleFunc("/orgs/o/actions/permissions/selected-actions", func(w http.ResponseWriter, r *http.Request) { v := new(ActionsAllowed) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PUT") if !cmp.Equal(v, input) { diff --git a/github/orgs_actions_permissions_test.go b/github/orgs_actions_permissions_test.go index 9664c79eda8..d35965eccb1 100644 --- a/github/orgs_actions_permissions_test.go +++ b/github/orgs_actions_permissions_test.go @@ -57,7 +57,7 @@ func TestOrganizationsService_EditActionsPermissions(t *testing.T) { mux.HandleFunc("/orgs/o/actions/permissions", func(w http.ResponseWriter, r *http.Request) { v := new(ActionsPermissions) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PUT") if !cmp.Equal(v, input) { diff --git a/github/orgs_hooks_configuration_test.go b/github/orgs_hooks_configuration_test.go index a79f8a56c57..337c721f59e 100644 --- a/github/orgs_hooks_configuration_test.go +++ b/github/orgs_hooks_configuration_test.go @@ -72,7 +72,7 @@ func TestOrganizationsService_EditHookConfiguration(t *testing.T) { mux.HandleFunc("/orgs/o/hooks/1/config", func(w http.ResponseWriter, r *http.Request) { v := new(HookConfig) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PATCH") if !cmp.Equal(v, input) { diff --git a/github/orgs_hooks_test.go b/github/orgs_hooks_test.go index 0fe45565b9c..843f60e1e32 100644 --- a/github/orgs_hooks_test.go +++ b/github/orgs_hooks_test.go @@ -70,7 +70,7 @@ func TestOrganizationsService_CreateHook(t *testing.T) { mux.HandleFunc("/orgs/o/hooks", func(w http.ResponseWriter, r *http.Request) { v := new(createHookRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") want := &createHookRequest{Name: "web"} @@ -159,7 +159,7 @@ func TestOrganizationsService_EditHook(t *testing.T) { mux.HandleFunc("/orgs/o/hooks/1", func(w http.ResponseWriter, r *http.Request) { v := new(Hook) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PATCH") if !cmp.Equal(v, input) { diff --git a/github/orgs_members_test.go b/github/orgs_members_test.go index 0b5068e55e5..9526442cda4 100644 --- a/github/orgs_members_test.go +++ b/github/orgs_members_test.go @@ -445,7 +445,7 @@ func TestOrganizationsService_EditOrgMembership_AuthenticatedUser(t *testing.T) mux.HandleFunc("/user/memberships/orgs/o", func(w http.ResponseWriter, r *http.Request) { v := new(Membership) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PATCH") if !cmp.Equal(v, input) { @@ -489,7 +489,7 @@ func TestOrganizationsService_EditOrgMembership_SpecifiedUser(t *testing.T) { mux.HandleFunc("/orgs/o/memberships/u", func(w http.ResponseWriter, r *http.Request) { v := new(Membership) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PUT") if !cmp.Equal(v, input) { @@ -647,7 +647,7 @@ func TestOrganizationsService_CreateOrgInvitation(t *testing.T) { mux.HandleFunc("/orgs/o/invitations", func(w http.ResponseWriter, r *http.Request) { v := new(CreateOrgInvitationOptions) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") if !cmp.Equal(v, input) { diff --git a/github/orgs_personal_access_tokens_test.go b/github/orgs_personal_access_tokens_test.go index 93ee1b3db93..9426385f4a6 100644 --- a/github/orgs_personal_access_tokens_test.go +++ b/github/orgs_personal_access_tokens_test.go @@ -25,7 +25,7 @@ func TestOrganizationsService_ReviewPersonalAccessTokenRequest(t *testing.T) { mux.HandleFunc("/orgs/o/personal-access-token-requests/1", func(w http.ResponseWriter, r *http.Request) { v := new(ReviewPersonalAccessTokenRequestOptions) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, http.MethodPost) if !cmp.Equal(v, &input) { diff --git a/github/orgs_projects_test.go b/github/orgs_projects_test.go index 390917d4fac..0853ed9b971 100644 --- a/github/orgs_projects_test.go +++ b/github/orgs_projects_test.go @@ -64,7 +64,7 @@ func TestOrganizationsService_CreateProject(t *testing.T) { testHeader(t, r, "Accept", mediaTypeProjectsPreview) v := &ProjectOptions{} - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) if !cmp.Equal(v, input) { t.Errorf("Request body = %+v, want %+v", v, input) } diff --git a/github/orgs_test.go b/github/orgs_test.go index ca85af25b71..98a6b5257e1 100644 --- a/github/orgs_test.go +++ b/github/orgs_test.go @@ -269,7 +269,7 @@ func TestOrganizationsService_Edit(t *testing.T) { mux.HandleFunc("/orgs/o", func(w http.ResponseWriter, r *http.Request) { v := new(Organization) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testHeader(t, r, "Accept", mediaTypeMemberAllowedRepoCreationTypePreview) testMethod(t, r, "PATCH") diff --git a/github/projects_test.go b/github/projects_test.go index c4ccbd092af..369e121ae03 100644 --- a/github/projects_test.go +++ b/github/projects_test.go @@ -102,7 +102,7 @@ func TestProjectsService_UpdateProject(t *testing.T) { testHeader(t, r, "Accept", mediaTypeProjectsPreview) v := &ProjectOptions{} - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) if !cmp.Equal(v, input) { t.Errorf("Request body = %+v, want %+v", v, input) } @@ -284,7 +284,7 @@ func TestProjectsService_CreateProjectColumn(t *testing.T) { testHeader(t, r, "Accept", mediaTypeProjectsPreview) v := &ProjectColumnOptions{} - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) if !cmp.Equal(v, input) { t.Errorf("Request body = %+v, want %+v", v, input) } @@ -329,7 +329,7 @@ func TestProjectsService_UpdateProjectColumn(t *testing.T) { testHeader(t, r, "Accept", mediaTypeProjectsPreview) v := &ProjectColumnOptions{} - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) if !cmp.Equal(v, input) { t.Errorf("Request body = %+v, want %+v", v, input) } @@ -400,7 +400,7 @@ func TestProjectsService_MoveProjectColumn(t *testing.T) { testHeader(t, r, "Accept", mediaTypeProjectsPreview) v := &ProjectColumnMoveOptions{} - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) if !cmp.Equal(v, input) { t.Errorf("Request body = %+v, want %+v", v, input) } @@ -515,7 +515,7 @@ func TestProjectsService_CreateProjectCard(t *testing.T) { testHeader(t, r, "Accept", mediaTypeProjectsPreview) v := &ProjectCardOptions{} - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) if !cmp.Equal(v, input) { t.Errorf("Request body = %+v, want %+v", v, input) } @@ -563,7 +563,7 @@ func TestProjectsService_UpdateProjectCard(t *testing.T) { testHeader(t, r, "Accept", mediaTypeProjectsPreview) v := &ProjectCardOptions{} - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) if !cmp.Equal(v, input) { t.Errorf("Request body = %+v, want %+v", v, input) } @@ -634,7 +634,7 @@ func TestProjectsService_MoveProjectCard(t *testing.T) { testHeader(t, r, "Accept", mediaTypeProjectsPreview) v := &ProjectCardMoveOptions{} - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) if !cmp.Equal(v, input) { t.Errorf("Request body = %+v, want %+v", v, input) } @@ -670,7 +670,7 @@ func TestProjectsService_AddProjectCollaborator(t *testing.T) { testHeader(t, r, "Accept", mediaTypeProjectsPreview) v := &ProjectCollaboratorOptions{} - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) if !cmp.Equal(v, opt) { t.Errorf("Request body = %+v, want %+v", v, opt) } diff --git a/github/pulls_comments_test.go b/github/pulls_comments_test.go index 47d08d2b779..828651b84ac 100644 --- a/github/pulls_comments_test.go +++ b/github/pulls_comments_test.go @@ -269,7 +269,7 @@ func TestPullRequestsService_CreateComment(t *testing.T) { wantAcceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeMultiLineCommentsPreview} mux.HandleFunc("/repos/o/r/pulls/1/comments", func(w http.ResponseWriter, r *http.Request) { v := new(PullRequestComment) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) // TODO: remove custom Accept header assertion when the API fully launches. testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) @@ -324,7 +324,7 @@ func TestPullRequestsService_CreateCommentInReplyTo(t *testing.T) { mux.HandleFunc("/repos/o/r/pulls/1/comments", func(w http.ResponseWriter, r *http.Request) { v := new(PullRequestComment) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") if !cmp.Equal(v, input) { @@ -368,7 +368,7 @@ func TestPullRequestsService_EditComment(t *testing.T) { mux.HandleFunc("/repos/o/r/pulls/comments/1", func(w http.ResponseWriter, r *http.Request) { v := new(PullRequestComment) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PATCH") if !cmp.Equal(v, input) { diff --git a/github/pulls_reviews_test.go b/github/pulls_reviews_test.go index 7931ba05140..bafa9f06a3b 100644 --- a/github/pulls_reviews_test.go +++ b/github/pulls_reviews_test.go @@ -365,7 +365,7 @@ func TestPullRequestsService_CreateReview(t *testing.T) { mux.HandleFunc("/repos/o/r/pulls/1/reviews", func(w http.ResponseWriter, r *http.Request) { v := new(PullRequestReviewRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") if !cmp.Equal(v, input) { @@ -468,7 +468,7 @@ func TestPullRequestsService_CreateReview_addHeader(t *testing.T) { mux.HandleFunc("/repos/o/r/pulls/1/reviews", func(w http.ResponseWriter, r *http.Request) { v := new(PullRequestReviewRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") if !cmp.Equal(v, input) { @@ -532,7 +532,7 @@ func TestPullRequestsService_SubmitReview(t *testing.T) { mux.HandleFunc("/repos/o/r/pulls/1/reviews/1/events", func(w http.ResponseWriter, r *http.Request) { v := new(PullRequestReviewRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") if !cmp.Equal(v, input) { @@ -585,7 +585,7 @@ func TestPullRequestsService_DismissReview(t *testing.T) { mux.HandleFunc("/repos/o/r/pulls/1/reviews/1/dismissals", func(w http.ResponseWriter, r *http.Request) { v := new(PullRequestReviewDismissalRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PUT") if !cmp.Equal(v, input) { diff --git a/github/pulls_test.go b/github/pulls_test.go index 4ea6bfa9d1e..5a9582b896e 100644 --- a/github/pulls_test.go +++ b/github/pulls_test.go @@ -361,7 +361,7 @@ func TestPullRequestsService_Create(t *testing.T) { mux.HandleFunc("/repos/o/r/pulls", func(w http.ResponseWriter, r *http.Request) { v := new(NewPullRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") if !cmp.Equal(v, input) { @@ -488,7 +488,8 @@ func TestPullRequestsService_Edit(t *testing.T) { mux.HandleFunc(fmt.Sprintf("/repos/o/r/pulls/%v", i), func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PATCH") testBody(t, r, tt.wantUpdate+"\n") - io.WriteString(w, tt.sendResponse) + _, err := io.WriteString(w, tt.sendResponse) + assertNilError(t, err) madeRequest = true }) diff --git a/github/reactions_test.go b/github/reactions_test.go index f84c3383290..e77631e99a1 100644 --- a/github/reactions_test.go +++ b/github/reactions_test.go @@ -112,7 +112,7 @@ func TestReactionsService_CreateCommentReaction(t *testing.T) { testHeader(t, r, "Accept", mediaTypeReactionsPreview) w.WriteHeader(http.StatusCreated) - w.Write([]byte(`{"id":1,"user":{"login":"l","id":2},"content":"+1"}`)) + assertWrite(t, w, []byte(`{"id":1,"user":{"login":"l","id":2},"content":"+1"}`)) }) ctx := context.Background() @@ -149,7 +149,7 @@ func TestReactionsService_ListIssueReactions(t *testing.T) { testHeader(t, r, "Accept", mediaTypeReactionsPreview) w.WriteHeader(http.StatusOK) - w.Write([]byte(`[{"id":1,"user":{"login":"l","id":2},"content":"+1"}]`)) + assertWrite(t, w, []byte(`[{"id":1,"user":{"login":"l","id":2},"content":"+1"}]`)) }) ctx := context.Background() @@ -193,7 +193,7 @@ func TestReactionsService_CreateIssueReaction(t *testing.T) { testHeader(t, r, "Accept", mediaTypeReactionsPreview) w.WriteHeader(http.StatusCreated) - w.Write([]byte(`{"id":1,"user":{"login":"l","id":2},"content":"+1"}`)) + assertWrite(t, w, []byte(`{"id":1,"user":{"login":"l","id":2},"content":"+1"}`)) }) ctx := context.Background() @@ -230,7 +230,7 @@ func TestReactionsService_ListIssueCommentReactions(t *testing.T) { testHeader(t, r, "Accept", mediaTypeReactionsPreview) w.WriteHeader(http.StatusOK) - w.Write([]byte(`[{"id":1,"user":{"login":"l","id":2},"content":"+1"}]`)) + assertWrite(t, w, []byte(`[{"id":1,"user":{"login":"l","id":2},"content":"+1"}]`)) }) ctx := context.Background() @@ -274,7 +274,7 @@ func TestReactionsService_CreateIssueCommentReaction(t *testing.T) { testHeader(t, r, "Accept", mediaTypeReactionsPreview) w.WriteHeader(http.StatusCreated) - w.Write([]byte(`{"id":1,"user":{"login":"l","id":2},"content":"+1"}`)) + assertWrite(t, w, []byte(`{"id":1,"user":{"login":"l","id":2},"content":"+1"}`)) }) ctx := context.Background() @@ -311,7 +311,7 @@ func TestReactionsService_ListPullRequestCommentReactions(t *testing.T) { testHeader(t, r, "Accept", mediaTypeReactionsPreview) w.WriteHeader(http.StatusOK) - w.Write([]byte(`[{"id":1,"user":{"login":"l","id":2},"content":"+1"}]`)) + assertWrite(t, w, []byte(`[{"id":1,"user":{"login":"l","id":2},"content":"+1"}]`)) }) ctx := context.Background() @@ -355,7 +355,7 @@ func TestReactionsService_CreatePullRequestCommentReaction(t *testing.T) { testHeader(t, r, "Accept", mediaTypeReactionsPreview) w.WriteHeader(http.StatusCreated) - w.Write([]byte(`{"id":1,"user":{"login":"l","id":2},"content":"+1"}`)) + assertWrite(t, w, []byte(`{"id":1,"user":{"login":"l","id":2},"content":"+1"}`)) }) ctx := context.Background() @@ -392,7 +392,7 @@ func TestReactionsService_ListTeamDiscussionReactions(t *testing.T) { testHeader(t, r, "Accept", mediaTypeReactionsPreview) w.WriteHeader(http.StatusOK) - w.Write([]byte(`[{"id":1,"user":{"login":"l","id":2},"content":"+1"}]`)) + assertWrite(t, w, []byte(`[{"id":1,"user":{"login":"l","id":2},"content":"+1"}]`)) }) ctx := context.Background() @@ -436,7 +436,7 @@ func TestReactionsService_CreateTeamDiscussionReaction(t *testing.T) { testHeader(t, r, "Accept", mediaTypeReactionsPreview) w.WriteHeader(http.StatusCreated) - w.Write([]byte(`{"id":1,"user":{"login":"l","id":2},"content":"+1"}`)) + assertWrite(t, w, []byte(`{"id":1,"user":{"login":"l","id":2},"content":"+1"}`)) }) ctx := context.Background() @@ -473,7 +473,7 @@ func TestReactionService_ListTeamDiscussionCommentReactions(t *testing.T) { testHeader(t, r, "Accept", mediaTypeReactionsPreview) w.WriteHeader(http.StatusOK) - w.Write([]byte(`[{"id":1,"user":{"login":"l","id":2},"content":"+1"}]`)) + assertWrite(t, w, []byte(`[{"id":1,"user":{"login":"l","id":2},"content":"+1"}]`)) }) ctx := context.Background() @@ -517,7 +517,7 @@ func TestReactionService_CreateTeamDiscussionCommentReaction(t *testing.T) { testHeader(t, r, "Accept", mediaTypeReactionsPreview) w.WriteHeader(http.StatusCreated) - w.Write([]byte(`{"id":1,"user":{"login":"l","id":2},"content":"+1"}`)) + assertWrite(t, w, []byte(`{"id":1,"user":{"login":"l","id":2},"content":"+1"}`)) }) ctx := context.Background() @@ -878,7 +878,7 @@ func TestReactionService_CreateReleaseReaction(t *testing.T) { testHeader(t, r, "Accept", mediaTypeReactionsPreview) w.WriteHeader(http.StatusCreated) - w.Write([]byte(`{"id":1,"user":{"login":"l","id":2},"content":"rocket"}`)) + assertWrite(t, w, []byte(`{"id":1,"user":{"login":"l","id":2},"content":"rocket"}`)) }) const methodName = "CreateReleaseReaction" diff --git a/github/repos_actions_access_test.go b/github/repos_actions_access_test.go index 7085ac7d5c7..accfe2abf13 100644 --- a/github/repos_actions_access_test.go +++ b/github/repos_actions_access_test.go @@ -57,7 +57,7 @@ func TestRepositoriesService_EditActionsAccessLevel(t *testing.T) { mux.HandleFunc("/repos/o/r/actions/permissions/access", func(w http.ResponseWriter, r *http.Request) { v := new(RepositoryActionsAccessLevel) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PUT") if !cmp.Equal(v, input) { diff --git a/github/repos_actions_allowed_test.go b/github/repos_actions_allowed_test.go index 6736f909f9c..62ff11d966c 100644 --- a/github/repos_actions_allowed_test.go +++ b/github/repos_actions_allowed_test.go @@ -56,7 +56,7 @@ func TestRepositoriesService_EditActionsAllowed(t *testing.T) { mux.HandleFunc("/repos/o/r/actions/permissions/selected-actions", func(w http.ResponseWriter, r *http.Request) { v := new(ActionsAllowed) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PUT") if !cmp.Equal(v, input) { diff --git a/github/repos_actions_permissions_test.go b/github/repos_actions_permissions_test.go index 1d6012f62d2..ecff0d5fbca 100644 --- a/github/repos_actions_permissions_test.go +++ b/github/repos_actions_permissions_test.go @@ -57,7 +57,7 @@ func TestRepositoriesService_EditActionsPermissions(t *testing.T) { mux.HandleFunc("/repos/o/r/actions/permissions", func(w http.ResponseWriter, r *http.Request) { v := new(ActionsPermissionsRepository) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PUT") if !cmp.Equal(v, input) { diff --git a/github/repos_autolinks_test.go b/github/repos_autolinks_test.go index a666dbf3ac7..37de5b5f5a7 100644 --- a/github/repos_autolinks_test.go +++ b/github/repos_autolinks_test.go @@ -69,13 +69,13 @@ func TestRepositoriesService_AddAutolink(t *testing.T) { } mux.HandleFunc("/repos/o/r/autolinks", func(w http.ResponseWriter, r *http.Request) { v := new(AutolinkOptions) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") if !cmp.Equal(v, opt) { t.Errorf("Request body = %+v, want %+v", v, opt) } w.WriteHeader(http.StatusOK) - w.Write([]byte(` + assertWrite(t, w, []byte(` { "key_prefix": "TICKET-", "url_template": "https://example.com/TICKET?query=", diff --git a/github/repos_collaborators_test.go b/github/repos_collaborators_test.go index 8953d36bccf..5aa0ad90f70 100644 --- a/github/repos_collaborators_test.go +++ b/github/repos_collaborators_test.go @@ -268,13 +268,13 @@ func TestRepositoriesService_AddCollaborator(t *testing.T) { opt := &RepositoryAddCollaboratorOptions{Permission: "admin"} mux.HandleFunc("/repos/o/r/collaborators/u", func(w http.ResponseWriter, r *http.Request) { v := new(RepositoryAddCollaboratorOptions) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PUT") if !cmp.Equal(v, opt) { t.Errorf("Request body = %+v, want %+v", v, opt) } w.WriteHeader(http.StatusOK) - w.Write([]byte(`{"permissions": "write","url": "https://api.github.com/user/repository_invitations/1296269","html_url": "https://github.com/octocat/Hello-World/invitations","id":1,"permissions":"write","repository":{"url":"s","name":"r","id":1},"invitee":{"login":"u"},"inviter":{"login":"o"}}`)) + assertWrite(t, w, []byte(`{"permissions": "write","url": "https://api.github.com/user/repository_invitations/1296269","html_url": "https://github.com/octocat/Hello-World/invitations","id":1,"permissions":"write","repository":{"url":"s","name":"r","id":1},"invitee":{"login":"u"},"inviter":{"login":"o"}}`)) }) ctx := context.Background() collaboratorInvitation, _, err := client.Repositories.AddCollaborator(ctx, "o", "r", "u", opt) diff --git a/github/repos_comments_test.go b/github/repos_comments_test.go index b3579bf5a80..00871cd72fb 100644 --- a/github/repos_comments_test.go +++ b/github/repos_comments_test.go @@ -117,7 +117,7 @@ func TestRepositoriesService_CreateComment(t *testing.T) { mux.HandleFunc("/repos/o/r/commits/s/comments", func(w http.ResponseWriter, r *http.Request) { v := new(RepositoryComment) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") if !cmp.Equal(v, input) { @@ -215,7 +215,7 @@ func TestRepositoriesService_UpdateComment(t *testing.T) { mux.HandleFunc("/repos/o/r/comments/1", func(w http.ResponseWriter, r *http.Request) { v := new(RepositoryComment) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PATCH") if !cmp.Equal(v, input) { diff --git a/github/repos_commits_test.go b/github/repos_commits_test.go index 5840e677880..fb8b45d4439 100644 --- a/github/repos_commits_test.go +++ b/github/repos_commits_test.go @@ -243,7 +243,7 @@ func TestRepositoriesService_GetCommitSHA1(t *testing.T) { testMethod(t, r, "GET") testHeader(t, r, "Accept", mediaTypeV3SHA) - fmt.Fprintf(w, sha1) + fmt.Fprint(w, sha1) }) ctx := context.Background() @@ -299,7 +299,7 @@ func TestRepositoriesService_NonAlphabetCharacter_GetCommitSHA1(t *testing.T) { testMethod(t, r, "GET") testHeader(t, r, "Accept", mediaTypeV3SHA) - fmt.Fprintf(w, sha1) + fmt.Fprint(w, sha1) }) ctx := context.Background() @@ -339,7 +339,7 @@ func TestRepositoriesService_TrailingPercent_GetCommitSHA1(t *testing.T) { testMethod(t, r, "GET") testHeader(t, r, "Accept", mediaTypeV3SHA) - fmt.Fprintf(w, sha1) + fmt.Fprint(w, sha1) }) ctx := context.Background() diff --git a/github/repos_deployments_test.go b/github/repos_deployments_test.go index c3d6637e37f..4ee2c4f1c32 100644 --- a/github/repos_deployments_test.go +++ b/github/repos_deployments_test.go @@ -97,7 +97,7 @@ func TestRepositoriesService_CreateDeployment(t *testing.T) { mux.HandleFunc("/repos/o/r/deployments", func(w http.ResponseWriter, r *http.Request) { v := new(DeploymentRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") wantAcceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview} @@ -256,7 +256,7 @@ func TestRepositoriesService_CreateDeploymentStatus(t *testing.T) { mux.HandleFunc("/repos/o/r/deployments/1/statuses", func(w http.ResponseWriter, r *http.Request) { v := new(DeploymentStatusRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") wantAcceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview} diff --git a/github/repos_environments_test.go b/github/repos_environments_test.go index 0f93d290882..870c99003a4 100644 --- a/github/repos_environments_test.go +++ b/github/repos_environments_test.go @@ -184,7 +184,7 @@ func TestRepositoriesService_CreateEnvironment(t *testing.T) { mux.HandleFunc("/repos/o/r/environments/e", func(w http.ResponseWriter, r *http.Request) { v := new(CreateUpdateEnvironment) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PUT") want := &CreateUpdateEnvironment{WaitTimer: Int(30), CanAdminsBypass: Bool(true)} @@ -229,7 +229,7 @@ func TestRepositoriesService_CreateEnvironment_noEnterprise(t *testing.T) { mux.HandleFunc("/repos/o/r/environments/e", func(w http.ResponseWriter, r *http.Request) { v := new(CreateUpdateEnvironment) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PUT") if callCount == 0 { @@ -269,7 +269,7 @@ func TestRepositoriesService_createNewEnvNoEnterprise(t *testing.T) { mux.HandleFunc("/repos/o/r/environments/e", func(w http.ResponseWriter, r *http.Request) { v := new(createUpdateEnvironmentNoEnterprise) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PUT") want := &createUpdateEnvironmentNoEnterprise{ diff --git a/github/repos_hooks_configuration_test.go b/github/repos_hooks_configuration_test.go index 0bdf5cbe9e2..27c43d225d8 100644 --- a/github/repos_hooks_configuration_test.go +++ b/github/repos_hooks_configuration_test.go @@ -72,7 +72,7 @@ func TestRepositoriesService_EditHookConfiguration(t *testing.T) { mux.HandleFunc("/repos/o/r/hooks/1/config", func(w http.ResponseWriter, r *http.Request) { v := new(HookConfig) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PATCH") if !cmp.Equal(v, input) { diff --git a/github/repos_hooks_test.go b/github/repos_hooks_test.go index 82e8b554d64..84c9f5ee6fa 100644 --- a/github/repos_hooks_test.go +++ b/github/repos_hooks_test.go @@ -23,7 +23,7 @@ func TestRepositoriesService_CreateHook(t *testing.T) { mux.HandleFunc("/repos/o/r/hooks", func(w http.ResponseWriter, r *http.Request) { v := new(createHookRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") want := &createHookRequest{Name: "web"} @@ -167,7 +167,7 @@ func TestRepositoriesService_EditHook(t *testing.T) { mux.HandleFunc("/repos/o/r/hooks/1", func(w http.ResponseWriter, r *http.Request) { v := new(Hook) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PATCH") if !cmp.Equal(v, input) { diff --git a/github/repos_keys_test.go b/github/repos_keys_test.go index ba60b6ce9a7..8c29c126ee0 100644 --- a/github/repos_keys_test.go +++ b/github/repos_keys_test.go @@ -113,7 +113,7 @@ func TestRepositoriesService_CreateKey(t *testing.T) { mux.HandleFunc("/repos/o/r/keys", func(w http.ResponseWriter, r *http.Request) { v := new(Key) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") if !cmp.Equal(v, input) { diff --git a/github/repos_merging_test.go b/github/repos_merging_test.go index 09a03a19a61..b4c50178ab9 100644 --- a/github/repos_merging_test.go +++ b/github/repos_merging_test.go @@ -27,7 +27,7 @@ func TestRepositoriesService_Merge(t *testing.T) { mux.HandleFunc("/repos/o/r/merges", func(w http.ResponseWriter, r *http.Request) { v := new(RepositoryMergeRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") if !cmp.Equal(v, input) { @@ -91,7 +91,7 @@ func TestRepositoriesService_MergeUpstream(t *testing.T) { mux.HandleFunc("/repos/o/r/merge-upstream", func(w http.ResponseWriter, r *http.Request) { v := new(RepoMergeUpstreamRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") if !cmp.Equal(v, input) { diff --git a/github/repos_pages_test.go b/github/repos_pages_test.go index 21ffb18127f..5dd735c00fb 100644 --- a/github/repos_pages_test.go +++ b/github/repos_pages_test.go @@ -32,7 +32,7 @@ func TestRepositoriesService_EnablePagesLegacy(t *testing.T) { mux.HandleFunc("/repos/o/r/pages", func(w http.ResponseWriter, r *http.Request) { v := new(createPagesRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") testHeader(t, r, "Accept", mediaTypeEnablePagesAPIPreview) @@ -82,7 +82,7 @@ func TestRepositoriesService_EnablePagesWorkflow(t *testing.T) { mux.HandleFunc("/repos/o/r/pages", func(w http.ResponseWriter, r *http.Request) { v := new(createPagesRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") testHeader(t, r, "Accept", mediaTypeEnablePagesAPIPreview) @@ -133,7 +133,7 @@ func TestRepositoriesService_UpdatePagesLegacy(t *testing.T) { mux.HandleFunc("/repos/o/r/pages", func(w http.ResponseWriter, r *http.Request) { v := new(PagesUpdate) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PUT") want := &PagesUpdate{CNAME: String("www.my-domain.com"), BuildType: String("legacy"), Source: &PagesSource{Branch: String("gh-pages")}} @@ -172,7 +172,7 @@ func TestRepositoriesService_UpdatePagesWorkflow(t *testing.T) { mux.HandleFunc("/repos/o/r/pages", func(w http.ResponseWriter, r *http.Request) { v := new(PagesUpdate) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PUT") want := &PagesUpdate{CNAME: String("www.my-domain.com"), BuildType: String("workflow")} diff --git a/github/repos_prereceive_hooks_test.go b/github/repos_prereceive_hooks_test.go index 303e0e1265a..b286068047b 100644 --- a/github/repos_prereceive_hooks_test.go +++ b/github/repos_prereceive_hooks_test.go @@ -116,7 +116,7 @@ func TestRepositoriesService_UpdatePreReceiveHook(t *testing.T) { mux.HandleFunc("/repos/o/r/pre-receive-hooks/1", func(w http.ResponseWriter, r *http.Request) { v := new(PreReceiveHook) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PATCH") if !cmp.Equal(v, input) { diff --git a/github/repos_projects_test.go b/github/repos_projects_test.go index 558cc23a00a..f3818414219 100644 --- a/github/repos_projects_test.go +++ b/github/repos_projects_test.go @@ -64,7 +64,7 @@ func TestRepositoriesService_CreateProject(t *testing.T) { testHeader(t, r, "Accept", mediaTypeProjectsPreview) v := &ProjectOptions{} - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) if !cmp.Equal(v, input) { t.Errorf("Request body = %+v, want %+v", v, input) } diff --git a/github/repos_releases.go b/github/repos_releases.go index 464c2ee1e2b..e2aa845af2f 100644 --- a/github/repos_releases.go +++ b/github/repos_releases.go @@ -352,7 +352,7 @@ func (s *RepositoriesService) DownloadReleaseAsset(ctx context.Context, owner, r } if err := CheckResponse(resp); err != nil { - resp.Body.Close() + _ = resp.Body.Close() return nil, "", err } @@ -371,7 +371,7 @@ func (s *RepositoriesService) downloadReleaseAssetFromURL(ctx context.Context, f return nil, err } if err := CheckResponse(resp); err != nil { - resp.Body.Close() + _ = resp.Body.Close() return nil, err } return resp.Body, nil diff --git a/github/repos_releases_test.go b/github/repos_releases_test.go index fa33a64cd11..d7efd096d21 100644 --- a/github/repos_releases_test.go +++ b/github/repos_releases_test.go @@ -226,7 +226,7 @@ func TestRepositoriesService_CreateRelease(t *testing.T) { mux.HandleFunc("/repos/o/r/releases", func(w http.ResponseWriter, r *http.Request) { v := new(repositoryReleaseRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") want := &repositoryReleaseRequest{ @@ -291,7 +291,7 @@ func TestRepositoriesService_EditRelease(t *testing.T) { mux.HandleFunc("/repos/o/r/releases/1", func(w http.ResponseWriter, r *http.Request) { v := new(repositoryReleaseRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PATCH") want := &repositoryReleaseRequest{ @@ -512,6 +512,36 @@ func TestRepositoriesService_DownloadReleaseAsset_FollowRedirect(t *testing.T) { } } +func TestRepositoriesService_DownloadReleaseAsset_FollowRedirectToError(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/repos/o/r/releases/assets/1", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + testHeader(t, r, "Accept", defaultMediaType) + // /yo, below will be served as baseURLPath/yo + http.Redirect(w, r, baseURLPath+"/yo", http.StatusFound) + }) + mux.HandleFunc("/yo", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + testHeader(t, r, "Accept", "*/*") + w.WriteHeader(http.StatusNotFound) + }) + + ctx := context.Background() + resp, loc, err := client.Repositories.DownloadReleaseAsset(ctx, "o", "r", 1, http.DefaultClient) + if err == nil { + t.Error("Repositories.DownloadReleaseAsset did not return an error") + } + if resp != nil { + resp.Close() + t.Error("Repositories.DownloadReleaseAsset returned stream, want nil") + } + if loc != "" { + t.Errorf(`Repositories.DownloadReleaseAsset returned "%s", want empty ""`, loc) + } +} + func TestRepositoriesService_DownloadReleaseAsset_APIError(t *testing.T) { client, mux, _, teardown := setup() defer teardown() @@ -547,7 +577,7 @@ func TestRepositoriesService_EditReleaseAsset(t *testing.T) { mux.HandleFunc("/repos/o/r/releases/assets/1", func(w http.ResponseWriter, r *http.Request) { v := new(ReleaseAsset) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PATCH") if !cmp.Equal(v, input) { diff --git a/github/repos_statuses_test.go b/github/repos_statuses_test.go index c9e03acb8de..cd9b0db70bb 100644 --- a/github/repos_statuses_test.go +++ b/github/repos_statuses_test.go @@ -69,7 +69,7 @@ func TestRepositoriesService_CreateStatus(t *testing.T) { mux.HandleFunc("/repos/o/r/statuses/r", func(w http.ResponseWriter, r *http.Request) { v := new(RepoStatus) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") if !cmp.Equal(v, input) { diff --git a/github/repos_tags_test.go b/github/repos_tags_test.go index d1eb8aa90ae..0195706fe69 100644 --- a/github/repos_tags_test.go +++ b/github/repos_tags_test.go @@ -68,7 +68,7 @@ func TestRepositoriesService_CreateTagProtection(t *testing.T) { mux.HandleFunc("/repos/o/r/tags/protection", func(w http.ResponseWriter, r *http.Request) { v := new(tagProtectionRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") want := &tagProtectionRequest{Pattern: "tag*"} diff --git a/github/repos_test.go b/github/repos_test.go index a3164edf554..df99b6fc8b7 100644 --- a/github/repos_test.go +++ b/github/repos_test.go @@ -230,7 +230,7 @@ func TestRepositoriesService_Create_user(t *testing.T) { wantAcceptHeaders := []string{mediaTypeRepositoryTemplatePreview, mediaTypeRepositoryVisibilityPreview} mux.HandleFunc("/user/repos", func(w http.ResponseWriter, r *http.Request) { v := new(createRepoRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) @@ -280,7 +280,7 @@ func TestRepositoriesService_Create_org(t *testing.T) { wantAcceptHeaders := []string{mediaTypeRepositoryTemplatePreview, mediaTypeRepositoryVisibilityPreview} mux.HandleFunc("/orgs/o/repos", func(w http.ResponseWriter, r *http.Request) { v := new(createRepoRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) @@ -314,7 +314,7 @@ func TestRepositoriesService_CreateFromTemplate(t *testing.T) { mux.HandleFunc("/repos/to/tr/generate", func(w http.ResponseWriter, r *http.Request) { v := new(TemplateRepoRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") testHeader(t, r, "Accept", mediaTypeRepositoryTemplatePreview) @@ -478,7 +478,7 @@ func TestRepositoriesService_Edit(t *testing.T) { wantAcceptHeaders := []string{mediaTypeRepositoryTemplatePreview, mediaTypeRepositoryVisibilityPreview} mux.HandleFunc("/repos/o/r", func(w http.ResponseWriter, r *http.Request) { v := new(Repository) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PATCH") testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) @@ -1041,7 +1041,7 @@ func TestRepositoriesService_RenameBranch(t *testing.T) { mux.HandleFunc("/repos/o/r/branches/b/rename", func(w http.ResponseWriter, r *http.Request) { v := new(renameBranchRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") want := &renameBranchRequest{NewName: "nn"} @@ -1083,9 +1083,6 @@ func TestRepositoriesService_GetBranchProtection(t *testing.T) { defer teardown() mux.HandleFunc("/repos/o/r/branches/b/protection", func(w http.ResponseWriter, r *http.Request) { - v := new(ProtectionRequest) - json.NewDecoder(r.Body).Decode(v) - testMethod(t, r, "GET") // TODO: remove custom Accept header when this API fully launches testHeader(t, r, "Accept", mediaTypeRequiredApprovingReviewsPreview) @@ -1359,7 +1356,7 @@ func TestRepositoriesService_UpdateBranchProtection_Contexts(t *testing.T) { mux.HandleFunc("/repos/o/r/branches/b/protection", func(w http.ResponseWriter, r *http.Request) { v := new(ProtectionRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PUT") if !cmp.Equal(v, input) { @@ -1536,7 +1533,7 @@ func TestRepositoriesService_UpdateBranchProtection_Checks(t *testing.T) { mux.HandleFunc("/repos/o/r/branches/b/protection", func(w http.ResponseWriter, r *http.Request) { v := new(ProtectionRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PUT") if !cmp.Equal(v, input) { @@ -1677,7 +1674,7 @@ func TestRepositoriesService_UpdateBranchProtection_StrictNoChecks(t *testing.T) mux.HandleFunc("/repos/o/r/branches/b/protection", func(w http.ResponseWriter, r *http.Request) { v := new(ProtectionRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PUT") if !cmp.Equal(v, input) { @@ -1791,7 +1788,7 @@ func TestRepositoriesService_UpdateBranchProtection_RequireLastPushApproval(t *t mux.HandleFunc("/repos/o/r/branches/b/protection", func(w http.ResponseWriter, r *http.Request) { v := new(ProtectionRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PUT") if !cmp.Equal(v, input) { @@ -1907,9 +1904,6 @@ func TestRepositoriesService_GetRequiredStatusChecks(t *testing.T) { defer teardown() mux.HandleFunc("/repos/o/r/branches/b/protection/required_status_checks", func(w http.ResponseWriter, r *http.Request) { - v := new(ProtectionRequest) - json.NewDecoder(r.Body).Decode(v) - testMethod(t, r, "GET") fmt.Fprint(w, `{ "strict": true, @@ -2008,7 +2002,7 @@ func TestRepositoriesService_UpdateRequiredStatusChecks_Contexts(t *testing.T) { mux.HandleFunc("/repos/o/r/branches/b/protection/required_status_checks", func(w http.ResponseWriter, r *http.Request) { v := new(RequiredStatusChecksRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PATCH") if !cmp.Equal(v, input) { @@ -2086,7 +2080,7 @@ func TestRepositoriesService_UpdateRequiredStatusChecks_Checks(t *testing.T) { mux.HandleFunc("/repos/o/r/branches/b/protection/required_status_checks", func(w http.ResponseWriter, r *http.Request) { v := new(RequiredStatusChecksRequest) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PATCH") if !cmp.Equal(v, input) { @@ -2172,9 +2166,6 @@ func TestRepositoriesService_ListRequiredStatusChecksContexts(t *testing.T) { defer teardown() mux.HandleFunc("/repos/o/r/branches/b/protection/required_status_checks/contexts", func(w http.ResponseWriter, r *http.Request) { - v := new(ProtectionRequest) - json.NewDecoder(r.Body).Decode(v) - testMethod(t, r, "GET") fmt.Fprint(w, `["x", "y", "z"]`) }) @@ -2307,7 +2298,7 @@ func TestRepositoriesService_UpdatePullRequestReviewEnforcement(t *testing.T) { mux.HandleFunc("/repos/o/r/branches/b/protection/required_pull_request_reviews", func(w http.ResponseWriter, r *http.Request) { v := new(PullRequestReviewsEnforcementUpdate) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PATCH") if !cmp.Equal(v, input) { @@ -3259,7 +3250,7 @@ func TestRepositoriesService_Transfer(t *testing.T) { mux.HandleFunc("/repos/o/r/transfer", func(w http.ResponseWriter, r *http.Request) { var v TransferRequest - json.NewDecoder(r.Body).Decode(&v) + assertNilError(t, json.NewDecoder(r.Body).Decode(&v)) testMethod(t, r, "POST") if !cmp.Equal(v, input) { @@ -3303,7 +3294,7 @@ func TestRepositoriesService_Dispatch(t *testing.T) { mux.HandleFunc("/repos/o/r/dispatches", func(w http.ResponseWriter, r *http.Request) { var v DispatchRequestOptions - json.NewDecoder(r.Body).Decode(&v) + assertNilError(t, json.NewDecoder(r.Body).Decode(&v)) testMethod(t, r, "POST") if !cmp.Equal(v, input) { diff --git a/github/secret_scanning_test.go b/github/secret_scanning_test.go index 75275913385..2ca439aa470 100644 --- a/github/secret_scanning_test.go +++ b/github/secret_scanning_test.go @@ -357,7 +357,7 @@ func TestSecretScanningService_UpdateAlert(t *testing.T) { testMethod(t, r, "PATCH") v := new(SecretScanningAlertUpdateOptions) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) want := &SecretScanningAlertUpdateOptions{State: String("resolved"), Resolution: String("used_in_tests")} diff --git a/github/strings.go b/github/strings.go index 5611b96a882..147c515e2cf 100644 --- a/github/strings.go +++ b/github/strings.go @@ -8,8 +8,6 @@ package github import ( "bytes" "fmt" - "io" - "reflect" ) @@ -27,7 +25,7 @@ func Stringify(message interface{}) string { // stringifyValue was heavily inspired by the goprotobuf library. -func stringifyValue(w io.Writer, val reflect.Value) { +func stringifyValue(w *bytes.Buffer, val reflect.Value) { if val.Kind() == reflect.Ptr && val.IsNil() { w.Write([]byte("")) return diff --git a/github/teams_discussion_comments_test.go b/github/teams_discussion_comments_test.go index f6b5433b7b5..eaac112bf23 100644 --- a/github/teams_discussion_comments_test.go +++ b/github/teams_discussion_comments_test.go @@ -247,7 +247,7 @@ func TestTeamsService_CreateComment(t *testing.T) { handlerFunc := func(w http.ResponseWriter, r *http.Request) { v := new(DiscussionComment) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") if !cmp.Equal(v, &input) { @@ -319,7 +319,7 @@ func TestTeamsService_EditComment(t *testing.T) { input := DiscussionComment{Body: String("e")} handlerFunc := func(w http.ResponseWriter, r *http.Request) { v := new(DiscussionComment) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PATCH") if !cmp.Equal(v, &input) { diff --git a/github/teams_discussions_test.go b/github/teams_discussions_test.go index 0e73751964a..a9c7434ec1f 100644 --- a/github/teams_discussions_test.go +++ b/github/teams_discussions_test.go @@ -324,7 +324,7 @@ func TestTeamsService_CreateDiscussionByID(t *testing.T) { mux.HandleFunc("/organizations/1/team/2/discussions", func(w http.ResponseWriter, r *http.Request) { v := new(TeamDiscussion) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") if !cmp.Equal(v, &input) { @@ -368,7 +368,7 @@ func TestTeamsService_CreateDiscussionBySlug(t *testing.T) { mux.HandleFunc("/orgs/o/teams/s/discussions", func(w http.ResponseWriter, r *http.Request) { v := new(TeamDiscussion) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") if !cmp.Equal(v, &input) { @@ -412,7 +412,7 @@ func TestTeamsService_EditDiscussionByID(t *testing.T) { mux.HandleFunc("/organizations/1/team/2/discussions/3", func(w http.ResponseWriter, r *http.Request) { v := new(TeamDiscussion) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PATCH") if !cmp.Equal(v, &input) { @@ -456,7 +456,7 @@ func TestTeamsService_EditDiscussionBySlug(t *testing.T) { mux.HandleFunc("/orgs/o/teams/s/discussions/3", func(w http.ResponseWriter, r *http.Request) { v := new(TeamDiscussion) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PATCH") if !cmp.Equal(v, &input) { diff --git a/github/teams_members_test.go b/github/teams_members_test.go index 5ef17351600..bdaf1d72173 100644 --- a/github/teams_members_test.go +++ b/github/teams_members_test.go @@ -333,7 +333,7 @@ func TestTeamsService__AddTeamMembershipByID(t *testing.T) { mux.HandleFunc("/organizations/1/team/2/memberships/u", func(w http.ResponseWriter, r *http.Request) { v := new(TeamAddTeamMembershipOptions) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PUT") if !cmp.Equal(v, opt) { @@ -377,7 +377,7 @@ func TestTeamsService__AddTeamMembershipByID_notFound(t *testing.T) { mux.HandleFunc("/organizations/1/team/2/memberships/u", func(w http.ResponseWriter, r *http.Request) { v := new(TeamAddTeamMembershipOptions) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PUT") if !cmp.Equal(v, opt) { @@ -422,7 +422,7 @@ func TestTeamsService__AddTeamMembershipBySlug(t *testing.T) { mux.HandleFunc("/orgs/o/teams/s/memberships/u", func(w http.ResponseWriter, r *http.Request) { v := new(TeamAddTeamMembershipOptions) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PUT") if !cmp.Equal(v, opt) { @@ -466,7 +466,7 @@ func TestTeamsService__AddTeamMembershipBySlug_notFound(t *testing.T) { mux.HandleFunc("/orgs/o/teams/s/memberships/u", func(w http.ResponseWriter, r *http.Request) { v := new(TeamAddTeamMembershipOptions) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PUT") if !cmp.Equal(v, opt) { diff --git a/github/teams_test.go b/github/teams_test.go index d86fab7fd6b..d215605c618 100644 --- a/github/teams_test.go +++ b/github/teams_test.go @@ -195,7 +195,7 @@ func TestTeamsService_CreateTeam(t *testing.T) { mux.HandleFunc("/orgs/o/teams", func(w http.ResponseWriter, r *http.Request) { v := new(NewTeam) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") if !cmp.Equal(v, &input) { @@ -248,7 +248,7 @@ func TestTeamsService_EditTeamByID(t *testing.T) { mux.HandleFunc("/organizations/1/team/1", func(w http.ResponseWriter, r *http.Request) { v := new(NewTeam) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PATCH") if !cmp.Equal(v, &input) { @@ -298,7 +298,7 @@ func TestTeamsService_EditTeamByID_RemoveParent(t *testing.T) { t.Errorf("Unable to read body: %v", err) } body = string(buf) - json.NewDecoder(bytes.NewBuffer(buf)).Decode(v) + assertNilError(t, json.NewDecoder(bytes.NewBuffer(buf)).Decode(v)) testMethod(t, r, "PATCH") if !cmp.Equal(v, &input) { @@ -332,7 +332,7 @@ func TestTeamsService_EditTeamBySlug(t *testing.T) { mux.HandleFunc("/orgs/o/teams/s", func(w http.ResponseWriter, r *http.Request) { v := new(NewTeam) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PATCH") if !cmp.Equal(v, &input) { @@ -382,7 +382,7 @@ func TestTeamsService_EditTeamBySlug_RemoveParent(t *testing.T) { t.Errorf("Unable to read body: %v", err) } body = string(buf) - json.NewDecoder(bytes.NewBuffer(buf)).Decode(v) + assertNilError(t, json.NewDecoder(bytes.NewBuffer(buf)).Decode(v)) testMethod(t, r, "PATCH") if !cmp.Equal(v, &input) { @@ -798,7 +798,7 @@ func TestTeamsService_AddTeamRepoByID(t *testing.T) { mux.HandleFunc("/organizations/1/team/1/repos/owner/repo", func(w http.ResponseWriter, r *http.Request) { v := new(TeamAddTeamRepoOptions) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PUT") if !cmp.Equal(v, opt) { @@ -833,7 +833,7 @@ func TestTeamsService_AddTeamRepoBySlug(t *testing.T) { mux.HandleFunc("/orgs/org/teams/slug/repos/owner/repo", func(w http.ResponseWriter, r *http.Request) { v := new(TeamAddTeamRepoOptions) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PUT") if !cmp.Equal(v, opt) { @@ -1174,7 +1174,7 @@ func TestTeamsService_AddTeamProjectByID(t *testing.T) { testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) v := &TeamProjectOptions{} - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) if !cmp.Equal(v, opt) { t.Errorf("Request body = %+v, want %+v", v, opt) } @@ -1213,7 +1213,7 @@ func TestTeamsService_AddTeamProjectBySlug(t *testing.T) { testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) v := &TeamProjectOptions{} - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) if !cmp.Equal(v, opt) { t.Errorf("Request body = %+v, want %+v", v, opt) } diff --git a/github/users_administration_test.go b/github/users_administration_test.go index ff8f93584c8..3400edfccac 100644 --- a/github/users_administration_test.go +++ b/github/users_administration_test.go @@ -100,7 +100,7 @@ func TestUsersServiceReason_Suspend(t *testing.T) { mux.HandleFunc("/users/u/suspended", func(w http.ResponseWriter, r *http.Request) { v := new(UserSuspendOptions) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PUT") if !cmp.Equal(v, input) { diff --git a/github/users_emails_test.go b/github/users_emails_test.go index ad9d32e9491..9f7f92bc4dc 100644 --- a/github/users_emails_test.go +++ b/github/users_emails_test.go @@ -59,7 +59,7 @@ func TestUsersService_AddEmails(t *testing.T) { mux.HandleFunc("/user/emails", func(w http.ResponseWriter, r *http.Request) { var v []string - json.NewDecoder(r.Body).Decode(&v) + assertNilError(t, json.NewDecoder(r.Body).Decode(&v)) testMethod(t, r, "POST") if !cmp.Equal(v, input) { @@ -101,7 +101,7 @@ func TestUsersService_DeleteEmails(t *testing.T) { mux.HandleFunc("/user/emails", func(w http.ResponseWriter, r *http.Request) { var v []string - json.NewDecoder(r.Body).Decode(&v) + assertNilError(t, json.NewDecoder(r.Body).Decode(&v)) testMethod(t, r, "DELETE") if !cmp.Equal(v, input) { @@ -149,7 +149,7 @@ func TestUsersService_SetEmailVisibility(t *testing.T) { mux.HandleFunc("/user/email/visibility", func(w http.ResponseWriter, r *http.Request) { v := new(UserEmail) - json.NewDecoder(r.Body).Decode(&v) + assertNilError(t, json.NewDecoder(r.Body).Decode(&v)) testMethod(t, r, "PATCH") if !cmp.Equal(v, input) { diff --git a/github/users_gpg_keys_test.go b/github/users_gpg_keys_test.go index 79ebd2d6f40..e0d581fbbc0 100644 --- a/github/users_gpg_keys_test.go +++ b/github/users_gpg_keys_test.go @@ -134,7 +134,7 @@ mQINBFcEd9kBEACo54TDbGhKlXKWMvJgecEUKPPcv7XdnpKdGb3LRw5MvFwT0V0f var gpgKey struct { ArmoredPublicKey *string `json:"armored_public_key,omitempty"` } - json.NewDecoder(r.Body).Decode(&gpgKey) + assertNilError(t, json.NewDecoder(r.Body).Decode(&gpgKey)) testMethod(t, r, "POST") if gpgKey.ArmoredPublicKey == nil || *gpgKey.ArmoredPublicKey != input { diff --git a/github/users_keys_test.go b/github/users_keys_test.go index ac5c10d0335..f3a8218e598 100644 --- a/github/users_keys_test.go +++ b/github/users_keys_test.go @@ -125,7 +125,7 @@ func TestUsersService_CreateKey(t *testing.T) { mux.HandleFunc("/user/keys", func(w http.ResponseWriter, r *http.Request) { v := new(Key) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") if !cmp.Equal(v, input) { diff --git a/github/users_projects_test.go b/github/users_projects_test.go index 28c46107286..1a298dedaab 100644 --- a/github/users_projects_test.go +++ b/github/users_projects_test.go @@ -64,7 +64,7 @@ func TestUsersService_CreateProject(t *testing.T) { testHeader(t, r, "Accept", mediaTypeProjectsPreview) v := &CreateUserProjectOptions{} - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) if !cmp.Equal(v, input) { t.Errorf("Request body = %+v, want %+v", v, input) } diff --git a/github/users_ssh_signing_keys_test.go b/github/users_ssh_signing_keys_test.go index 3bf59e108db..c7093d7f61e 100644 --- a/github/users_ssh_signing_keys_test.go +++ b/github/users_ssh_signing_keys_test.go @@ -125,7 +125,7 @@ func TestUsersService_CreateSSHSigningKey(t *testing.T) { mux.HandleFunc("/user/ssh_signing_keys", func(w http.ResponseWriter, r *http.Request) { v := new(Key) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") if !cmp.Equal(v, input) { diff --git a/github/users_test.go b/github/users_test.go index f71df5cfd9e..80020007e4a 100644 --- a/github/users_test.go +++ b/github/users_test.go @@ -252,7 +252,7 @@ func TestUsersService_Edit(t *testing.T) { mux.HandleFunc("/user", func(w http.ResponseWriter, r *http.Request) { v := new(User) - json.NewDecoder(r.Body).Decode(v) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "PATCH") if !cmp.Equal(v, input) { diff --git a/scrape/apps_test.go b/scrape/apps_test.go index f80825fbad2..8542426c83e 100644 --- a/scrape/apps_test.go +++ b/scrape/apps_test.go @@ -33,7 +33,7 @@ func Test_AppRestrictionsEnabled(t *testing.T) { defer cleanup() mux.HandleFunc("/organizations/o/settings/oauth_application_policy", func(w http.ResponseWriter, r *http.Request) { - copyTestFile(w, tt.testFile) + copyTestFile(t, w, tt.testFile) }) got, err := client.AppRestrictionsEnabled("o") @@ -52,7 +52,7 @@ func Test_ListOAuthApps(t *testing.T) { defer cleanup() mux.HandleFunc("/organizations/e/settings/oauth_application_policy", func(w http.ResponseWriter, r *http.Request) { - copyTestFile(w, "access-restrictions-enabled.html") + copyTestFile(t, w, "access-restrictions-enabled.html") }) got, err := client.ListOAuthApps("e") diff --git a/scrape/forms_test.go b/scrape/forms_test.go index 2c7b9fef520..b9bd60cb218 100644 --- a/scrape/forms_test.go +++ b/scrape/forms_test.go @@ -94,7 +94,10 @@ func Test_FetchAndSumbitForm(t *testing.T) { `) }) mux.HandleFunc("/submit", func(w http.ResponseWriter, r *http.Request) { - r.ParseForm() + err := r.ParseForm() + if err != nil { + t.Errorf("error parsing form: %v", err) + } want := url.Values{"hidden": {"h"}, "name": {"n"}} if got := r.Form; !cmp.Equal(got, want) { t.Errorf("submitted form contained values %v, want %v", got, want) @@ -103,7 +106,10 @@ func Test_FetchAndSumbitForm(t *testing.T) { }) setValues := func(values url.Values) { values.Set("name", "n") } - fetchAndSubmitForm(client.Client, client.baseURL.String()+"/", setValues) + _, err := fetchAndSubmitForm(client.Client, client.baseURL.String()+"/", setValues) + if err != nil { + t.Errorf("fetchAndSubmitForm returned err: %v", err) + } if !submitted { t.Error("form was never submitted") } diff --git a/scrape/scrape_test.go b/scrape/scrape_test.go index 74e867b6417..f2b928dd9aa 100644 --- a/scrape/scrape_test.go +++ b/scrape/scrape_test.go @@ -6,6 +6,7 @@ import ( "net/http/httptest" "net/url" "os" + "testing" ) // setup a test HTTP server along with a scrape.Client that is configured to @@ -21,13 +22,18 @@ func setup() (client *Client, mux *http.ServeMux, cleanup func()) { return client, mux, server.Close } -func copyTestFile(w io.Writer, filename string) error { +func copyTestFile(t *testing.T, w io.Writer, filename string) { + t.Helper() f, err := os.Open("testdata/" + filename) if err != nil { - return err + t.Errorf("unable to open test file: %v", err) } - defer f.Close() - _, err = io.Copy(w, f) - return err + if err != nil { + t.Errorf("failure copying test file: %v", err) + } + err = f.Close() + if err != nil { + t.Errorf("failure closing test file: %v", err) + } } diff --git a/test/fields/fields.go b/test/fields/fields.go index c32cdaba980..124079a5cea 100644 --- a/test/fields/fields.go +++ b/test/fields/fields.go @@ -31,10 +31,6 @@ import ( var ( client *github.Client - // auth indicates whether tests are being run with an OAuth token. - // Tests can use this flag to skip certain tests when run without auth. - auth bool - skipURLs = flag.Bool("skip_urls", false, "skip url fields") ) @@ -47,7 +43,6 @@ func main() { client = github.NewClient(nil) } else { client = github.NewClient(nil).WithAuthToken(token) - auth = true } for _, tt := range []struct { diff --git a/test/integration/authorizations_test.go b/test/integration/authorizations_test.go index d5bdf2e2884..872c8862820 100644 --- a/test/integration/authorizations_test.go +++ b/test/integration/authorizations_test.go @@ -10,9 +10,7 @@ package integration import ( "context" - "math/rand" "os" - "strconv" "strings" "testing" "time" @@ -21,8 +19,6 @@ import ( ) const msgEnvMissing = "Skipping test because the required environment variable (%v) is not present." -const envKeyGitHubUsername = "GITHUB_USERNAME" -const envKeyGitHubPassword = "GITHUB_PASSWORD" const envKeyClientID = "GITHUB_CLIENT_ID" const envKeyClientSecret = "GITHUB_CLIENT_SECRET" const envKeyAccessToken = "GITHUB_ACCESS_TOKEN" @@ -31,7 +27,6 @@ const InvalidTokenValue = "iamnotacroken" // TestAuthorizationsAppOperations tests the application/token related operations, such // as creating, testing, resetting and revoking application OAuth tokens. func TestAuthorizationsAppOperations(t *testing.T) { - appAuthenticatedClient := getOAuthAppClient(t) // We know these vars are set because getOAuthAppClient would have @@ -107,44 +102,8 @@ func TestAuthorizationsAppOperations(t *testing.T) { failIfNotStatusCode(t, resp, 404) } -// generatePersonalAuthTokenRequest is a helper function that generates an -// AuthorizationRequest for a Personal Access Token (no client id). -func generatePersonalAuthTokenRequest() *github.AuthorizationRequest { - - rand := randString() - auth := github.AuthorizationRequest{ - Note: github.String("Personal token: Note generated by test: " + rand), - Scopes: []github.Scope{github.ScopePublicRepo}, - Fingerprint: github.String("Personal token: Fingerprint generated by test: " + rand), - } - - return &auth -} - -// generatePersonalAuthTokenRequest is a helper function that generates an -// AuthorizationRequest for an OAuth application Token (uses client id). -func generateAppAuthTokenRequest(clientID string, clientSecret string) *github.AuthorizationRequest { - - rand := randString() - auth := github.AuthorizationRequest{ - Note: github.String("App token: Note generated by test: " + rand), - Scopes: []github.Scope{github.ScopePublicRepo}, - Fingerprint: github.String("App token: Fingerprint generated by test: " + rand), - ClientID: github.String(clientID), - ClientSecret: github.String(clientSecret), - } - - return &auth -} - -// randString returns a (kinda) random string for uniqueness purposes. -func randString() string { - return strconv.FormatInt(rand.NewSource(time.Now().UnixNano()).Int63(), 10) -} - // failOnError invokes t.Fatal() if err is present. func failOnError(t *testing.T, err error) { - if err != nil { t.Fatal(err) } @@ -152,33 +111,9 @@ func failOnError(t *testing.T, err error) { // failIfNotStatusCode invokes t.Fatal() if the response's status code doesn't match the expected code. func failIfNotStatusCode(t *testing.T, resp *github.Response, expectedCode int) { - if resp.StatusCode != expectedCode { t.Fatalf("Expected HTTP status code [%v] but received [%v]", expectedCode, resp.StatusCode) } - -} - -// getUserPassClient returns a GitHub client for authorization testing. The client -// uses BasicAuth via GH username and password passed in environment variables -// (and will skip the calling test if those vars are not present). -func getUserPassClient(t *testing.T) *github.Client { - username, ok := os.LookupEnv(envKeyGitHubUsername) - if !ok { - t.Skipf(msgEnvMissing, envKeyGitHubUsername) - } - - password, ok := os.LookupEnv(envKeyGitHubPassword) - if !ok { - t.Skipf(msgEnvMissing, envKeyGitHubPassword) - } - - tp := github.BasicAuthTransport{ - Username: strings.TrimSpace(username), - Password: strings.TrimSpace(password), - } - - return github.NewClient(tp.Client()) } // getOAuthAppClient returns a GitHub client for authorization testing. The client @@ -190,7 +125,6 @@ func getUserPassClient(t *testing.T) *github.Client { // // See GitHub API docs: https://developer.com/v3/oauth_authorizations/#check-an-authorization func getOAuthAppClient(t *testing.T) *github.Client { - username, ok := os.LookupEnv(envKeyClientID) if !ok { t.Skipf(msgEnvMissing, envKeyClientID) diff --git a/update-urls/activity-events_test.go b/update-urls/activity-events_test.go index 9c5b3415dfa..10dce865b29 100644 --- a/update-urls/activity-events_test.go +++ b/update-urls/activity-events_test.go @@ -48,10 +48,7 @@ func TestPipeline_ActivityEvents_FirstStripAllURLsAndDestroyReceivers(t *testing } func TestParseWebPageEndpoints_ActivityEvents(t *testing.T) { - got, err := parseWebPageEndpoints(activityEventsTestWebPage) - if err != nil { - t.Fatal(err) - } + got := parseWebPageEndpoints(activityEventsTestWebPage) testWebPageHelper(t, got, activityEventsWant) } diff --git a/update-urls/main.go b/update-urls/main.go index 0a3c53c24d8..77938be6de7 100644 --- a/update-urls/main.go +++ b/update-urls/main.go @@ -474,7 +474,7 @@ func findAllServices(pkgs map[string]*ast.Package) servicesMap { } logf("Step 1 - Processing %v ...", filename) - if err := findClientServices(filename, f, services); err != nil { + if err := findClientServices(f, services); err != nil { log.Fatal(err) } } @@ -581,12 +581,14 @@ func (dc *documentCache) CacheDocFromInternet(urlWithID, filename string, pos to logf("GET %q ...", fullURL) time.Sleep(httpGetDelay) + //nolint:gosec // G107: Potential HTTP request made with variable url resp, err := http.Get(fullURL) check("Unable to get URL: %v: %v", fullURL, err) switch resp.StatusCode { case http.StatusTooManyRequests, http.StatusServiceUnavailable: logf("Sleeping 60 seconds and trying again...") time.Sleep(60 * time.Second) + //nolint:gosec // G107: Potential HTTP request made with variable url resp, err = http.Get(fullURL) check("Unable to get URL: %v: %v", fullURL, err) case http.StatusOK: @@ -602,7 +604,7 @@ func (dc *documentCache) CacheDocFromInternet(urlWithID, filename string, pos to b, err := io.ReadAll(resp.Body) check("Unable to read body of URL: %v, %v", url, err) check("Unable to close body of URL: %v, %v", url, resp.Body.Close()) - dc.apiDocs[url], err = parseWebPageEndpoints(string(b)) + dc.apiDocs[url] = parseWebPageEndpoints(string(b)) check("Unable to parse web page endpoints: url: %v, filename: %v, err: %v", url, filename, err) logf("Found %v web page fragment identifiers.", len(dc.apiDocs[url])) if len(dc.apiDocs[url]) == 0 { @@ -1138,7 +1140,7 @@ func processCallExpr(expr *ast.CallExpr) (recv, funcName string, args []string) } // findClientServices finds all go-github services from the Client struct. -func findClientServices(filename string, f *ast.File, services servicesMap) error { +func findClientServices(f *ast.File, services servicesMap) error { for _, decl := range f.Decls { switch decl := decl.(type) { case *ast.GenDecl: @@ -1196,7 +1198,7 @@ func endpointsEqual(a, b *Endpoint) bool { // parseWebPageEndpoints returns endpoint information, mapped by // web page fragment identifier. -func parseWebPageEndpoints(buf string) (map[string][]*Endpoint, error) { +func parseWebPageEndpoints(buf string) map[string][]*Endpoint { result := map[string][]*Endpoint{} // The GitHub v3 API web pages do not appear to be auto-generated @@ -1259,7 +1261,7 @@ func parseWebPageEndpoints(buf string) (map[string][]*Endpoint, error) { } } - return result, nil + return result } func stripHTML(s string) string { diff --git a/update-urls/reactions_test.go b/update-urls/reactions_test.go index a3071966b9e..8d0504ec699 100644 --- a/update-urls/reactions_test.go +++ b/update-urls/reactions_test.go @@ -48,10 +48,7 @@ func TestPipeline_Reactions_FirstStripAllURLsAndDestroyReceivers(t *testing.T) { } func TestParseWebPageEndpoints_Reactions(t *testing.T) { - got, err := parseWebPageEndpoints(reactionsTestWebPage) - if err != nil { - t.Fatal(err) - } + got := parseWebPageEndpoints(reactionsTestWebPage) testWebPageHelper(t, got, reactionsWant) } From 9c58b7be8171e388e2a0c4ae0e49930196560c93 Mon Sep 17 00:00:00 2001 From: Gus Price <42309183+GusPrice@users.noreply.github.com> Date: Mon, 18 Sep 2023 06:17:00 -0700 Subject: [PATCH 017/145] Handle encoding value of "none" (#2924) --- github/repos_contents.go | 2 ++ github/repos_contents_test.go | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/github/repos_contents.go b/github/repos_contents.go index de7a0d5b82b..d59c735df8f 100644 --- a/github/repos_contents.go +++ b/github/repos_contents.go @@ -91,6 +91,8 @@ func (r *RepositoryContent) GetContent() (string, error) { return "", nil } return *r.Content, nil + case "none": + return "", errors.New("unsupported content encoding: none, this may occur when file size > 1 MB, if that is the case consider using DownloadContents") default: return "", fmt.Errorf("unsupported content encoding: %v", encoding) } diff --git a/github/repos_contents_test.go b/github/repos_contents_test.go index ab69b5cdcbb..f9613069209 100644 --- a/github/repos_contents_test.go +++ b/github/repos_contents_test.go @@ -54,6 +54,12 @@ func TestRepositoryContent_GetContent(t *testing.T) { want: "", wantErr: true, }, + { + encoding: String("none"), + content: nil, + want: "", + wantErr: true, + }, } for _, tt := range tests { From 3c1590db0015574f9c84e2325f7a274865dfd4ce Mon Sep 17 00:00:00 2001 From: Gregory Oschwald Date: Mon, 18 Sep 2023 06:19:07 -0700 Subject: [PATCH 018/145] Correct NewEnterpriseClient deprecation message (#2923) --- github/github.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/github.go b/github/github.go index e16bb084466..e9ce136b7b6 100644 --- a/github/github.go +++ b/github/github.go @@ -462,7 +462,7 @@ func NewTokenClient(_ context.Context, token string) *Client { // NewEnterpriseClient returns a new GitHub API client with provided // base URL and upload URL (often is your GitHub Enterprise hostname). // -// Deprecated: Use NewClient(httpClient).WithOptions(WithEnterpriseURLs(baseURL, uploadURL)) instead. +// Deprecated: Use NewClient(httpClient).WithEnterpriseURLs(baseURL, uploadURL) instead. func NewEnterpriseClient(baseURL, uploadURL string, httpClient *http.Client) (*Client, error) { return NewClient(httpClient).WithEnterpriseURLs(baseURL, uploadURL) } From 9b42cd175b15db1b37f90dc6905f3b3d304757e8 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Mon, 18 Sep 2023 08:30:20 -0500 Subject: [PATCH 019/145] Fix golangci-lint timeout failures (#2931) --- .github/workflows/linter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 4f3cdf8e4df..4bc27ab6f2d 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -29,4 +29,4 @@ jobs: with: version: latest working-directory: ${{ matrix.working-directory}} - args: --verbose + args: --verbose --timeout=10m From b24403c072ff5187c9dbcbf40806aac2492e681b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Sep 2023 09:33:10 -0400 Subject: [PATCH 020/145] Bump golang.org/x/net from 0.14.0 to 0.15.0 in /scrape (#2925) --- scrape/go.mod | 2 +- scrape/go.sum | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/scrape/go.mod b/scrape/go.mod index 8c6116364a6..9b70258ff76 100644 --- a/scrape/go.mod +++ b/scrape/go.mod @@ -7,5 +7,5 @@ require ( github.com/google/go-cmp v0.5.9 github.com/google/go-github/v55 v55.0.0 github.com/xlzd/gotp v0.1.0 - golang.org/x/net v0.14.0 + golang.org/x/net v0.15.0 ) diff --git a/scrape/go.sum b/scrape/go.sum index 7a79727970b..7db3e4418ea 100644 --- a/scrape/go.sum +++ b/scrape/go.sum @@ -22,8 +22,9 @@ github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5t golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= -golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= +golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= +golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -34,8 +35,8 @@ golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14= -golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= +golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= +golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -50,14 +51,16 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= +golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -66,6 +69,7 @@ golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= From 0e8dfaeabef7bb709e2cf06fbf24c99d6a3bce1f Mon Sep 17 00:00:00 2001 From: WillAbides <233500+WillAbides@users.noreply.github.com> Date: Mon, 18 Sep 2023 08:41:52 -0500 Subject: [PATCH 021/145] Remove ListServiceHooks (#2917) Fixes: #2916. --- github/github-accessors.go | 8 ---- github/github-accessors_test.go | 10 ----- github/github-stringify_test.go | 12 ------ github/misc.go | 32 --------------- github/misc_test.go | 69 --------------------------------- test/integration/misc_test.go | 11 ------ 6 files changed, 142 deletions(-) diff --git a/github/github-accessors.go b/github/github-accessors.go index a685a3efce5..7806d4d16d6 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -21166,14 +21166,6 @@ func (s *SelectedReposList) GetTotalCount() int { return *s.TotalCount } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (s *ServiceHook) GetName() string { - if s == nil || s.Name == nil { - return "" - } - return *s.Name -} - // GetFrom returns the From field if it's non-nil, zero value otherwise. func (s *SignatureRequirementEnforcementLevelChanges) GetFrom() string { if s == nil || s.From == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 10ef017b3cb..ec74394cff3 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -24646,16 +24646,6 @@ func TestSelectedReposList_GetTotalCount(tt *testing.T) { s.GetTotalCount() } -func TestServiceHook_GetName(tt *testing.T) { - var zeroValue string - s := &ServiceHook{Name: &zeroValue} - s.GetName() - s = &ServiceHook{} - s.GetName() - s = nil - s.GetName() -} - func TestSignatureRequirementEnforcementLevelChanges_GetFrom(tt *testing.T) { var zeroValue string s := &SignatureRequirementEnforcementLevelChanges{From: &zeroValue} diff --git a/github/github-stringify_test.go b/github/github-stringify_test.go index 1d2a47bbffe..c14412c2ceb 100644 --- a/github/github-stringify_test.go +++ b/github/github-stringify_test.go @@ -1820,18 +1820,6 @@ func TestSecurityAndAnalysis_String(t *testing.T) { } } -func TestServiceHook_String(t *testing.T) { - v := ServiceHook{ - Name: String(""), - Events: []string{""}, - SupportedEvents: []string{""}, - } - want := `github.ServiceHook{Name:"", Events:[""], SupportedEvents:[""]}` - if got := v.String(); got != want { - t.Errorf("ServiceHook.String = %v, want %v", got, want) - } -} - func TestSourceImportAuthor_String(t *testing.T) { v := SourceImportAuthor{ ID: Int64(0), diff --git a/github/misc.go b/github/misc.go index 89615241570..a01b716fa23 100644 --- a/github/misc.go +++ b/github/misc.go @@ -245,35 +245,3 @@ func (c *Client) Zen(ctx context.Context) (string, *Response, error) { return buf.String(), resp, nil } - -// ServiceHook represents a hook that has configuration settings, a list of -// available events, and default events. -type ServiceHook struct { - Name *string `json:"name,omitempty"` - Events []string `json:"events,omitempty"` - SupportedEvents []string `json:"supported_events,omitempty"` - Schema [][]string `json:"schema,omitempty"` -} - -func (s *ServiceHook) String() string { - return Stringify(s) -} - -// ListServiceHooks lists all of the available service hooks. -// -// GitHub API docs: https://developer.github.com/webhooks/#services -func (c *Client) ListServiceHooks(ctx context.Context) ([]*ServiceHook, *Response, error) { - u := "hooks" - req, err := c.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var hooks []*ServiceHook - resp, err := c.Do(ctx, req, &hooks) - if err != nil { - return nil, resp, err - } - - return hooks, resp, nil -} diff --git a/github/misc_test.go b/github/misc_test.go index 69427ebf246..45c99893812 100644 --- a/github/misc_test.go +++ b/github/misc_test.go @@ -317,48 +317,6 @@ func TestZen(t *testing.T) { }) } -func TestListServiceHooks(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() - - mux.HandleFunc("/hooks", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, `[{ - "name":"n", - "events":["e"], - "supported_events":["s"], - "schema":[ - ["a", "b"] - ] - }]`) - }) - - ctx := context.Background() - hooks, _, err := client.ListServiceHooks(ctx) - if err != nil { - t.Errorf("ListServiceHooks returned error: %v", err) - } - - want := []*ServiceHook{{ - Name: String("n"), - Events: []string{"e"}, - SupportedEvents: []string{"s"}, - Schema: [][]string{{"a", "b"}}, - }} - if !cmp.Equal(hooks, want) { - t.Errorf("ListServiceHooks returned %+v, want %+v", hooks, want) - } - - const methodName = "ListServiceHooks" - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.ListServiceHooks(ctx) - if got != nil { - t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) - } - return resp, err - }) -} - func TestMarkdownRequest_Marshal(t *testing.T) { testJSONMarshal(t, &markdownRequest{}, "{}") @@ -396,30 +354,3 @@ func TestCodeOfConduct_Marshal(t *testing.T) { testJSONMarshal(t, a, want) } - -func TestServiceHook_Marshal(t *testing.T) { - testJSONMarshal(t, &ServiceHook{}, "{}") - - a := &ServiceHook{ - Name: String("name"), - Events: []string{"e"}, - SupportedEvents: []string{"se"}, - Schema: [][]string{{"g"}}, - } - want := `{ - "name": "name", - "events": [ - "e" - ], - "supported_events": [ - "se" - ], - "schema": [ - [ - "g" - ] - ] - }` - - testJSONMarshal(t, a, want) -} diff --git a/test/integration/misc_test.go b/test/integration/misc_test.go index 60753ada7d7..e0cee29bf07 100644 --- a/test/integration/misc_test.go +++ b/test/integration/misc_test.go @@ -67,14 +67,3 @@ func TestRateLimits(t *testing.T) { t.Errorf("Core.Reset is more than 1 minute in the past; that doesn't seem right.") } } - -func TestListServiceHooks(t *testing.T) { - hooks, _, err := client.ListServiceHooks(context.Background()) - if err != nil { - t.Fatalf("ListServiceHooks returned error: %v", err) - } - - if len(hooks) == 0 { - t.Fatalf("ListServiceHooks returned no hooks") - } -} From 477e109aa8a28352b175fffba47e2eecc5e64cf4 Mon Sep 17 00:00:00 2001 From: vandan rohatgi <43648786+vandanrohatgi@users.noreply.github.com> Date: Mon, 18 Sep 2023 19:49:39 +0530 Subject: [PATCH 022/145] Add missing secret scanning alert fields (#2930) Fixes: #2929. --- github/github-accessors.go | 40 ++++++++++++++++++++++++++++ github/github-accessors_test.go | 47 +++++++++++++++++++++++++++++++++ github/secret_scanning.go | 31 +++++++++++++--------- 3 files changed, 105 insertions(+), 13 deletions(-) diff --git a/github/github-accessors.go b/github/github-accessors.go index 7806d4d16d6..e7cfa86f89a 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -20694,6 +20694,30 @@ func (s *SecretScanningAlert) GetNumber() int { return *s.Number } +// GetPushProtectionBypassed returns the PushProtectionBypassed field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlert) GetPushProtectionBypassed() bool { + if s == nil || s.PushProtectionBypassed == nil { + return false + } + return *s.PushProtectionBypassed +} + +// GetPushProtectionBypassedAt returns the PushProtectionBypassedAt field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlert) GetPushProtectionBypassedAt() Timestamp { + if s == nil || s.PushProtectionBypassedAt == nil { + return Timestamp{} + } + return *s.PushProtectionBypassedAt +} + +// GetPushProtectionBypassedBy returns the PushProtectionBypassedBy field. +func (s *SecretScanningAlert) GetPushProtectionBypassedBy() *User { + if s == nil { + return nil + } + return s.PushProtectionBypassedBy +} + // GetRepository returns the Repository field. func (s *SecretScanningAlert) GetRepository() *Repository { if s == nil { @@ -20710,6 +20734,14 @@ func (s *SecretScanningAlert) GetResolution() string { return *s.Resolution } +// GetResolutionComment returns the ResolutionComment field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlert) GetResolutionComment() string { + if s == nil || s.ResolutionComment == nil { + return "" + } + return *s.ResolutionComment +} + // GetResolvedAt returns the ResolvedAt field if it's non-nil, zero value otherwise. func (s *SecretScanningAlert) GetResolvedAt() Timestamp { if s == nil || s.ResolvedAt == nil { @@ -20758,6 +20790,14 @@ func (s *SecretScanningAlert) GetState() string { return *s.State } +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlert) GetUpdatedAt() Timestamp { + if s == nil || s.UpdatedAt == nil { + return Timestamp{} + } + return *s.UpdatedAt +} + // GetURL returns the URL field if it's non-nil, zero value otherwise. func (s *SecretScanningAlert) GetURL() string { if s == nil || s.URL == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index ec74394cff3..e2918beaff1 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -24140,6 +24140,33 @@ func TestSecretScanningAlert_GetNumber(tt *testing.T) { s.GetNumber() } +func TestSecretScanningAlert_GetPushProtectionBypassed(tt *testing.T) { + var zeroValue bool + s := &SecretScanningAlert{PushProtectionBypassed: &zeroValue} + s.GetPushProtectionBypassed() + s = &SecretScanningAlert{} + s.GetPushProtectionBypassed() + s = nil + s.GetPushProtectionBypassed() +} + +func TestSecretScanningAlert_GetPushProtectionBypassedAt(tt *testing.T) { + var zeroValue Timestamp + s := &SecretScanningAlert{PushProtectionBypassedAt: &zeroValue} + s.GetPushProtectionBypassedAt() + s = &SecretScanningAlert{} + s.GetPushProtectionBypassedAt() + s = nil + s.GetPushProtectionBypassedAt() +} + +func TestSecretScanningAlert_GetPushProtectionBypassedBy(tt *testing.T) { + s := &SecretScanningAlert{} + s.GetPushProtectionBypassedBy() + s = nil + s.GetPushProtectionBypassedBy() +} + func TestSecretScanningAlert_GetRepository(tt *testing.T) { s := &SecretScanningAlert{} s.GetRepository() @@ -24157,6 +24184,16 @@ func TestSecretScanningAlert_GetResolution(tt *testing.T) { s.GetResolution() } +func TestSecretScanningAlert_GetResolutionComment(tt *testing.T) { + var zeroValue string + s := &SecretScanningAlert{ResolutionComment: &zeroValue} + s.GetResolutionComment() + s = &SecretScanningAlert{} + s.GetResolutionComment() + s = nil + s.GetResolutionComment() +} + func TestSecretScanningAlert_GetResolvedAt(tt *testing.T) { var zeroValue Timestamp s := &SecretScanningAlert{ResolvedAt: &zeroValue} @@ -24214,6 +24251,16 @@ func TestSecretScanningAlert_GetState(tt *testing.T) { s.GetState() } +func TestSecretScanningAlert_GetUpdatedAt(tt *testing.T) { + var zeroValue Timestamp + s := &SecretScanningAlert{UpdatedAt: &zeroValue} + s.GetUpdatedAt() + s = &SecretScanningAlert{} + s.GetUpdatedAt() + s = nil + s.GetUpdatedAt() +} + func TestSecretScanningAlert_GetURL(tt *testing.T) { var zeroValue string s := &SecretScanningAlert{URL: &zeroValue} diff --git a/github/secret_scanning.go b/github/secret_scanning.go index b8295cbf791..bea3f0e701f 100644 --- a/github/secret_scanning.go +++ b/github/secret_scanning.go @@ -16,19 +16,24 @@ type SecretScanningService service // SecretScanningAlert represents a GitHub secret scanning alert. type SecretScanningAlert struct { - Number *int `json:"number,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - URL *string `json:"url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - LocationsURL *string `json:"locations_url,omitempty"` - State *string `json:"state,omitempty"` - Resolution *string `json:"resolution,omitempty"` - ResolvedAt *Timestamp `json:"resolved_at,omitempty"` - ResolvedBy *User `json:"resolved_by,omitempty"` - SecretType *string `json:"secret_type,omitempty"` - SecretTypeDisplayName *string `json:"secret_type_display_name,omitempty"` - Secret *string `json:"secret,omitempty"` - Repository *Repository `json:"repository,omitempty"` + Number *int `json:"number,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + URL *string `json:"url,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + LocationsURL *string `json:"locations_url,omitempty"` + State *string `json:"state,omitempty"` + Resolution *string `json:"resolution,omitempty"` + ResolvedAt *Timestamp `json:"resolved_at,omitempty"` + ResolvedBy *User `json:"resolved_by,omitempty"` + SecretType *string `json:"secret_type,omitempty"` + SecretTypeDisplayName *string `json:"secret_type_display_name,omitempty"` + Secret *string `json:"secret,omitempty"` + Repository *Repository `json:"repository,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + PushProtectionBypassed *bool `json:"push_protection_bypassed,omitempty"` + PushProtectionBypassedBy *User `json:"push_protection_bypassed_by,omitempty"` + PushProtectionBypassedAt *Timestamp `json:"push_protection_bypassed_at,omitempty"` + ResolutionComment *string `json:"resolution_comment,omitempty"` } // SecretScanningAlertLocation represents the location for a secret scanning alert. From b45ef89f2dd0ec803ab8f27725bdb4941c0cbc99 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Tue, 19 Sep 2023 10:32:03 -0400 Subject: [PATCH 023/145] Fix SecretScanning API by switching arguments from url to json (#2934) Closes: #2871. --- github/github-accessors.go | 16 ---------------- github/github-accessors_test.go | 20 -------------------- github/secret_scanning.go | 18 ++++++++---------- github/secret_scanning_test.go | 4 ++-- 4 files changed, 10 insertions(+), 48 deletions(-) diff --git a/github/github-accessors.go b/github/github-accessors.go index e7cfa86f89a..083d6139148 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -20958,22 +20958,6 @@ func (s *SecretScanningAlertUpdateOptions) GetResolution() string { return *s.Resolution } -// GetSecretType returns the SecretType field if it's non-nil, zero value otherwise. -func (s *SecretScanningAlertUpdateOptions) GetSecretType() string { - if s == nil || s.SecretType == nil { - return "" - } - return *s.SecretType -} - -// GetState returns the State field if it's non-nil, zero value otherwise. -func (s *SecretScanningAlertUpdateOptions) GetState() string { - if s == nil || s.State == nil { - return "" - } - return *s.State -} - // GetStatus returns the Status field if it's non-nil, zero value otherwise. func (s *SecretScanningPushProtection) GetStatus() string { if s == nil || s.Status == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index e2918beaff1..90d15369d0b 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -24440,26 +24440,6 @@ func TestSecretScanningAlertUpdateOptions_GetResolution(tt *testing.T) { s.GetResolution() } -func TestSecretScanningAlertUpdateOptions_GetSecretType(tt *testing.T) { - var zeroValue string - s := &SecretScanningAlertUpdateOptions{SecretType: &zeroValue} - s.GetSecretType() - s = &SecretScanningAlertUpdateOptions{} - s.GetSecretType() - s = nil - s.GetSecretType() -} - -func TestSecretScanningAlertUpdateOptions_GetState(tt *testing.T) { - var zeroValue string - s := &SecretScanningAlertUpdateOptions{State: &zeroValue} - s.GetState() - s = &SecretScanningAlertUpdateOptions{} - s.GetState() - s = nil - s.GetState() -} - func TestSecretScanningPushProtection_GetStatus(tt *testing.T) { var zeroValue string s := &SecretScanningPushProtection{Status: &zeroValue} diff --git a/github/secret_scanning.go b/github/secret_scanning.go index bea3f0e701f..30d3da8ebf8 100644 --- a/github/secret_scanning.go +++ b/github/secret_scanning.go @@ -80,16 +80,14 @@ type SecretScanningAlertListOptions struct { // SecretScanningAlertUpdateOptions specifies optional parameters to the SecretScanningService.UpdateAlert method. type SecretScanningAlertUpdateOptions struct { - // Required. Sets the state of the secret scanning alert. Can be either open or resolved. - // You must provide resolution when you set the state to resolved. - State *string `url:"state,omitempty"` - - // A comma-separated list of secret types to return. By default all secret types are returned. - SecretType *string `url:"secret_type,omitempty"` - - // Required when the state is resolved. The reason for resolving the alert. Can be one of false_positive, - // wont_fix, revoked, or used_in_tests. - Resolution *string `url:"resolution,omitempty"` + // State is required and sets the state of the secret scanning alert. + // Can be either "open" or "resolved". + // You must provide resolution when you set the state to "resolved". + State string `json:"state"` + + // Required when the state is "resolved" and represents the reason for resolving the alert. + // Can be one of: "false_positive", "wont_fix", "revoked", or "used_in_tests". + Resolution *string `json:"resolution,omitempty"` } // Lists secret scanning alerts for eligible repositories in an enterprise, from newest to oldest. diff --git a/github/secret_scanning_test.go b/github/secret_scanning_test.go index 2ca439aa470..7898d29a38c 100644 --- a/github/secret_scanning_test.go +++ b/github/secret_scanning_test.go @@ -359,7 +359,7 @@ func TestSecretScanningService_UpdateAlert(t *testing.T) { v := new(SecretScanningAlertUpdateOptions) assertNilError(t, json.NewDecoder(r.Body).Decode(v)) - want := &SecretScanningAlertUpdateOptions{State: String("resolved"), Resolution: String("used_in_tests")} + want := &SecretScanningAlertUpdateOptions{State: "resolved", Resolution: String("used_in_tests")} if !cmp.Equal(v, want) { t.Errorf("Request body = %+v, want %+v", v, want) @@ -381,7 +381,7 @@ func TestSecretScanningService_UpdateAlert(t *testing.T) { }) ctx := context.Background() - opts := &SecretScanningAlertUpdateOptions{State: String("resolved"), Resolution: String("used_in_tests")} + opts := &SecretScanningAlertUpdateOptions{State: "resolved", Resolution: String("used_in_tests")} alert, _, err := client.SecretScanning.UpdateAlert(ctx, "o", "r", 1, opts) if err != nil { From 9f1382e5fd78bff4b221e0310f44409190b6e05d Mon Sep 17 00:00:00 2001 From: WillAbides <233500+WillAbides@users.noreply.github.com> Date: Thu, 21 Sep 2023 08:53:43 -0500 Subject: [PATCH 024/145] Add development scripts (#2928) --- .codecov.yml | 2 + .github/workflows/linter.yml | 26 ++------ .github/workflows/tests.yml | 29 +++------ .gitignore | 2 + .golangci.yml | 1 + CONTRIBUTING.md | 112 ++++++++++++++++------------------ example/basicauth/main.go | 3 +- example/tagprotection/main.go | 3 +- example/tokenauth/main.go | 4 +- script/fmt.sh | 15 +++++ script/generate.sh | 48 +++++++++++++++ script/lint.sh | 38 ++++++++++++ script/test.sh | 26 ++++++++ 13 files changed, 204 insertions(+), 105 deletions(-) create mode 100755 script/fmt.sh create mode 100755 script/generate.sh create mode 100755 script/lint.sh create mode 100755 script/test.sh diff --git a/.codecov.yml b/.codecov.yml index 0f63adb3a6c..2ef223a6e96 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -3,3 +3,5 @@ ignore: - "github/github-accessors.go" # ignore experimental scrape package - "scrape" + # ignore update-urls + - "update-urls" diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 4bc27ab6f2d..98a1f5de8be 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -3,30 +3,14 @@ name: linter permissions: contents: read - pull-requests: read jobs: lint: - strategy: - matrix: - platform: [ubuntu-latest] - - # golangci-lint will only process a single module, so we need to call it - # separately for each module in the repo. We dont lint example/newreposecretwithlibsodium - # since that needs libsodium to run. - working-directory: - - "" - - example - - scrape - - update-urls - runs-on: ${{ matrix.platform }} - + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - - name: golangci-lint ${{ matrix.working-directory }} - uses: golangci/golangci-lint-action@v3 + - uses: actions/setup-go@v4 with: - version: latest - working-directory: ${{ matrix.working-directory}} - args: --verbose --timeout=10m + go-version: 1.x + cache-dependency-path: "**/go.sum" + - run: script/lint.sh diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 87d97f99c09..b3abd8b6f92 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -19,6 +19,9 @@ permissions: jobs: test: + defaults: + run: + shell: bash strategy: matrix: go-version: [1.x, 1.20.x] @@ -41,12 +44,11 @@ jobs: go-version: ${{ matrix.go-version }} - uses: actions/checkout@v4 - # Get values for cache paths to be used in later steps + # Get values for cache paths to be used in later steps - id: cache-paths run: | echo "go-cache=$(go env GOCACHE)" >> $GITHUB_OUTPUT echo "go-mod-cache=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT - shell: bash - name: Cache go modules uses: actions/cache@v3 @@ -57,29 +59,18 @@ jobs: key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} restore-keys: ${{ runner.os }}-go- - - name: Ensure go generate produces a zero diff - shell: bash - run: go generate -x ./... && git diff --exit-code; code=$?; git checkout -- .; (exit $code) - - name: Run go test - run: go test -v -race -coverprofile coverage.txt -covermode atomic ./... + run: | + if [ -n "${{ matrix.update-coverage }}" ]; then + script/test.sh -race -covermode atomic -coverprofile coverage.txt ./... + exit + fi + script/test.sh -race -covermode atomic ./... - name: Ensure integration tests build # don't actually run tests since they hit live GitHub API run: go test -v -tags=integration -run=^$ ./test/integration - - name: Run scrape tests - run: | - cd scrape - go test ./... - - name: Upload coverage to Codecov if: ${{ matrix.update-coverage }} uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d #v3.1.4 - - - name: Ensure go generate produces a zero diff for update-urls - shell: bash - run: cd update-urls && go generate -x ./... && git diff --exit-code; code=$?; git checkout -- .; (exit $code) - - - name: Run go test for update-urls - run: cd update-urls && go test -v -race ./... diff --git a/.gitignore b/.gitignore index 704f4ef5b54..0c803b53aa6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ *.sh +!/script/*.sh *.test coverage.out +/bin # intellij files .idea/ vendor/ diff --git a/.golangci.yml b/.golangci.yml index 3e286f045f4..d1ec5b11c92 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,6 +1,7 @@ run: build-tags: - integration + timeout: 10m linters: enable: - dogsled diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fb3660461fc..451924ce4c3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -31,68 +31,62 @@ are more sensitive, emailed to . ## Submitting a patch ## - 1. It's generally best to start by opening a new issue describing the bug or - feature you're intending to fix. Even if you think it's relatively minor, - it's helpful to know what people are working on. Mention in the initial - issue that you are planning to work on that bug or feature so that it can - be assigned to you. - - 1. Follow the normal process of [forking][] the project, and setup a new - branch to work in. It's important that each group of changes be done in - separate branches in order to ensure that a pull request only includes the - commits related to that bug or feature. - - 1. Go makes it very simple to ensure properly formatted code, so always run - `go fmt` on your code before committing it. You should also run - [go vet][] over your code. this will help you find common style issues - within your code and will keep styling consistent within the project. - - 1. Any significant changes should almost always be accompanied by tests. The - project already has good test coverage, so look at some of the existing - tests if you're unsure how to go about it. [gocov][] and [gocov-html][] - are invaluable tools for seeing which parts of your code aren't being - exercised by your tests. - - 1. Please run: - * `go generate github.com/google/go-github/...` - * `go test github.com/google/go-github/...` - * `go vet github.com/google/go-github/...` - - The `go generate ./...` command will update or generate certain files, and the - resulting changes should be included in your pull request. - - The `go test ./...` command will run tests inside your code. This will help you - spot places where code might be faulty before committing. - - And finally, the `go vet ./...` command will check linting and styling over your - code, keeping the project consistent formatting-wise. - - In any case, it is always a good idea to read [official Go documentation][] when working - on this project, as the definition of tools and commands of the Go programming - language is described in further detail there. - - 1. Do your best to have [well-formed commit messages][] for each change. - This provides consistency throughout the project, and ensures that commit - messages are able to be formatted properly by various git tools. - - 1. Finally, push the commits to your fork and submit a [pull request][]. - Before pushing commits, it is highly advised to check for generated files - that were either created or modified for the sake of your commit. Running - `go generate -x ./...` should return a log of modified generated files that should - be included alongside the manually written code in the commit. - **NOTE:** Please do not use force-push on PRs in this repo, as it makes - it more difficult for reviewers to see what has changed since the last - code review. - -[official Go documentation]: https://pkg.go.dev/std +1. It's generally best to start by opening a new issue describing the bug or + feature you're intending to fix. Even if you think it's relatively minor, + it's helpful to know what people are working on. Mention in the initial issue + that you are planning to work on that bug or feature so that it can be + assigned to you. + +2. Follow the normal process of [forking][] the project, and set up a new branch + to work in. It's important that each group of changes be done in separate + branches in order to ensure that a pull request only includes the commits + related to that bug or feature. + +3. Any significant changes should almost always be accompanied by tests. The + project already has good test coverage, so look at some of the existing tests + if you're unsure how to go about it. Coverage is [monitored by codecov.io][], + which flags pull requests that decrease test coverage. This doesn't + necessarily mean that PRs with decreased coverage won't be merged. Sometimes + a decrease in coverage makes sense, but if your PR is flagged, you should + either add tests to cover those lines or add a PR comment explaining the + untested lines. + +4. Run `script/fmt.sh`, `script/test.sh` and `script/lint.sh` to format your code and + check that it passes all tests and linters. `script/lint.sh` may also tell you + that generated files need to be updated. If so, run `script/generate.sh` to + update them. + +5. Do your best to have [well-formed commit messages][] for each change. This + provides consistency throughout the project, and ensures that commit messages + are able to be formatted properly by various git tools. + +6. Finally, push the commits to your fork and submit a [pull request][]. + **NOTE:** Please do not use force-push on PRs in this repo, as it makes it + more difficult for reviewers to see what has changed since the last code + review. We always perform "squash and merge" actions on PRs in this repo, so it doesn't + matter how many commits your PR has, as they will end up being a single commit after merging. + This is done to make a much cleaner `git log` history and helps to find regressions in the code + using existing tools such as `git bisect`. + [forking]: https://help.github.com/articles/fork-a-repo -[go vet]: https://pkg.go.dev/cmd/vet -[gocov]: https://github.com/axw/gocov -[gocov-html]: https://github.com/matm/gocov-html [well-formed commit messages]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html -[squash]: http://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits [pull request]: https://help.github.com/articles/creating-a-pull-request +[monitored by codecov.io]: https://codecov.io/gh/google/go-github + +## Scripts ## + +The `script` directory has shell scripts that help with common development +tasks. + +**script/fmt.sh** formats all go code in the repository. + +**script/generate.sh** runs code generators and `go mod tidy` on all modules. With +`--check` it checks that the generated files are current. + +**script/lint.sh** runs linters on the project and checks generated files are +current. +**script/test.sh** runs tests on all modules. ## Other notes on code organization ## @@ -144,5 +138,5 @@ this][modified-comment]. [rebase-comment]: https://github.com/google/go-github/pull/277#issuecomment-183035491 [modified-comment]: https://github.com/google/go-github/pull/280#issuecomment-184859046 -**When creating a release, don't forget to update the `Version` constant in `github.go`.** This is used to +**When creating a release, don't forget to update the `Version` constant in `github.go`.** This is used to send the version in the `User-Agent` header to identify clients to the GitHub API. diff --git a/example/basicauth/main.go b/example/basicauth/main.go index e677aa94a42..95ec4360c21 100644 --- a/example/basicauth/main.go +++ b/example/basicauth/main.go @@ -20,7 +20,6 @@ import ( "fmt" "os" "strings" - "syscall" "github.com/google/go-github/v55/github" "golang.org/x/term" @@ -32,7 +31,7 @@ func main() { username, _ := r.ReadString('\n') fmt.Print("GitHub Password: ") - bytePassword, _ := term.ReadPassword(syscall.Stdin) + bytePassword, _ := term.ReadPassword(int(os.Stdin.Fd())) password := string(bytePassword) tp := github.BasicAuthTransport{ diff --git a/example/tagprotection/main.go b/example/tagprotection/main.go index 3b9b723dd0f..4127d2b44de 100644 --- a/example/tagprotection/main.go +++ b/example/tagprotection/main.go @@ -17,7 +17,6 @@ import ( "log" "os" "strings" - "syscall" "github.com/google/go-github/v55/github" "golang.org/x/term" @@ -39,7 +38,7 @@ func main() { pattern = strings.TrimSpace(pattern) fmt.Print("GitHub Token: ") - byteToken, _ := term.ReadPassword(syscall.Stdin) + byteToken, _ := term.ReadPassword(int(os.Stdin.Fd())) println() token := string(byteToken) diff --git a/example/tokenauth/main.go b/example/tokenauth/main.go index 91ad5e5067a..ccd36543584 100644 --- a/example/tokenauth/main.go +++ b/example/tokenauth/main.go @@ -13,7 +13,7 @@ import ( "context" "fmt" "log" - "syscall" + "os" "github.com/google/go-github/v55/github" "golang.org/x/term" @@ -21,7 +21,7 @@ import ( func main() { fmt.Print("GitHub Token: ") - byteToken, _ := term.ReadPassword(syscall.Stdin) + byteToken, _ := term.ReadPassword(int(os.Stdin.Fd())) println() token := string(byteToken) diff --git a/script/fmt.sh b/script/fmt.sh new file mode 100755 index 00000000000..20ff6e69254 --- /dev/null +++ b/script/fmt.sh @@ -0,0 +1,15 @@ +#!/bin/sh +#/ script/fmt.sh runs go fmt on all go files in the project. + +set -e + +CDPATH="" cd -- "$(dirname -- "$0")/.." + +MOD_DIRS="$(git ls-files '*go.mod' | xargs dirname | sort)" + +for dir in $MOD_DIRS; do + ( + cd "$dir" + go fmt ./... + ) +done diff --git a/script/generate.sh b/script/generate.sh new file mode 100755 index 00000000000..17707b2385c --- /dev/null +++ b/script/generate.sh @@ -0,0 +1,48 @@ +#!/bin/sh +#/ script/generate.sh runs go generate on all modules in this repo. +#/ `script/generate.sh --check` checks that the generated files are up to date. + +set -e + +CDPATH="" cd -- "$(dirname -- "$0")/.." + +if [ "$1" = "--check" ]; then + GENTEMP="$(mktemp -d)" + git worktree add -q --detach "$GENTEMP" + trap 'git worktree remove -f "$GENTEMP"; rm -rf "$GENTEMP"' EXIT + for f in $(git ls-files -com --exclude-standard); do + target="$GENTEMP/$f" + mkdir -p "$(dirname -- "$target")" + cp "$f" "$target" + done + if [ -f "$(pwd)"/bin ]; then + ln -s "$(pwd)"/bin "$GENTEMP"/bin + fi + ( + cd "$GENTEMP" + git add . + git -c user.name='bot' -c user.email='bot@localhost' commit -m "generate" -q --allow-empty + script/generate.sh + [ -z "$(git status --porcelain)" ] || { + msg="Generated files are out of date. Please run script/generate.sh and commit the results" + if [ -n "$GITHUB_ACTIONS" ]; then + echo "::error ::$msg" + else + echo "$msg" 1>&2 + fi + git diff + exit 1 + } + ) + exit 0 +fi + +MOD_DIRS="$(git ls-files '*go.mod' | xargs dirname | sort)" + +for dir in $MOD_DIRS; do + ( + cd "$dir" + go generate ./... + go mod tidy -compat '1.17' + ) +done diff --git a/script/lint.sh b/script/lint.sh new file mode 100755 index 00000000000..af5ae991006 --- /dev/null +++ b/script/lint.sh @@ -0,0 +1,38 @@ +#!/bin/sh +#/ script/lint.sh runs linters and validates generated files. + +set -e + +GOLANGCI_LINT_VERSION="1.54.2" + +CDPATH="" cd -- "$(dirname -- "$0")/.." +BIN="$(pwd -P)"/bin + +mkdir -p "$BIN" + +# install golangci-lint bin/golangci-lint doesn't exist with the correct version +if ! "$BIN"/golangci-lint --version 2> /dev/null | grep -q "$GOLANGCI_LINT_VERSION"; then + GOBIN="$BIN" go install "github.com/golangci/golangci-lint/cmd/golangci-lint@v$GOLANGCI_LINT_VERSION" +fi + +MOD_DIRS="$(git ls-files '*go.mod' | xargs dirname | sort)" + +for dir in $MOD_DIRS; do + [ "$dir" = "example/newreposecretwithlibsodium" ] && continue + echo linting "$dir" + ( + cd "$dir" + # github actions output when running in an action + if [ -n "$GITHUB_ACTIONS" ]; then + "$BIN"/golangci-lint run --path-prefix "$dir" --out-format github-actions + else + "$BIN"/golangci-lint run --path-prefix "$dir" + fi + ) || FAILED=1 +done + +script/generate.sh --check || FAILED=1 + +if [ -n "$FAILED" ]; then + exit 1 +fi diff --git a/script/test.sh b/script/test.sh new file mode 100755 index 00000000000..23e6a0c8f84 --- /dev/null +++ b/script/test.sh @@ -0,0 +1,26 @@ +#!/bin/sh +#/ script/test.sh runs tests on each go module in go-github. Arguments are passed to each go test invocation. +#/ "-race -covermode atomic ./..." is used when no arguments are given. + +set -e + +CDPATH="" cd -- "$(dirname -- "$0")/.." + +if [ "$#" = "0" ]; then + set -- -race -covermode atomic ./... +fi + +MOD_DIRS="$(git ls-files '*go.mod' | xargs dirname | sort)" + +for dir in $MOD_DIRS; do + [ "$dir" = "example/newreposecretwithlibsodium" ] && continue + echo "testing $dir" + ( + cd "$dir" + go test "$@" + ) || FAILED=1 +done + +if [ -n "$FAILED" ]; then + exit 1 +fi From aa3fcbe7aabce60227eb210c0c81a8722770590d Mon Sep 17 00:00:00 2001 From: WillAbides <233500+WillAbides@users.noreply.github.com> Date: Thu, 21 Sep 2023 08:58:34 -0500 Subject: [PATCH 025/145] Remove openpgp and change CreateCommit signature (#2935) Fixes: #2932. --- example/commitpr/main.go | 24 ++- example/go.mod | 2 +- example/go.sum | 39 +++- example/newreposecretwithlibsodium/go.sum | 54 ----- github/git_commits.go | 58 ++++-- github/git_commits_test.go | 230 +++++++--------------- github/repos_commits_test.go | 2 - github/repos_contents_test.go | 2 - go.mod | 7 - go.sum | 18 -- 10 files changed, 169 insertions(+), 267 deletions(-) diff --git a/example/commitpr/main.go b/example/commitpr/main.go index 328afda5469..7e73d7ffdef 100644 --- a/example/commitpr/main.go +++ b/example/commitpr/main.go @@ -21,15 +21,18 @@ package main import ( + "bytes" "context" "errors" "flag" "fmt" + "io" "log" "os" "strings" "time" + "github.com/ProtonMail/go-crypto/openpgp" "github.com/google/go-github/v55/github" ) @@ -51,6 +54,7 @@ If the file should be in the same location with the same name, you can just put Example: README.md,main.go:github/examples/commitpr/main.go`) authorName = flag.String("author-name", "", "Name of the author of the commit.") authorEmail = flag.String("author-email", "", "Email of the author of the commit.") + privateKey = flag.String("private-key", "", "Path to the private key to use to sign the commit.") ) var client *github.Client @@ -135,7 +139,25 @@ func pushCommit(ref *github.Reference, tree *github.Tree) (err error) { date := time.Now() author := &github.CommitAuthor{Date: &github.Timestamp{Time: date}, Name: authorName, Email: authorEmail} commit := &github.Commit{Author: author, Message: commitMessage, Tree: tree, Parents: []*github.Commit{parent.Commit}} - newCommit, _, err := client.Git.CreateCommit(ctx, *sourceOwner, *sourceRepo, commit) + opts := github.CreateCommitOptions{} + if *privateKey != "" { + armoredBlock, e := os.ReadFile(*privateKey) + if e != nil { + return e + } + keyring, e := openpgp.ReadArmoredKeyRing(bytes.NewReader(armoredBlock)) + if e != nil { + return e + } + if len(keyring) != 1 { + return errors.New("expected exactly one key in the keyring") + } + key := keyring[0] + opts.Signer = github.MessageSignerFunc(func(w io.Writer, r io.Reader) error { + return openpgp.ArmoredDetachSign(w, key, r, nil) + }) + } + newCommit, _, err := client.Git.CreateCommit(ctx, *sourceOwner, *sourceRepo, commit, &opts) if err != nil { return err } diff --git a/example/go.mod b/example/go.mod index eaf9f5b6926..7f7c9ededaa 100644 --- a/example/go.mod +++ b/example/go.mod @@ -3,6 +3,7 @@ module github.com/google/go-github/v55/example go 1.17 require ( + github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 github.com/bradleyfalzon/ghinstallation/v2 v2.0.4 github.com/gofri/go-github-ratelimit v1.0.3 github.com/google/go-github/v55 v55.0.0 @@ -12,7 +13,6 @@ require ( ) require ( - github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 // indirect github.com/cloudflare/circl v1.3.3 // indirect github.com/golang-jwt/jwt/v4 v4.0.0 // indirect github.com/golang/protobuf v1.5.2 // indirect diff --git a/example/go.sum b/example/go.sum index 513022c3565..7b1a57e73c8 100644 --- a/example/go.sum +++ b/example/go.sum @@ -1,9 +1,8 @@ -github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 h1:wPbRQzjjwFc0ih8puEVAOFGELsn1zoIIYdxvML7mDxA= -github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8/go.mod h1:I0gYDMZ6Z5GRU7l58bNFSkPTFN6Yl12dsUlAZ8xy98g= +github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 h1:kkhsdkhsCvIsutKu5zLMgWtgh9YxGCNAw8Ad8hjwfYg= +github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= github.com/bradleyfalzon/ghinstallation/v2 v2.0.4 h1:tXKVfhE7FcSkhkv0UwkLvPDeZ4kz6OXd0PKPlFqf81M= github.com/bradleyfalzon/ghinstallation/v2 v2.0.4/go.mod h1:B40qPqJxWE0jDZgOR1JmaMy+4AY1eBP+IByOvqyAKp0= -github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= -github.com/cloudflare/circl v1.1.0/go.mod h1:prBCrKB9DV4poKZY1l9zBXg2QJY7mvgRvtMxxK7fi4I= +github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/cloudflare/circl v1.3.3 h1:fE/Qz0QdIGqeWfnwq0RE0R7MI51s0M2E4Ga9kq5AEMs= github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= github.com/gofri/go-github-ratelimit v1.0.3 h1:Ocs2jaYokZDzgvqaajX+g04dqFyVqL0JQzoO7d2wmlk= @@ -23,29 +22,59 @@ github.com/google/go-github/v41 v41.0.0 h1:HseJrM2JFf2vfiZJ8anY2hqBjdfY1Vlj/K27u github.com/google/go-github/v41 v41.0.0/go.mod h1:XgmCA5H323A9rtgExdTcnDkcqp6S30AVACCBDOonIxg= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= +golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0= golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= diff --git a/example/newreposecretwithlibsodium/go.sum b/example/newreposecretwithlibsodium/go.sum index 236b1e435bd..dd58884a049 100644 --- a/example/newreposecretwithlibsodium/go.sum +++ b/example/newreposecretwithlibsodium/go.sum @@ -1,62 +1,8 @@ github.com/GoKillers/libsodium-go v0.0.0-20171022220152-dd733721c3cb h1:ilqSFSbR1fq6x88heeHrvAqlg+ES+tZk2ZcaCmiH1gI= github.com/GoKillers/libsodium-go v0.0.0-20171022220152-dd733721c3cb/go.mod h1:72TQeEkiDH9QMXZa5nJJvZre0UjqqO67X2QEIoOwCRU= -github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 h1:wPbRQzjjwFc0ih8puEVAOFGELsn1zoIIYdxvML7mDxA= -github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8/go.mod h1:I0gYDMZ6Z5GRU7l58bNFSkPTFN6Yl12dsUlAZ8xy98g= -github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= -github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= -github.com/cloudflare/circl v1.1.0/go.mod h1:prBCrKB9DV4poKZY1l9zBXg2QJY7mvgRvtMxxK7fi4I= -github.com/cloudflare/circl v1.3.3 h1:fE/Qz0QdIGqeWfnwq0RE0R7MI51s0M2E4Ga9kq5AEMs= -github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= -golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= -golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= -golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/github/git_commits.go b/github/git_commits.go index 862837c0d59..1a683bc34c9 100644 --- a/github/git_commits.go +++ b/github/git_commits.go @@ -10,9 +10,8 @@ import ( "context" "errors" "fmt" + "io" "strings" - - "github.com/ProtonMail/go-crypto/openpgp" ) // SignatureVerification represents GPG signature verification. @@ -23,6 +22,25 @@ type SignatureVerification struct { Payload *string `json:"payload,omitempty"` } +// MessageSigner is used by GitService.CreateCommit to sign a commit. +// +// To create a MessageSigner that signs a commit with a [golang.org/x/crypto/openpgp.Entity], +// or [github.com/ProtonMail/go-crypto/openpgp.Entity], use: +// +// commit.Signer = github.MessageSignerFunc(func(w io.Writer, r io.Reader) error { +// return openpgp.ArmoredDetachSign(w, openpgpEntity, r, nil) +// }) +type MessageSigner interface { + Sign(w io.Writer, r io.Reader) error +} + +// MessageSignerFunc is a single function implementation of MessageSigner. +type MessageSignerFunc func(w io.Writer, r io.Reader) error + +func (f MessageSignerFunc) Sign(w io.Writer, r io.Reader) error { + return f(w, r) +} + // Commit represents a GitHub commit. type Commit struct { SHA *string `json:"sha,omitempty"` @@ -41,11 +59,6 @@ type Commit struct { // is only populated for requests that fetch GitHub data like // Pulls.ListCommits, Repositories.ListCommits, etc. CommentCount *int `json:"comment_count,omitempty"` - - // SigningKey denotes a key to sign the commit with. If not nil this key will - // be used to sign the commit. The private key must be present and already - // decrypted. Ignored if Verification.Signature is defined. - SigningKey *openpgp.Entity `json:"-"` } func (c Commit) String() string { @@ -96,6 +109,12 @@ type createCommit struct { Signature *string `json:"signature,omitempty"` } +type CreateCommitOptions struct { + // CreateCommit will sign the commit with this signer. See MessageSigner doc for more details. + // Ignored on commits where Verification.Signature is defined. + Signer MessageSigner +} + // CreateCommit creates a new commit in a repository. // commit must not be nil. // @@ -104,10 +123,13 @@ type createCommit struct { // the authenticated user’s information and the current date. // // GitHub API docs: https://docs.github.com/en/rest/git/commits#create-a-commit -func (s *GitService) CreateCommit(ctx context.Context, owner string, repo string, commit *Commit) (*Commit, *Response, error) { +func (s *GitService) CreateCommit(ctx context.Context, owner string, repo string, commit *Commit, opts *CreateCommitOptions) (*Commit, *Response, error) { if commit == nil { return nil, nil, fmt.Errorf("commit must be provided") } + if opts == nil { + opts = &CreateCommitOptions{} + } u := fmt.Sprintf("repos/%v/%v/git/commits", owner, repo) @@ -125,16 +147,16 @@ func (s *GitService) CreateCommit(ctx context.Context, owner string, repo string if commit.Tree != nil { body.Tree = commit.Tree.SHA } - if commit.SigningKey != nil { - signature, err := createSignature(commit.SigningKey, body) + switch { + case commit.Verification != nil: + body.Signature = commit.Verification.Signature + case opts.Signer != nil: + signature, err := createSignature(opts.Signer, body) if err != nil { return nil, nil, err } body.Signature = &signature } - if commit.Verification != nil { - body.Signature = commit.Verification.Signature - } req, err := s.client.NewRequest("POST", u, body) if err != nil { @@ -150,8 +172,8 @@ func (s *GitService) CreateCommit(ctx context.Context, owner string, repo string return c, resp, nil } -func createSignature(signingKey *openpgp.Entity, commit *createCommit) (string, error) { - if signingKey == nil || commit == nil { +func createSignature(signer MessageSigner, commit *createCommit) (string, error) { + if signer == nil { return "", errors.New("createSignature: invalid parameters") } @@ -160,9 +182,9 @@ func createSignature(signingKey *openpgp.Entity, commit *createCommit) (string, return "", err } - writer := new(bytes.Buffer) - reader := bytes.NewReader([]byte(message)) - if err := openpgp.ArmoredDetachSign(writer, signingKey, reader, nil); err != nil { + var writer bytes.Buffer + err = signer.Sign(&writer, strings.NewReader(message)) + if err != nil { return "", err } diff --git a/github/git_commits_test.go b/github/git_commits_test.go index ddb1672ea72..bc25206b495 100644 --- a/github/git_commits_test.go +++ b/github/git_commits_test.go @@ -9,15 +9,34 @@ import ( "context" "encoding/json" "fmt" + "io" "net/http" - "strings" "testing" "time" - "github.com/ProtonMail/go-crypto/openpgp" "github.com/google/go-cmp/cmp" ) +func mockSigner(t *testing.T, signature string, emitErr error, wantMessage string) MessageSignerFunc { + return func(w io.Writer, r io.Reader) error { + t.Helper() + message, err := io.ReadAll(r) + assertNilError(t, err) + if wantMessage != "" && string(message) != wantMessage { + t.Errorf("MessageSignerFunc got %q, want %q", string(message), wantMessage) + } + assertWrite(t, w, []byte(signature)) + return emitErr + } +} + +func uncalledSigner(t *testing.T) MessageSignerFunc { + return func(w io.Writer, r io.Reader) error { + t.Error("MessageSignerFunc should not be called") + return nil + } +} + func TestCommit_Marshal(t *testing.T) { testJSONMarshal(t, &Commit{}, "{}") @@ -65,7 +84,6 @@ func TestCommit_Marshal(t *testing.T) { }, NodeID: String("n"), CommentCount: Int(1), - SigningKey: &openpgp.Entity{}, } want := `{ @@ -190,7 +208,7 @@ func TestGitService_CreateCommit(t *testing.T) { }) ctx := context.Background() - commit, _, err := client.Git.CreateCommit(ctx, "o", "r", input) + commit, _, err := client.Git.CreateCommit(ctx, "o", "r", input, nil) if err != nil { t.Errorf("Git.CreateCommit returned error: %v", err) } @@ -202,12 +220,12 @@ func TestGitService_CreateCommit(t *testing.T) { const methodName = "CreateCommit" testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Git.CreateCommit(ctx, "\n", "\n", input) + _, _, err = client.Git.CreateCommit(ctx, "\n", "\n", input, nil) return err }) testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Git.CreateCommit(ctx, "o", "r", input) + got, resp, err := client.Git.CreateCommit(ctx, "o", "r", input, nil) if got != nil { t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) } @@ -249,7 +267,7 @@ func TestGitService_CreateSignedCommit(t *testing.T) { }) ctx := context.Background() - commit, _, err := client.Git.CreateCommit(ctx, "o", "r", input) + commit, _, err := client.Git.CreateCommit(ctx, "o", "r", input, nil) if err != nil { t.Errorf("Git.CreateCommit returned error: %v", err) } @@ -261,12 +279,12 @@ func TestGitService_CreateSignedCommit(t *testing.T) { const methodName = "CreateCommit" testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Git.CreateCommit(ctx, "\n", "\n", input) + _, _, err = client.Git.CreateCommit(ctx, "\n", "\n", input, nil) return err }) testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Git.CreateCommit(ctx, "o", "r", input) + got, resp, err := client.Git.CreateCommit(ctx, "o", "r", input, nil) if got != nil { t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) } @@ -278,103 +296,78 @@ func TestGitService_CreateSignedCommitWithInvalidParams(t *testing.T) { client, _, _, teardown := setup() defer teardown() - input := &Commit{ - SigningKey: &openpgp.Entity{}, - } + input := &Commit{} ctx := context.Background() - _, _, err := client.Git.CreateCommit(ctx, "o", "r", input) + opts := CreateCommitOptions{Signer: uncalledSigner(t)} + _, _, err := client.Git.CreateCommit(ctx, "o", "r", input, &opts) if err == nil { t.Errorf("Expected error to be returned because invalid params were passed") } } -func TestGitService_CreateSignedCommitWithNilCommit(t *testing.T) { +func TestGitService_CreateCommitWithNilCommit(t *testing.T) { client, _, _, teardown := setup() defer teardown() ctx := context.Background() - _, _, err := client.Git.CreateCommit(ctx, "o", "r", nil) + _, _, err := client.Git.CreateCommit(ctx, "o", "r", nil, nil) if err == nil { t.Errorf("Expected error to be returned because commit=nil") } } -func TestGitService_CreateSignedCommitWithKey(t *testing.T) { +func TestGitService_CreateCommit_WithSigner(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - s := strings.NewReader(testGPGKey) - keyring, err := openpgp.ReadArmoredKeyRing(s) - if err != nil { - t.Errorf("Error reading keyring: %+v", err) - } - - // Set the key lifetime to nil so we don't care about the example key expiring and making tests fail - keyring[0].Identities["go-github "].SelfSignature.KeyLifetimeSecs = nil - - date, _ := time.Parse("Mon Jan 02 15:04:05 2006 -0700", "Thu May 04 00:03:43 2017 +0200") + signature := "my voice is my password" + date := time.Date(2017, time.May, 4, 0, 3, 43, 0, time.FixedZone("CEST", 2*3600)) author := CommitAuthor{ Name: String("go-github"), Email: String("go-github@github.com"), Date: &Timestamp{date}, } - input := &Commit{ - Message: String("Commit Message."), - Tree: &Tree{SHA: String("t")}, - Parents: []*Commit{{SHA: String("p")}}, - SigningKey: keyring[0], - Author: &author, - } - - messageReader := strings.NewReader(`tree t + wantMessage := `tree t parent p author go-github 1493849023 +0200 committer go-github 1493849023 +0200 -Commit Message.`) - +Commit Message.` + sha := "commitSha" + input := &Commit{ + SHA: &sha, + Message: String("Commit Message."), + Tree: &Tree{SHA: String("t")}, + Parents: []*Commit{{SHA: String("p")}}, + Author: &author, + } + wantBody := createCommit{ + Message: input.Message, + Tree: String("t"), + Parents: []string{"p"}, + Author: &author, + Signature: &signature, + } + var gotBody createCommit mux.HandleFunc("/repos/o/r/git/commits", func(w http.ResponseWriter, r *http.Request) { - v := new(createCommit) - assertNilError(t, json.NewDecoder(r.Body).Decode(v)) - + assertNilError(t, json.NewDecoder(r.Body).Decode(&gotBody)) testMethod(t, r, "POST") - - want := &createCommit{ - Message: input.Message, - Tree: String("t"), - Parents: []string{"p"}, - Author: &author, - } - - sigReader := strings.NewReader(*v.Signature) - signer, err := openpgp.CheckArmoredDetachedSignature(keyring, messageReader, sigReader, nil) - if err != nil { - t.Errorf("Error verifying signature: %+v", err) - } - if signer.Identities["go-github "].Name != "go-github " { - t.Errorf("Signer is incorrect. got: %+v, want %+v", signer.Identities["go-github "].Name, "go-github ") - } - // Nullify Signature since we checked it above - v.Signature = nil - if !cmp.Equal(v, want) { - t.Errorf("Request body = %+v, want %+v", v, want) - } - fmt.Fprint(w, `{"sha":"commitSha"}`) + fmt.Fprintf(w, `{"sha":"%s"}`, sha) }) - ctx := context.Background() - commit, _, err := client.Git.CreateCommit(ctx, "o", "r", input) - if err != nil { - t.Errorf("Git.CreateCommit returned error: %v", err) + wantCommit := &Commit{SHA: String(sha)} + opts := CreateCommitOptions{Signer: mockSigner(t, signature, nil, wantMessage)} + commit, _, err := client.Git.CreateCommit(ctx, "o", "r", input, &opts) + assertNilError(t, err) + if cmp.Diff(gotBody, wantBody) != "" { + t.Errorf("Request body = %+v, want %+v\n%s", gotBody, wantBody, cmp.Diff(gotBody, wantBody)) } - - want := &Commit{SHA: String("commitSha")} - if !cmp.Equal(commit, want) { - t.Errorf("Git.CreateCommit returned %+v, want %+v", commit, want) + if cmp.Diff(commit, wantCommit) != "" { + t.Errorf("Git.CreateCommit returned %+v, want %+v\n%s", commit, wantCommit, cmp.Diff(commit, wantCommit)) } } -func TestGitService_createSignature_nilSigningKey(t *testing.T) { +func TestGitService_createSignature_nilSigner(t *testing.T) { a := &createCommit{ Message: String("Commit Message."), Tree: String("t"), @@ -389,48 +382,26 @@ func TestGitService_createSignature_nilSigningKey(t *testing.T) { } func TestGitService_createSignature_nilCommit(t *testing.T) { - _, err := createSignature(&openpgp.Entity{}, nil) + _, err := createSignature(uncalledSigner(t), nil) if err == nil { t.Errorf("Expected error to be returned because no author was passed") } } -func TestGitService_createSignature_noAuthor(t *testing.T) { +func TestGitService_createSignature_signerError(t *testing.T) { a := &createCommit{ Message: String("Commit Message."), Tree: String("t"), Parents: []string{"p"}, + Author: &CommitAuthor{Name: String("go-github")}, } - _, err := createSignature(&openpgp.Entity{}, a) - - if err == nil { - t.Errorf("Expected error to be returned because no author was passed") - } -} - -func TestGitService_createSignature_invalidKey(t *testing.T) { - date, _ := time.Parse("Mon Jan 02 15:04:05 2006 -0700", "Thu May 04 00:03:43 2017 +0200") - authorName := "go-github" - authorEmail := "go-github@github.com" - - signKey, _ := openpgp.NewEntity(authorName, "", authorEmail, nil) - _ = signKey.RevokeKey(0, "Invalidate key", nil) - - _, err := createSignature(signKey, &createCommit{ - Message: String("Commit Message."), - Tree: String("t"), - Parents: []string{"p"}, - Author: &CommitAuthor{ - Name: String("go-github"), - Email: String("go-github@github.com"), - Date: &Timestamp{date}, - }, - }) + signer := mockSigner(t, "", fmt.Errorf("signer error"), "") + _, err := createSignature(signer, a) if err == nil { - t.Errorf("Expected error to be returned due to invalid key") + t.Errorf("Expected error to be returned because signer returned an error") } } @@ -540,69 +511,10 @@ func TestGitService_CreateCommit_invalidOwner(t *testing.T) { defer teardown() ctx := context.Background() - _, _, err := client.Git.CreateCommit(ctx, "%", "%", &Commit{}) + _, _, err := client.Git.CreateCommit(ctx, "%", "%", &Commit{}, nil) testURLParseError(t, err) } -const testGPGKey = ` ------BEGIN PGP PRIVATE KEY BLOCK----- - -lQOYBFyi1qYBCAD3EPfLJzIt4qkAceUKkhdvfaIvOsBwXbfr5sSu/lkMqL0Wq47+ -iv+SRwOC7zvN8SlB8nPUgs5dbTRCJJfG5MAqTRR7KZRbyq2jBpi4BtmO30Ul/qId -3A18cVUfgVbxH85K9bdnyOxep/Q2NjLjTKmWLkzgmgkfbUmSLuWW9HRXPjYy9B7i -dOFD6GdkN/HwPAaId8ym0TE1mIuSpw8UQHyxusAkK52Pn4h/PgJhLTzbSi1X2eDt -OgzjhbdxTPzKFQfs97dY8y9C7Bt+CqH6Bvr3785LeKdxiUnCjfUJ+WAoJy780ec+ -IVwSpPp1CaEtzu73w6GH5945GELHE8HRe25FABEBAAEAB/9dtx72/VAoXZCTbaBe -iRnAnZwWZCe4t6PbJHa4lhv7FEpdPggIf3r/5lXrpYk+zdpDfI75LgDPKWwoJq83 -r29A3GoHabcvtkp0yzzEmTyO2BvnlJWz09N9v5N1Vt8+qTzb7CZ8hJc8NGMK6TYW -R+8P21In4+XP+OluPMGzp9g1etHScLhQUtF/xcN3JQGkeq4CPX6jUSYlJNeEtuLm -xjBTLBdg8zK5mJ3tolvnS/VhSTdiBeUaYtVt/qxq+fPqdFGHrO5H9ORbt56ahU+f -Ne86sOjQfJZPsx9z8ffP+XhLZPT1ZUGJMI/Vysx9gwDiEnaxrCJ02fO0Dnqsj/o2 -T14lBAD55+KtaS0C0OpHpA/F+XhL3IDcYQOYgu8idBTshr4vv7M+jdZqpECOn72Q -8SZJ+gYMcA9Z07Afnin1DVdtxiMN/tbyOu7e1BE7y77eA+zQw4PjLJPZJMbco7z+ -q9ZnZF3GyRyil6HkKUTfrao8AMtb0allZnqXwpPb5Mza32VqtwQA/RdbG6OIS6og -OpP7zKu4GP4guBk8NrVpVuV5Xz4r8JlL+POt0TadlT93coW/SajLrN/eeUwk6jQw -wrabmIGMarG5mrC4tnXLze5LICJTpOuqCACyFwL6w/ag+c7Qt9t9hvLMDFifcZW/ -mylqY7Z1eVcnbOcFsQG+0LzJBU0qouMEAKkXmJcQ3lJM8yoJuYOvbwexVR+5Y+5v -FNEGPlp3H/fq6ETYWHjMxPOE5dvGbQL8oKWZgkkHEGAKAavEGebM/y/qIPOCAluT -tn1sfx//n6kTMhswpg/3+BciUaJFjwYbIwUH5XD0vFbe9O2VOfTVdo1p19wegVs5 -LMf8rWFWYXtqUgG0IGdvLWdpdGh1YiA8Z28tZ2l0aHViQGdpdGh1Yi5jb20+iQFU -BBMBCAA+FiEELZ6AMqOpBMVblK0uiKTQXVy+MAsFAlyi1qYCGwMFCQPCZwAFCwkI -BwIGFQoJCAsCBBYCAwECHgECF4AACgkQiKTQXVy+MAtEYggA0LRecz71HUjEKXJj -C5Wgds1hZ0q+g3ew7zms4fuascd/2PqT5lItHU3oezdzMOHetSPvPzJILjl7RYcY -pWvoyzEBC5MutlmuzfwUa7qYCiuRDkYRjke8a4o8ijsxc8ANXwulXcI3udjAZdV0 -CKjrjPTyrHFUnPyZyaZp8p2eX62iPYhaXkoBnEiarf0xKtJuT/8IlP5n/redlKYz -GIHG5Svg3uDq9E09BOjFsgemhPyqbf7yrh5aRwDOIdHtn9mNevFPfQ1jO8lI/wbe -4kC6zXM7te0/ZkM06DYRhcaeoYdeyY/gvE+w7wU/+f7Wzqt+LxOMIjKk0oDxZIv9 -praEM50DmARcotamAQgAsiO75WZvjt7BEAzdTvWekWXqBo4NOes2UgzSYToVs6xW -8iXnE+mpDS7GHtNQLU6oeC0vizUjCwBfU+qGqw1JjI3I1pwv7xRqBIlA6f5ancVK -KiMx+/HxasbBrbav8DmZT8E8VaJhYM614Kav91W8YoqK5YXmP/A+OwwhkVEGo8v3 -Iy7mnJPMSjNiNTpiDgc5wvRiTan+uf+AtNPUS0k0fbrTZWosbrSmBymhrEy8stMj -rG2wZX5aRY7AXrQXoIXedqvP3kW/nqd0wvuiD11ZZWvoawjZRRVsT27DED0x2+o6 -aAEKrSLj8LlWvGVkD/jP9lSkC81uwGgD5VIMeXv6EQARAQABAAf7BHef8SdJ+ee9 -KLVh4WaIdPX80fBDBaZP5OvcZMLLo4dZYNYxfs7XxfRb1I8RDinQUL81V4TcHZ0D -Rvv1J5n8M7GkjTk6fIDjDb0RayzNQfKeIwNh8AMHvllApyYTMG+JWDYs2KrrTT2x -0vHrLMUyJbh6tjnO5eCU9u8dcmL5Syc6DzGUvDl6ZdJxlHEEJOwMlVCwQn5LQDVI -t0KEXigqs7eDCpTduJeAI7oA96s/8LwdlG5t6q9vbkEjl1XpR5FfKvJcZbd7Kmk9 -6R0EdbH6Ffe8qAp8lGmjx+91gqeL7jyl500H4gK/ybzlxQczIsbQ7WcZTPEnROIX -tCFWh6puvwQAyV6ygcatz+1BfCfgxWNYFXyowwOGSP9Nma+/aDVdeRCjZ69Is0lz -GV0NNqh7hpaoVbXS9Vc3sFOwBr5ZyKQaf07BoCDW+XJtvPyyZNLb004smtB5uHCf -uWDBpQ9erlrpSkOLgifbzfkYHdSvhc2ws9Tgab7Mk7P/ExOZjnUJPOcEAOJ3q/2/ -0wqRnkSelgkWwUmZ+hFIBz6lgWS3KTJs6Qc5WBnXono+EOoqhFxsiRM4lewExxHM -kPIcxb+0hiNz8hJkWOHEdgkXNim9Q08J0HPz6owtlD/rtmOi2+7d5BukbY/3JEXs -r2bjqbXXIE7heytIn/dQv7aEDyDqexiJKnpHBACQItjuYlewLt94NMNdGcwxmKdJ -bfaoIQz1h8fX5uSGKU+hXatI6sltD9PrhwwhdqJNcQ0K1dRkm24olO4I/sJwactI -G3r1UTq6BMV94eIyS/zZH5xChlOUavy9PrgU3kAK21bdmAFuNwbHnN34BBUk9J6f -IIxEZUOxw2CrKhsubUOuiQE8BBgBCAAmFiEELZ6AMqOpBMVblK0uiKTQXVy+MAsF -Alyi1qYCGwwFCQPCZwAACgkQiKTQXVy+MAstJAf/Tm2hfagVjzgJ5pFHmpP+fYxp -8dIPZLonP5HW12iaSOXThtvWBY578Cb9RmU+WkHyPXg8SyshW7aco4HrUDk+Qmyi -f9BvHS5RsLbyPlhgCqNkn+3QS62fZiIlbHLrQ/6iHXkgLV04Fnj+F4v8YYpOI9nY -NFc5iWm0zZRcLiRKZk1up8SCngyolcjVuTuCXDKyAUX1jRqDu7tlN0qVH0CYDGch -BqTKXNkzAvV+CKOyaUILSBBWdef+cxVrDCJuuC3894x3G1FjJycOy0m9PArvGtSG -g7/0Bp9oLXwiHzFoUMDvx+WlPnPHQNcufmQXUNdZvg+Ad4/unEU81EGDBDz3Eg== -=VFSn ------END PGP PRIVATE KEY BLOCK-----` - func TestSignatureVerification_Marshal(t *testing.T) { testJSONMarshal(t, &SignatureVerification{}, "{}") diff --git a/github/repos_commits_test.go b/github/repos_commits_test.go index fb8b45d4439..8fa8eb9f401 100644 --- a/github/repos_commits_test.go +++ b/github/repos_commits_test.go @@ -14,7 +14,6 @@ import ( "testing" "time" - "github.com/ProtonMail/go-crypto/openpgp" "github.com/google/go-cmp/cmp" ) @@ -713,7 +712,6 @@ func TestBranchCommit_Marshal(t *testing.T) { }, NodeID: String("n"), CommentCount: Int(1), - SigningKey: &openpgp.Entity{}, }, Protected: Bool(false), } diff --git a/github/repos_contents_test.go b/github/repos_contents_test.go index f9613069209..91da567f4aa 100644 --- a/github/repos_contents_test.go +++ b/github/repos_contents_test.go @@ -14,7 +14,6 @@ import ( "net/url" "testing" - "github.com/ProtonMail/go-crypto/openpgp" "github.com/google/go-cmp/cmp" ) @@ -885,7 +884,6 @@ func TestRepositoryContentResponse_Marshal(t *testing.T) { }, NodeID: String("n"), CommentCount: Int(1), - SigningKey: &openpgp.Entity{}, }, } diff --git a/go.mod b/go.mod index c41237ead0e..05f97f6f1ff 100644 --- a/go.mod +++ b/go.mod @@ -1,15 +1,8 @@ module github.com/google/go-github/v55 require ( - github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 github.com/google/go-cmp v0.5.9 github.com/google/go-querystring v1.1.0 ) -require ( - github.com/cloudflare/circl v1.3.3 // indirect - golang.org/x/crypto v0.12.0 // indirect - golang.org/x/sys v0.11.0 // indirect -) - go 1.17 diff --git a/go.sum b/go.sum index 3317d0c67b7..a2c5fe4a12f 100644 --- a/go.sum +++ b/go.sum @@ -1,24 +1,6 @@ -github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 h1:wPbRQzjjwFc0ih8puEVAOFGELsn1zoIIYdxvML7mDxA= -github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8/go.mod h1:I0gYDMZ6Z5GRU7l58bNFSkPTFN6Yl12dsUlAZ8xy98g= -github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= -github.com/cloudflare/circl v1.1.0/go.mod h1:prBCrKB9DV4poKZY1l9zBXg2QJY7mvgRvtMxxK7fi4I= -github.com/cloudflare/circl v1.3.3 h1:fE/Qz0QdIGqeWfnwq0RE0R7MI51s0M2E4Ga9kq5AEMs= -github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= -golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= From 2d889e8d865c3bb7345366252f336d7cff366ea0 Mon Sep 17 00:00:00 2001 From: k0ral Date: Mon, 25 Sep 2023 17:07:47 +0000 Subject: [PATCH 026/145] Allow up to maxRedirects upon receiving HTTP 301 status (#2939) --- github/actions_artifacts.go | 4 ++-- github/actions_artifacts_test.go | 14 +++++++------- github/actions_workflow_jobs.go | 4 ++-- github/actions_workflow_jobs_test.go | 10 +++++----- github/actions_workflow_runs.go | 8 ++++---- github/actions_workflow_runs_test.go | 20 ++++++++++---------- github/github.go | 6 +++--- github/repos.go | 4 ++-- github/repos_contents.go | 4 ++-- github/repos_contents_test.go | 10 +++++----- github/repos_test.go | 12 ++++++------ test/integration/repos_test.go | 4 ++-- 12 files changed, 50 insertions(+), 50 deletions(-) diff --git a/github/actions_artifacts.go b/github/actions_artifacts.go index 441a53910e3..6389268b4ea 100644 --- a/github/actions_artifacts.go +++ b/github/actions_artifacts.go @@ -121,10 +121,10 @@ func (s *ActionsService) GetArtifact(ctx context.Context, owner, repo string, ar // DownloadArtifact gets a redirect URL to download an archive for a repository. // // GitHub API docs: https://docs.github.com/en/rest/actions/artifacts#download-an-artifact -func (s *ActionsService) DownloadArtifact(ctx context.Context, owner, repo string, artifactID int64, followRedirects bool) (*url.URL, *Response, error) { +func (s *ActionsService) DownloadArtifact(ctx context.Context, owner, repo string, artifactID int64, maxRedirects int) (*url.URL, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/artifacts/%v/zip", owner, repo, artifactID) - resp, err := s.client.roundTripWithOptionalFollowRedirect(ctx, u, followRedirects) + resp, err := s.client.roundTripWithOptionalFollowRedirect(ctx, u, maxRedirects) if err != nil { return nil, nil, err } diff --git a/github/actions_artifacts_test.go b/github/actions_artifacts_test.go index de07c14f847..296e7259c08 100644 --- a/github/actions_artifacts_test.go +++ b/github/actions_artifacts_test.go @@ -277,7 +277,7 @@ func TestActionsSerivice_DownloadArtifact(t *testing.T) { }) ctx := context.Background() - url, resp, err := client.Actions.DownloadArtifact(ctx, "o", "r", 1, true) + url, resp, err := client.Actions.DownloadArtifact(ctx, "o", "r", 1, 1) if err != nil { t.Errorf("Actions.DownloadArtifact returned error: %v", err) } @@ -292,7 +292,7 @@ func TestActionsSerivice_DownloadArtifact(t *testing.T) { const methodName = "DownloadArtifact" testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Actions.DownloadArtifact(ctx, "\n", "\n", -1, true) + _, _, err = client.Actions.DownloadArtifact(ctx, "\n", "\n", -1, 1) return err }) @@ -301,7 +301,7 @@ func TestActionsSerivice_DownloadArtifact(t *testing.T) { return nil, errors.New("failed to download artifact") }) testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Actions.DownloadArtifact(ctx, "o", "r", 1, true) + _, _, err = client.Actions.DownloadArtifact(ctx, "o", "r", 1, 1) return err }) } @@ -311,7 +311,7 @@ func TestActionsService_DownloadArtifact_invalidOwner(t *testing.T) { defer teardown() ctx := context.Background() - _, _, err := client.Actions.DownloadArtifact(ctx, "%", "r", 1, true) + _, _, err := client.Actions.DownloadArtifact(ctx, "%", "r", 1, 1) testURLParseError(t, err) } @@ -320,7 +320,7 @@ func TestActionsService_DownloadArtifact_invalidRepo(t *testing.T) { defer teardown() ctx := context.Background() - _, _, err := client.Actions.DownloadArtifact(ctx, "o", "%", 1, true) + _, _, err := client.Actions.DownloadArtifact(ctx, "o", "%", 1, 1) testURLParseError(t, err) } @@ -334,7 +334,7 @@ func TestActionsService_DownloadArtifact_StatusMovedPermanently_dontFollowRedire }) ctx := context.Background() - _, resp, _ := client.Actions.DownloadArtifact(ctx, "o", "r", 1, false) + _, resp, _ := client.Actions.DownloadArtifact(ctx, "o", "r", 1, 0) if resp.StatusCode != http.StatusMovedPermanently { t.Errorf("Actions.DownloadArtifact return status %d, want %d", resp.StatusCode, http.StatusMovedPermanently) } @@ -355,7 +355,7 @@ func TestActionsService_DownloadArtifact_StatusMovedPermanently_followRedirects( }) ctx := context.Background() - url, resp, err := client.Actions.DownloadArtifact(ctx, "o", "r", 1, true) + url, resp, err := client.Actions.DownloadArtifact(ctx, "o", "r", 1, 1) if err != nil { t.Errorf("Actions.DownloadArtifact return error: %v", err) } diff --git a/github/actions_workflow_jobs.go b/github/actions_workflow_jobs.go index 1f018b3e48e..87d117ba9a9 100644 --- a/github/actions_workflow_jobs.go +++ b/github/actions_workflow_jobs.go @@ -115,10 +115,10 @@ func (s *ActionsService) GetWorkflowJobByID(ctx context.Context, owner, repo str // GetWorkflowJobLogs gets a redirect URL to download a plain text file of logs for a workflow job. // // GitHub API docs: https://docs.github.com/en/rest/actions/workflow-jobs#download-job-logs-for-a-workflow-run -func (s *ActionsService) GetWorkflowJobLogs(ctx context.Context, owner, repo string, jobID int64, followRedirects bool) (*url.URL, *Response, error) { +func (s *ActionsService) GetWorkflowJobLogs(ctx context.Context, owner, repo string, jobID int64, maxRedirects int) (*url.URL, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/jobs/%v/logs", owner, repo, jobID) - resp, err := s.client.roundTripWithOptionalFollowRedirect(ctx, u, followRedirects) + resp, err := s.client.roundTripWithOptionalFollowRedirect(ctx, u, maxRedirects) if err != nil { return nil, nil, err } diff --git a/github/actions_workflow_jobs_test.go b/github/actions_workflow_jobs_test.go index 8cea9545003..1cdf4a6c81a 100644 --- a/github/actions_workflow_jobs_test.go +++ b/github/actions_workflow_jobs_test.go @@ -138,7 +138,7 @@ func TestActionsService_GetWorkflowJobLogs(t *testing.T) { }) ctx := context.Background() - url, resp, err := client.Actions.GetWorkflowJobLogs(ctx, "o", "r", 399444496, true) + url, resp, err := client.Actions.GetWorkflowJobLogs(ctx, "o", "r", 399444496, 1) if err != nil { t.Errorf("Actions.GetWorkflowJobLogs returned error: %v", err) } @@ -152,7 +152,7 @@ func TestActionsService_GetWorkflowJobLogs(t *testing.T) { const methodName = "GetWorkflowJobLogs" testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Actions.GetWorkflowJobLogs(ctx, "\n", "\n", 399444496, true) + _, _, err = client.Actions.GetWorkflowJobLogs(ctx, "\n", "\n", 399444496, 1) return err }) @@ -161,7 +161,7 @@ func TestActionsService_GetWorkflowJobLogs(t *testing.T) { return nil, errors.New("failed to get workflow logs") }) testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Actions.GetWorkflowJobLogs(ctx, "o", "r", 399444496, true) + _, _, err = client.Actions.GetWorkflowJobLogs(ctx, "o", "r", 399444496, 1) return err }) } @@ -176,7 +176,7 @@ func TestActionsService_GetWorkflowJobLogs_StatusMovedPermanently_dontFollowRedi }) ctx := context.Background() - _, resp, _ := client.Actions.GetWorkflowJobLogs(ctx, "o", "r", 399444496, false) + _, resp, _ := client.Actions.GetWorkflowJobLogs(ctx, "o", "r", 399444496, 0) if resp.StatusCode != http.StatusMovedPermanently { t.Errorf("Actions.GetWorkflowJobLogs returned status: %d, want %d", resp.StatusCode, http.StatusMovedPermanently) } @@ -199,7 +199,7 @@ func TestActionsService_GetWorkflowJobLogs_StatusMovedPermanently_followRedirect }) ctx := context.Background() - url, resp, err := client.Actions.GetWorkflowJobLogs(ctx, "o", "r", 399444496, true) + url, resp, err := client.Actions.GetWorkflowJobLogs(ctx, "o", "r", 399444496, 1) if err != nil { t.Errorf("Actions.GetWorkflowJobLogs returned error: %v", err) } diff --git a/github/actions_workflow_runs.go b/github/actions_workflow_runs.go index 00221086116..390c26af9c3 100644 --- a/github/actions_workflow_runs.go +++ b/github/actions_workflow_runs.go @@ -211,10 +211,10 @@ func (s *ActionsService) GetWorkflowRunAttempt(ctx context.Context, owner, repo // GetWorkflowRunAttemptLogs gets a redirect URL to download a plain text file of logs for a workflow run for attempt number. // // GitHub API docs: https://docs.github.com/en/rest/actions/workflow-runs#download-workflow-run-attempt-logs -func (s *ActionsService) GetWorkflowRunAttemptLogs(ctx context.Context, owner, repo string, runID int64, attemptNumber int, followRedirects bool) (*url.URL, *Response, error) { +func (s *ActionsService) GetWorkflowRunAttemptLogs(ctx context.Context, owner, repo string, runID int64, attemptNumber int, maxRedirects int) (*url.URL, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/attempts/%v/logs", owner, repo, runID, attemptNumber) - resp, err := s.client.roundTripWithOptionalFollowRedirect(ctx, u, followRedirects) + resp, err := s.client.roundTripWithOptionalFollowRedirect(ctx, u, maxRedirects) if err != nil { return nil, nil, err } @@ -287,10 +287,10 @@ func (s *ActionsService) CancelWorkflowRunByID(ctx context.Context, owner, repo // GetWorkflowRunLogs gets a redirect URL to download a plain text file of logs for a workflow run. // // GitHub API docs: https://docs.github.com/en/rest/actions/workflow-runs#download-workflow-run-logs -func (s *ActionsService) GetWorkflowRunLogs(ctx context.Context, owner, repo string, runID int64, followRedirects bool) (*url.URL, *Response, error) { +func (s *ActionsService) GetWorkflowRunLogs(ctx context.Context, owner, repo string, runID int64, maxRedirects int) (*url.URL, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/logs", owner, repo, runID) - resp, err := s.client.roundTripWithOptionalFollowRedirect(ctx, u, followRedirects) + resp, err := s.client.roundTripWithOptionalFollowRedirect(ctx, u, maxRedirects) if err != nil { return nil, nil, err } diff --git a/github/actions_workflow_runs_test.go b/github/actions_workflow_runs_test.go index 92cd3ad4f2f..8a573c20ac2 100644 --- a/github/actions_workflow_runs_test.go +++ b/github/actions_workflow_runs_test.go @@ -198,7 +198,7 @@ func TestActionsService_GetWorkflowRunAttemptLogs(t *testing.T) { }) ctx := context.Background() - url, resp, err := client.Actions.GetWorkflowRunAttemptLogs(ctx, "o", "r", 399444496, 2, true) + url, resp, err := client.Actions.GetWorkflowRunAttemptLogs(ctx, "o", "r", 399444496, 2, 1) if err != nil { t.Errorf("Actions.GetWorkflowRunAttemptLogs returned error: %v", err) } @@ -212,7 +212,7 @@ func TestActionsService_GetWorkflowRunAttemptLogs(t *testing.T) { const methodName = "GetWorkflowRunAttemptLogs" testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Actions.GetWorkflowRunAttemptLogs(ctx, "\n", "\n", 399444496, 2, true) + _, _, err = client.Actions.GetWorkflowRunAttemptLogs(ctx, "\n", "\n", 399444496, 2, 1) return err }) } @@ -227,7 +227,7 @@ func TestActionsService_GetWorkflowRunAttemptLogs_StatusMovedPermanently_dontFol }) ctx := context.Background() - _, resp, _ := client.Actions.GetWorkflowRunAttemptLogs(ctx, "o", "r", 399444496, 2, false) + _, resp, _ := client.Actions.GetWorkflowRunAttemptLogs(ctx, "o", "r", 399444496, 2, 0) if resp.StatusCode != http.StatusMovedPermanently { t.Errorf("Actions.GetWorkflowRunAttemptLogs returned status: %d, want %d", resp.StatusCode, http.StatusMovedPermanently) } @@ -250,7 +250,7 @@ func TestActionsService_GetWorkflowRunAttemptLogs_StatusMovedPermanently_followR }) ctx := context.Background() - url, resp, err := client.Actions.GetWorkflowRunAttemptLogs(ctx, "o", "r", 399444496, 2, true) + url, resp, err := client.Actions.GetWorkflowRunAttemptLogs(ctx, "o", "r", 399444496, 2, 1) if err != nil { t.Errorf("Actions.GetWorkflowRunAttemptLogs returned error: %v", err) } @@ -266,7 +266,7 @@ func TestActionsService_GetWorkflowRunAttemptLogs_StatusMovedPermanently_followR const methodName = "GetWorkflowRunAttemptLogs" testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Actions.GetWorkflowRunAttemptLogs(ctx, "\n", "\n", 399444496, 2, true) + _, _, err = client.Actions.GetWorkflowRunAttemptLogs(ctx, "\n", "\n", 399444496, 2, 1) return err }) } @@ -397,7 +397,7 @@ func TestActionsService_GetWorkflowRunLogs(t *testing.T) { }) ctx := context.Background() - url, resp, err := client.Actions.GetWorkflowRunLogs(ctx, "o", "r", 399444496, true) + url, resp, err := client.Actions.GetWorkflowRunLogs(ctx, "o", "r", 399444496, 1) if err != nil { t.Errorf("Actions.GetWorkflowRunLogs returned error: %v", err) } @@ -411,7 +411,7 @@ func TestActionsService_GetWorkflowRunLogs(t *testing.T) { const methodName = "GetWorkflowRunLogs" testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Actions.GetWorkflowRunLogs(ctx, "\n", "\n", 399444496, true) + _, _, err = client.Actions.GetWorkflowRunLogs(ctx, "\n", "\n", 399444496, 1) return err }) } @@ -426,7 +426,7 @@ func TestActionsService_GetWorkflowRunLogs_StatusMovedPermanently_dontFollowRedi }) ctx := context.Background() - _, resp, _ := client.Actions.GetWorkflowRunLogs(ctx, "o", "r", 399444496, false) + _, resp, _ := client.Actions.GetWorkflowRunLogs(ctx, "o", "r", 399444496, 0) if resp.StatusCode != http.StatusMovedPermanently { t.Errorf("Actions.GetWorkflowJobLogs returned status: %d, want %d", resp.StatusCode, http.StatusMovedPermanently) } @@ -449,7 +449,7 @@ func TestActionsService_GetWorkflowRunLogs_StatusMovedPermanently_followRedirect }) ctx := context.Background() - url, resp, err := client.Actions.GetWorkflowRunLogs(ctx, "o", "r", 399444496, true) + url, resp, err := client.Actions.GetWorkflowRunLogs(ctx, "o", "r", 399444496, 1) if err != nil { t.Errorf("Actions.GetWorkflowJobLogs returned error: %v", err) } @@ -465,7 +465,7 @@ func TestActionsService_GetWorkflowRunLogs_StatusMovedPermanently_followRedirect const methodName = "GetWorkflowRunLogs" testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Actions.GetWorkflowRunLogs(ctx, "\n", "\n", 399444496, true) + _, _, err = client.Actions.GetWorkflowRunLogs(ctx, "\n", "\n", 399444496, 1) return err }) } diff --git a/github/github.go b/github/github.go index e9ce136b7b6..dace1184719 100644 --- a/github/github.go +++ b/github/github.go @@ -1558,7 +1558,7 @@ func formatRateReset(d time.Duration) string { // When using roundTripWithOptionalFollowRedirect, note that it // is the responsibility of the caller to close the response body. -func (c *Client) roundTripWithOptionalFollowRedirect(ctx context.Context, u string, followRedirects bool, opts ...RequestOption) (*http.Response, error) { +func (c *Client) roundTripWithOptionalFollowRedirect(ctx context.Context, u string, maxRedirects int, opts ...RequestOption) (*http.Response, error) { req, err := c.NewRequest("GET", u, nil, opts...) if err != nil { return nil, err @@ -1577,10 +1577,10 @@ func (c *Client) roundTripWithOptionalFollowRedirect(ctx context.Context, u stri } // If redirect response is returned, follow it - if followRedirects && resp.StatusCode == http.StatusMovedPermanently { + if maxRedirects > 0 && resp.StatusCode == http.StatusMovedPermanently { _ = resp.Body.Close() u = resp.Header.Get("Location") - resp, err = c.roundTripWithOptionalFollowRedirect(ctx, u, false, opts...) + resp, err = c.roundTripWithOptionalFollowRedirect(ctx, u, maxRedirects-1, opts...) } return resp, err } diff --git a/github/repos.go b/github/repos.go index 83fc3f8e734..e09971abea9 100644 --- a/github/repos.go +++ b/github/repos.go @@ -1274,10 +1274,10 @@ func (s *RepositoriesService) ListBranches(ctx context.Context, owner string, re // GetBranch gets the specified branch for a repository. // // GitHub API docs: https://docs.github.com/en/rest/branches/branches#get-a-branch -func (s *RepositoriesService) GetBranch(ctx context.Context, owner, repo, branch string, followRedirects bool) (*Branch, *Response, error) { +func (s *RepositoriesService) GetBranch(ctx context.Context, owner, repo, branch string, maxRedirects int) (*Branch, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v", owner, repo, branch) - resp, err := s.client.roundTripWithOptionalFollowRedirect(ctx, u, followRedirects) + resp, err := s.client.roundTripWithOptionalFollowRedirect(ctx, u, maxRedirects) if err != nil { return nil, nil, err } diff --git a/github/repos_contents.go b/github/repos_contents.go index d59c735df8f..cfb4a6da22f 100644 --- a/github/repos_contents.go +++ b/github/repos_contents.go @@ -313,12 +313,12 @@ const ( // or github.Zipball constant. // // GitHub API docs: https://docs.github.com/en/rest/repos/contents/#get-archive-link -func (s *RepositoriesService) GetArchiveLink(ctx context.Context, owner, repo string, archiveformat ArchiveFormat, opts *RepositoryContentGetOptions, followRedirects bool) (*url.URL, *Response, error) { +func (s *RepositoriesService) GetArchiveLink(ctx context.Context, owner, repo string, archiveformat ArchiveFormat, opts *RepositoryContentGetOptions, maxRedirects int) (*url.URL, *Response, error) { u := fmt.Sprintf("repos/%s/%s/%s", owner, repo, archiveformat) if opts != nil && opts.Ref != "" { u += fmt.Sprintf("/%s", opts.Ref) } - resp, err := s.client.roundTripWithOptionalFollowRedirect(ctx, u, followRedirects) + resp, err := s.client.roundTripWithOptionalFollowRedirect(ctx, u, maxRedirects) if err != nil { return nil, nil, err } diff --git a/github/repos_contents_test.go b/github/repos_contents_test.go index 91da567f4aa..6310e739538 100644 --- a/github/repos_contents_test.go +++ b/github/repos_contents_test.go @@ -694,7 +694,7 @@ func TestRepositoriesService_GetArchiveLink(t *testing.T) { http.Redirect(w, r, "http://github.com/a", http.StatusFound) }) ctx := context.Background() - url, resp, err := client.Repositories.GetArchiveLink(ctx, "o", "r", Tarball, &RepositoryContentGetOptions{Ref: "yo"}, true) + url, resp, err := client.Repositories.GetArchiveLink(ctx, "o", "r", Tarball, &RepositoryContentGetOptions{Ref: "yo"}, 1) if err != nil { t.Errorf("Repositories.GetArchiveLink returned error: %v", err) } @@ -708,7 +708,7 @@ func TestRepositoriesService_GetArchiveLink(t *testing.T) { const methodName = "GetArchiveLink" testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Repositories.GetArchiveLink(ctx, "\n", "\n", Tarball, &RepositoryContentGetOptions{}, true) + _, _, err = client.Repositories.GetArchiveLink(ctx, "\n", "\n", Tarball, &RepositoryContentGetOptions{}, 1) return err }) @@ -717,7 +717,7 @@ func TestRepositoriesService_GetArchiveLink(t *testing.T) { return nil, errors.New("failed to get archive link") }) testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Repositories.GetArchiveLink(ctx, "o", "r", Tarball, &RepositoryContentGetOptions{}, true) + _, _, err = client.Repositories.GetArchiveLink(ctx, "o", "r", Tarball, &RepositoryContentGetOptions{}, 1) return err }) } @@ -730,7 +730,7 @@ func TestRepositoriesService_GetArchiveLink_StatusMovedPermanently_dontFollowRed http.Redirect(w, r, "http://github.com/a", http.StatusMovedPermanently) }) ctx := context.Background() - _, resp, _ := client.Repositories.GetArchiveLink(ctx, "o", "r", Tarball, &RepositoryContentGetOptions{}, false) + _, resp, _ := client.Repositories.GetArchiveLink(ctx, "o", "r", Tarball, &RepositoryContentGetOptions{}, 0) if resp.StatusCode != http.StatusMovedPermanently { t.Errorf("Repositories.GetArchiveLink returned status: %d, want %d", resp.StatusCode, http.StatusMovedPermanently) } @@ -750,7 +750,7 @@ func TestRepositoriesService_GetArchiveLink_StatusMovedPermanently_followRedirec http.Redirect(w, r, "http://github.com/a", http.StatusFound) }) ctx := context.Background() - url, resp, err := client.Repositories.GetArchiveLink(ctx, "o", "r", Tarball, &RepositoryContentGetOptions{}, true) + url, resp, err := client.Repositories.GetArchiveLink(ctx, "o", "r", Tarball, &RepositoryContentGetOptions{}, 1) if err != nil { t.Errorf("Repositories.GetArchiveLink returned error: %v", err) } diff --git a/github/repos_test.go b/github/repos_test.go index df99b6fc8b7..6aba962a91f 100644 --- a/github/repos_test.go +++ b/github/repos_test.go @@ -925,7 +925,7 @@ func TestRepositoriesService_GetBranch(t *testing.T) { }) ctx := context.Background() - branch, _, err := client.Repositories.GetBranch(ctx, "o", "r", "b", false) + branch, _, err := client.Repositories.GetBranch(ctx, "o", "r", "b", 0) if err != nil { t.Errorf("Repositories.GetBranch returned error: %v", err) } @@ -947,7 +947,7 @@ func TestRepositoriesService_GetBranch(t *testing.T) { const methodName = "GetBranch" testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Repositories.GetBranch(ctx, "\n", "\n", "\n", false) + _, _, err = client.Repositories.GetBranch(ctx, "\n", "\n", "\n", 0) return err }) } @@ -962,7 +962,7 @@ func TestRepositoriesService_GetBranch_BadJSONResponse(t *testing.T) { }) ctx := context.Background() - if _, _, err := client.Repositories.GetBranch(ctx, "o", "r", "b", false); err == nil { + if _, _, err := client.Repositories.GetBranch(ctx, "o", "r", "b", 0); err == nil { t.Error("Repositories.GetBranch returned no error; wanted JSON error") } } @@ -981,7 +981,7 @@ func TestRepositoriesService_GetBranch_StatusMovedPermanently_followRedirects(t fmt.Fprint(w, `{"name":"n", "commit":{"sha":"s","commit":{"message":"m"}}, "protected":true}`) }) ctx := context.Background() - branch, resp, err := client.Repositories.GetBranch(ctx, "o", "r", "b", true) + branch, resp, err := client.Repositories.GetBranch(ctx, "o", "r", "b", 1) if err != nil { t.Errorf("Repositories.GetBranch returned error: %v", err) } @@ -1013,7 +1013,7 @@ func TestRepositoriesService_GetBranch_notFound(t *testing.T) { http.Error(w, "branch not found", http.StatusNotFound) }) ctx := context.Background() - _, resp, err := client.Repositories.GetBranch(ctx, "o", "r", "b", true) + _, resp, err := client.Repositories.GetBranch(ctx, "o", "r", "b", 1) if err == nil { t.Error("Repositories.GetBranch returned error: nil") } @@ -1028,7 +1028,7 @@ func TestRepositoriesService_GetBranch_notFound(t *testing.T) { const methodName = "GetBranch" testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Repositories.GetBranch(ctx, "\n", "\n", "\n", true) + _, _, err = client.Repositories.GetBranch(ctx, "\n", "\n", "\n", 1) return err }) } diff --git a/test/integration/repos_test.go b/test/integration/repos_test.go index f6d72d5edd8..cc6ff0425c8 100644 --- a/test/integration/repos_test.go +++ b/test/integration/repos_test.go @@ -64,7 +64,7 @@ func TestRepositories_BranchesTags(t *testing.T) { t.Fatalf("Repositories.ListBranches('git', 'git') returned no branches") } - _, _, err = client.Repositories.GetBranch(context.Background(), "git", "git", *branches[0].Name, false) + _, _, err = client.Repositories.GetBranch(context.Background(), "git", "git", *branches[0].Name, 0) if err != nil { t.Fatalf("Repositories.GetBranch() returned error: %v", err) } @@ -91,7 +91,7 @@ func TestRepositories_EditBranches(t *testing.T) { t.Fatalf("createRandomTestRepository returned error: %v", err) } - branch, _, err := client.Repositories.GetBranch(context.Background(), *repo.Owner.Login, *repo.Name, "master", false) + branch, _, err := client.Repositories.GetBranch(context.Background(), *repo.Owner.Login, *repo.Name, "master", 0) if err != nil { t.Fatalf("Repositories.GetBranch() returned error: %v", err) } From e6f58e6e786881caeb29aa5739294d2f42179785 Mon Sep 17 00:00:00 2001 From: nxya Date: Thu, 28 Sep 2023 20:24:13 -0400 Subject: [PATCH 027/145] Add enterprise actions permissions endpoints and reorg files (#2920) --- github/actions_permissions_enterprise.go | 191 ++++++++++ github/actions_permissions_enterprise_test.go | 298 ++++++++++++++++ github/actions_permissions_orgs.go | 204 +++++++++++ github/actions_permissions_orgs_test.go | 336 ++++++++++++++++++ github/actions_runners.go | 89 ----- github/actions_runners_test.go | 127 ------- github/github-accessors.go | 24 ++ github/github-accessors_test.go | 30 ++ github/github-stringify_test.go | 12 + github/orgs_actions_allowed.go | 47 +-- github/orgs_actions_allowed_test.go | 38 -- github/orgs_actions_permissions.go | 47 +-- 12 files changed, 1107 insertions(+), 336 deletions(-) create mode 100644 github/actions_permissions_enterprise.go create mode 100644 github/actions_permissions_enterprise_test.go create mode 100644 github/actions_permissions_orgs.go create mode 100644 github/actions_permissions_orgs_test.go diff --git a/github/actions_permissions_enterprise.go b/github/actions_permissions_enterprise.go new file mode 100644 index 00000000000..8311e729438 --- /dev/null +++ b/github/actions_permissions_enterprise.go @@ -0,0 +1,191 @@ +// Copyright 2023 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// ActionsEnabledOnEnterpriseOrgs represents all the repositories in an enterprise for which Actions is enabled. +type ActionsEnabledOnEnterpriseRepos struct { + TotalCount int `json:"total_count"` + Organizations []*Organization `json:"organizations"` +} + +// ActionsPermissionsEnterprise represents a policy for allowed actions in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions +type ActionsPermissionsEnterprise struct { + EnabledOrganizations *string `json:"enabled_organizations,omitempty"` + AllowedActions *string `json:"allowed_actions,omitempty"` + SelectedActionsURL *string `json:"selected_actions_url,omitempty"` +} + +func (a ActionsPermissionsEnterprise) String() string { + return Stringify(a) +} + +// GetActionsPermissionsInEnterprise gets the GitHub Actions permissions policy for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#get-github-actions-permissions-for-an-enterprise +func (s *ActionsService) GetActionsPermissionsInEnterprise(ctx context.Context, enterprise string) (*ActionsPermissionsEnterprise, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions", enterprise) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + permissions := new(ActionsPermissionsEnterprise) + resp, err := s.client.Do(ctx, req, permissions) + if err != nil { + return nil, resp, err + } + + return permissions, resp, nil +} + +// EditActionsPermissionsInEnterprise sets the permissions policy in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#set-github-actions-permissions-for-an-enterprise +func (s *ActionsService) EditActionsPermissionsInEnterprise(ctx context.Context, enterprise string, actionsPermissionsEnterprise ActionsPermissionsEnterprise) (*ActionsPermissionsEnterprise, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions", enterprise) + req, err := s.client.NewRequest("PUT", u, actionsPermissionsEnterprise) + if err != nil { + return nil, nil, err + } + + p := new(ActionsPermissionsEnterprise) + resp, err := s.client.Do(ctx, req, p) + if err != nil { + return nil, resp, err + } + + return p, resp, nil +} + +// ListEnabledOrgsInEnterprise lists the selected organizations that are enabled for GitHub Actions in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#list-selected-organizations-enabled-for-github-actions-in-an-enterprise +func (s *ActionsService) ListEnabledOrgsInEnterprise(ctx context.Context, owner string, opts *ListOptions) (*ActionsEnabledOnEnterpriseRepos, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/organizations", owner) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + orgs := &ActionsEnabledOnEnterpriseRepos{} + resp, err := s.client.Do(ctx, req, orgs) + if err != nil { + return nil, resp, err + } + + return orgs, resp, nil +} + +// SetEnabledOrgsInEnterprise replaces the list of selected organizations that are enabled for GitHub Actions in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#set-selected-organizations-enabled-for-github-actions-in-an-enterprise +func (s *ActionsService) SetEnabledOrgsInEnterprise(ctx context.Context, owner string, organizationIDs []int64) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/organizations", owner) + + req, err := s.client.NewRequest("PUT", u, struct { + IDs []int64 `json:"selected_organization_ids"` + }{IDs: organizationIDs}) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// AddEnabledOrgInEnterprise adds an organization to the list of selected organizations that are enabled for GitHub Actions in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#enable-a-selected-organization-for-github-actions-in-an-enterprise +func (s *ActionsService) AddEnabledOrgInEnterprise(ctx context.Context, owner string, organizationID int64) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/organizations/%v", owner, organizationID) + + req, err := s.client.NewRequest("PUT", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// RemoveEnabledOrgInEnterprise removes an organization from the list of selected organizations that are enabled for GitHub Actions in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#disable-a-selected-organization-for-github-actions-in-an-enterprise +func (s *ActionsService) RemoveEnabledOrgInEnterprise(ctx context.Context, owner string, organizationID int64) (*Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/organizations/%v", owner, organizationID) + + req, err := s.client.NewRequest("DELETE", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// GetActionsAllowedInEnterprise gets the actions that are allowed in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-an-enterprise +func (s *ActionsService) GetActionsAllowedInEnterprise(ctx context.Context, enterprise string) (*ActionsAllowed, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/selected-actions", enterprise) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + actionsAllowed := new(ActionsAllowed) + resp, err := s.client.Do(ctx, req, actionsAllowed) + if err != nil { + return nil, resp, err + } + + return actionsAllowed, resp, nil +} + +// EditActionsAllowedInEnterprise sets the actions that are allowed in an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-an-enterprise +func (s *ActionsService) EditActionsAllowedInEnterprise(ctx context.Context, enterprise string, actionsAllowed ActionsAllowed) (*ActionsAllowed, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/selected-actions", enterprise) + req, err := s.client.NewRequest("PUT", u, actionsAllowed) + if err != nil { + return nil, nil, err + } + + p := new(ActionsAllowed) + resp, err := s.client.Do(ctx, req, p) + if err != nil { + return nil, resp, err + } + + return p, resp, nil +} diff --git a/github/actions_permissions_enterprise_test.go b/github/actions_permissions_enterprise_test.go new file mode 100644 index 00000000000..14e8e3a6b33 --- /dev/null +++ b/github/actions_permissions_enterprise_test.go @@ -0,0 +1,298 @@ +// Copyright 2023 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + "testing" + + "github.com/google/go-cmp/cmp" +) + +func TestActionsService_GetActionsPermissionsInEnterprise(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/enterprises/e/actions/permissions", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + fmt.Fprint(w, `{"enabled_organizations": "all", "allowed_actions": "all"}`) + }) + + ctx := context.Background() + ent, _, err := client.Actions.GetActionsPermissionsInEnterprise(ctx, "e") + if err != nil { + t.Errorf("Actions.GetActionsPermissionsInEnterprise returned error: %v", err) + } + want := &ActionsPermissionsEnterprise{EnabledOrganizations: String("all"), AllowedActions: String("all")} + if !cmp.Equal(ent, want) { + t.Errorf("Actions.GetActionsPermissionsInEnterprise returned %+v, want %+v", ent, want) + } + + const methodName = "GetActionsPermissionsInEnterprise" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Actions.GetActionsPermissionsInEnterprise(ctx, "\n") + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Actions.GetActionsPermissionsInEnterprise(ctx, "e") + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestActionsService_EditActionsPermissionsInEnterprise(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + input := &ActionsPermissionsEnterprise{EnabledOrganizations: String("all"), AllowedActions: String("selected")} + + mux.HandleFunc("/enterprises/e/actions/permissions", func(w http.ResponseWriter, r *http.Request) { + v := new(ActionsPermissionsEnterprise) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) + + testMethod(t, r, "PUT") + if !cmp.Equal(v, input) { + t.Errorf("Request body = %+v, want %+v", v, input) + } + + fmt.Fprint(w, `{"enabled_organizations": "all", "allowed_actions": "selected"}`) + }) + + ctx := context.Background() + ent, _, err := client.Actions.EditActionsPermissionsInEnterprise(ctx, "e", *input) + if err != nil { + t.Errorf("Actions.EditActionsPermissionsInEnterprise returned error: %v", err) + } + + want := &ActionsPermissionsEnterprise{EnabledOrganizations: String("all"), AllowedActions: String("selected")} + if !cmp.Equal(ent, want) { + t.Errorf("Actions.EditActionsPermissionsInEnterprise returned %+v, want %+v", ent, want) + } + + const methodName = "EditActionsPermissionsInEnterprise" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Actions.EditActionsPermissionsInEnterprise(ctx, "\n", *input) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Actions.EditActionsPermissionsInEnterprise(ctx, "e", *input) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestActionsService_ListEnabledOrgsInEnterprise(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/enterprises/e/actions/permissions/organizations", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + testFormValues(t, r, values{ + "page": "1", + }) + fmt.Fprint(w, `{"total_count":2,"organizations":[{"id":2}, {"id":3}]}`) + }) + + ctx := context.Background() + opt := &ListOptions{ + Page: 1, + } + got, _, err := client.Actions.ListEnabledOrgsInEnterprise(ctx, "e", opt) + if err != nil { + t.Errorf("Actions.ListEnabledOrgsInEnterprise returned error: %v", err) + } + + want := &ActionsEnabledOnEnterpriseRepos{TotalCount: int(2), Organizations: []*Organization{ + {ID: Int64(2)}, + {ID: Int64(3)}, + }} + if !cmp.Equal(got, want) { + t.Errorf("Actions.ListEnabledOrgsInEnterprise returned %+v, want %+v", got, want) + } + + const methodName = "ListEnabledOrgsInEnterprise" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Actions.ListEnabledOrgsInEnterprise(ctx, "\n", opt) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Actions.ListEnabledOrgsInEnterprise(ctx, "e", opt) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestActionsService_SetEnabledOrgsInEnterprise(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/enterprises/e/actions/permissions/organizations", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "PUT") + testHeader(t, r, "Content-Type", "application/json") + testBody(t, r, `{"selected_organization_ids":[123,1234]}`+"\n") + w.WriteHeader(http.StatusNoContent) + }) + + ctx := context.Background() + _, err := client.Actions.SetEnabledOrgsInEnterprise(ctx, "e", []int64{123, 1234}) + if err != nil { + t.Errorf("Actions.SetEnabledOrgsInEnterprise returned error: %v", err) + } + + const methodName = "SetEnabledOrgsInEnterprise" + + testBadOptions(t, methodName, func() (err error) { + _, err = client.Actions.SetEnabledOrgsInEnterprise(ctx, "\n", []int64{123, 1234}) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + return client.Actions.SetEnabledOrgsInEnterprise(ctx, "e", []int64{123, 1234}) + }) +} + +func TestActionsService_AddEnabledOrgInEnterprise(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/enterprises/e/actions/permissions/organizations/123", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "PUT") + w.WriteHeader(http.StatusNoContent) + }) + + ctx := context.Background() + _, err := client.Actions.AddEnabledOrgInEnterprise(ctx, "e", 123) + if err != nil { + t.Errorf("Actions.AddEnabledOrgInEnterprise returned error: %v", err) + } + + const methodName = "AddEnabledOrgInEnterprise" + + testBadOptions(t, methodName, func() (err error) { + _, err = client.Actions.AddEnabledOrgInEnterprise(ctx, "\n", 123) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + return client.Actions.AddEnabledOrgInEnterprise(ctx, "e", 123) + }) +} + +func TestActionsService_RemoveEnabledOrgInEnterprise(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/enterprises/e/actions/permissions/organizations/123", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "DELETE") + w.WriteHeader(http.StatusNoContent) + }) + + ctx := context.Background() + _, err := client.Actions.RemoveEnabledOrgInEnterprise(ctx, "e", 123) + if err != nil { + t.Errorf("Actions.RemoveEnabledOrgInEnterprise returned error: %v", err) + } + + const methodName = "RemoveEnabledOrgInEnterprise" + + testBadOptions(t, methodName, func() (err error) { + _, err = client.Actions.RemoveEnabledOrgInEnterprise(ctx, "\n", 123) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + return client.Actions.RemoveEnabledOrgInEnterprise(ctx, "e", 123) + }) +} + +func TestActionsService_GetActionsAllowedInEnterprise(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/enterprises/e/actions/permissions/selected-actions", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + fmt.Fprint(w, `{"github_owned_allowed":true, "verified_allowed":false, "patterns_allowed":["a/b"]}`) + }) + + ctx := context.Background() + ent, _, err := client.Actions.GetActionsAllowedInEnterprise(ctx, "e") + if err != nil { + t.Errorf("Actions.GetActionsAllowedInEnterprise returned error: %v", err) + } + want := &ActionsAllowed{GithubOwnedAllowed: Bool(true), VerifiedAllowed: Bool(false), PatternsAllowed: []string{"a/b"}} + if !cmp.Equal(ent, want) { + t.Errorf("Actions.GetActionsAllowedInEnterprise returned %+v, want %+v", ent, want) + } + + const methodName = "GetActionsAllowedInEnterprise" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Actions.GetActionsAllowedInEnterprise(ctx, "\n") + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Actions.GetActionsAllowedInEnterprise(ctx, "e") + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestActionsService_EditActionsAllowedInEnterprise(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + input := &ActionsAllowed{GithubOwnedAllowed: Bool(true), VerifiedAllowed: Bool(false), PatternsAllowed: []string{"a/b"}} + + mux.HandleFunc("/enterprises/e/actions/permissions/selected-actions", func(w http.ResponseWriter, r *http.Request) { + v := new(ActionsAllowed) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) + + testMethod(t, r, "PUT") + if !cmp.Equal(v, input) { + t.Errorf("Request body = %+v, want %+v", v, input) + } + + fmt.Fprint(w, `{"github_owned_allowed":true, "verified_allowed":false, "patterns_allowed":["a/b"]}`) + }) + + ctx := context.Background() + ent, _, err := client.Actions.EditActionsAllowedInEnterprise(ctx, "e", *input) + if err != nil { + t.Errorf("Actions.EditActionsAllowedInEnterprise returned error: %v", err) + } + + want := &ActionsAllowed{GithubOwnedAllowed: Bool(true), VerifiedAllowed: Bool(false), PatternsAllowed: []string{"a/b"}} + if !cmp.Equal(ent, want) { + t.Errorf("Actions.EditActionsAllowedInEnterprise returned %+v, want %+v", ent, want) + } + + const methodName = "EditActionsAllowedInEnterprise" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Actions.EditActionsAllowedInEnterprise(ctx, "\n", *input) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Actions.EditActionsAllowedInEnterprise(ctx, "e", *input) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} diff --git a/github/actions_permissions_orgs.go b/github/actions_permissions_orgs.go new file mode 100644 index 00000000000..801f1d97437 --- /dev/null +++ b/github/actions_permissions_orgs.go @@ -0,0 +1,204 @@ +// Copyright 2023 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// ActionsPermissions represents a policy for repositories and allowed actions in an organization. +// +// GitHub API docs: https://docs.github.com/en/rest/actions/permissions +type ActionsPermissions struct { + EnabledRepositories *string `json:"enabled_repositories,omitempty"` + AllowedActions *string `json:"allowed_actions,omitempty"` + SelectedActionsURL *string `json:"selected_actions_url,omitempty"` +} + +func (a ActionsPermissions) String() string { + return Stringify(a) +} + +// ActionsEnabledOnOrgRepos represents all the repositories in an organization for which Actions is enabled. +type ActionsEnabledOnOrgRepos struct { + TotalCount int `json:"total_count"` + Repositories []*Repository `json:"repositories"` +} + +// ActionsAllowed represents selected actions that are allowed. +// +// GitHub API docs: https://docs.github.com/en/rest/actions/permissions +type ActionsAllowed struct { + GithubOwnedAllowed *bool `json:"github_owned_allowed,omitempty"` + VerifiedAllowed *bool `json:"verified_allowed,omitempty"` + PatternsAllowed []string `json:"patterns_allowed,omitempty"` +} + +func (a ActionsAllowed) String() string { + return Stringify(a) +} + +// GetActionsPermissions gets the GitHub Actions permissions policy for repositories and allowed actions in an organization. +// +// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#get-github-actions-permissions-for-an-organization +func (s *ActionsService) GetActionsPermissions(ctx context.Context, org string) (*ActionsPermissions, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions", org) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + permissions := new(ActionsPermissions) + resp, err := s.client.Do(ctx, req, permissions) + if err != nil { + return nil, resp, err + } + + return permissions, resp, nil +} + +// EditActionsPermissions sets the permissions policy for repositories and allowed actions in an organization. +// +// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#set-github-actions-permissions-for-an-organization +func (s *ActionsService) EditActionsPermissions(ctx context.Context, org string, actionsPermissions ActionsPermissions) (*ActionsPermissions, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions", org) + req, err := s.client.NewRequest("PUT", u, actionsPermissions) + if err != nil { + return nil, nil, err + } + + p := new(ActionsPermissions) + resp, err := s.client.Do(ctx, req, p) + if err != nil { + return nil, resp, err + } + + return p, resp, nil +} + +// ListEnabledReposInOrg lists the selected repositories that are enabled for GitHub Actions in an organization. +// +// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#list-selected-repositories-enabled-for-github-actions-in-an-organization +func (s *ActionsService) ListEnabledReposInOrg(ctx context.Context, owner string, opts *ListOptions) (*ActionsEnabledOnOrgRepos, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/repositories", owner) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + repos := &ActionsEnabledOnOrgRepos{} + resp, err := s.client.Do(ctx, req, repos) + if err != nil { + return nil, resp, err + } + + return repos, resp, nil +} + +// SetEnabledReposInOrg replaces the list of selected repositories that are enabled for GitHub Actions in an organization.. +// +// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#set-selected-repositories-enabled-for-github-actions-in-an-organization +func (s *ActionsService) SetEnabledReposInOrg(ctx context.Context, owner string, repositoryIDs []int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/repositories", owner) + + req, err := s.client.NewRequest("PUT", u, struct { + IDs []int64 `json:"selected_repository_ids"` + }{IDs: repositoryIDs}) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// AddEnabledReposInOrg adds a repository to the list of selected repositories that are enabled for GitHub Actions in an organization. +// +// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#enable-a-selected-repository-for-github-actions-in-an-organization +func (s *ActionsService) AddEnabledReposInOrg(ctx context.Context, owner string, repositoryID int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/repositories/%v", owner, repositoryID) + + req, err := s.client.NewRequest("PUT", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// RemoveEnabledRepoInOrg removes a single repository from the list of enabled repos for GitHub Actions in an organization. +// +// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#disable-a-selected-repository-for-github-actions-in-an-organization +func (s *ActionsService) RemoveEnabledReposInOrg(ctx context.Context, owner string, repositoryID int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/repositories/%v", owner, repositoryID) + + req, err := s.client.NewRequest("DELETE", u, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} + +// GetActionsAllowed gets the actions that are allowed in an organization. +// +// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-an-organization +func (s *ActionsService) GetActionsAllowed(ctx context.Context, org string) (*ActionsAllowed, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/selected-actions", org) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + actionsAllowed := new(ActionsAllowed) + resp, err := s.client.Do(ctx, req, actionsAllowed) + if err != nil { + return nil, resp, err + } + + return actionsAllowed, resp, nil +} + +// EditActionsAllowed sets the actions that are allowed in an organization. +// +// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-an-organization +func (s *ActionsService) EditActionsAllowed(ctx context.Context, org string, actionsAllowed ActionsAllowed) (*ActionsAllowed, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/selected-actions", org) + req, err := s.client.NewRequest("PUT", u, actionsAllowed) + if err != nil { + return nil, nil, err + } + + p := new(ActionsAllowed) + resp, err := s.client.Do(ctx, req, p) + if err != nil { + return nil, resp, err + } + + return p, resp, nil +} diff --git a/github/actions_permissions_orgs_test.go b/github/actions_permissions_orgs_test.go new file mode 100644 index 00000000000..36a241f6ea2 --- /dev/null +++ b/github/actions_permissions_orgs_test.go @@ -0,0 +1,336 @@ +// Copyright 2023 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + "testing" + + "github.com/google/go-cmp/cmp" +) + +func TestActionsService_GetActionsPermissions(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/orgs/o/actions/permissions", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + fmt.Fprint(w, `{"enabled_repositories": "all", "allowed_actions": "all"}`) + }) + + ctx := context.Background() + org, _, err := client.Actions.GetActionsPermissions(ctx, "o") + if err != nil { + t.Errorf("Actions.GetActionsPermissions returned error: %v", err) + } + want := &ActionsPermissions{EnabledRepositories: String("all"), AllowedActions: String("all")} + if !cmp.Equal(org, want) { + t.Errorf("Actions.GetActionsPermissions returned %+v, want %+v", org, want) + } + + const methodName = "GetActionsPermissions" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Actions.GetActionsPermissions(ctx, "\n") + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Actions.GetActionsPermissions(ctx, "o") + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestActionsService_EditActionsPermissions(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + input := &ActionsPermissions{EnabledRepositories: String("all"), AllowedActions: String("selected")} + + mux.HandleFunc("/orgs/o/actions/permissions", func(w http.ResponseWriter, r *http.Request) { + v := new(ActionsPermissions) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) + + testMethod(t, r, "PUT") + if !cmp.Equal(v, input) { + t.Errorf("Request body = %+v, want %+v", v, input) + } + + fmt.Fprint(w, `{"enabled_repositories": "all", "allowed_actions": "selected"}`) + }) + + ctx := context.Background() + org, _, err := client.Actions.EditActionsPermissions(ctx, "o", *input) + if err != nil { + t.Errorf("Actions.EditActionsPermissions returned error: %v", err) + } + + want := &ActionsPermissions{EnabledRepositories: String("all"), AllowedActions: String("selected")} + if !cmp.Equal(org, want) { + t.Errorf("Actions.EditActionsPermissions returned %+v, want %+v", org, want) + } + + const methodName = "EditActionsPermissions" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Actions.EditActionsPermissions(ctx, "\n", *input) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Actions.EditActionsPermissions(ctx, "o", *input) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestActionsService_ListEnabledReposInOrg(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/orgs/o/actions/permissions/repositories", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + testFormValues(t, r, values{ + "page": "1", + }) + fmt.Fprint(w, `{"total_count":2,"repositories":[{"id":2}, {"id": 3}]}`) + }) + + ctx := context.Background() + opt := &ListOptions{ + Page: 1, + } + got, _, err := client.Actions.ListEnabledReposInOrg(ctx, "o", opt) + if err != nil { + t.Errorf("Actions.ListEnabledRepos returned error: %v", err) + } + + want := &ActionsEnabledOnOrgRepos{TotalCount: int(2), Repositories: []*Repository{ + {ID: Int64(2)}, + {ID: Int64(3)}, + }} + if !cmp.Equal(got, want) { + t.Errorf("Actions.ListEnabledRepos returned %+v, want %+v", got, want) + } + + const methodName = "ListEnabledRepos" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Actions.ListEnabledReposInOrg(ctx, "\n", opt) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Actions.ListEnabledReposInOrg(ctx, "o", opt) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestActionsService_SetEnabledReposInOrg(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/orgs/o/actions/permissions/repositories", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "PUT") + testHeader(t, r, "Content-Type", "application/json") + testBody(t, r, `{"selected_repository_ids":[123,1234]}`+"\n") + w.WriteHeader(http.StatusNoContent) + }) + + ctx := context.Background() + _, err := client.Actions.SetEnabledReposInOrg(ctx, "o", []int64{123, 1234}) + if err != nil { + t.Errorf("Actions.SetEnabledRepos returned error: %v", err) + } + + const methodName = "SetEnabledRepos" + + testBadOptions(t, methodName, func() (err error) { + _, err = client.Actions.SetEnabledReposInOrg(ctx, "\n", []int64{123, 1234}) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + return client.Actions.SetEnabledReposInOrg(ctx, "o", []int64{123, 1234}) + }) +} + +func TestActionsService_AddEnabledReposInOrg(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/orgs/o/actions/permissions/repositories/123", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "PUT") + w.WriteHeader(http.StatusNoContent) + }) + + ctx := context.Background() + _, err := client.Actions.AddEnabledReposInOrg(ctx, "o", 123) + if err != nil { + t.Errorf("Actions.AddEnabledReposInOrg returned error: %v", err) + } + + const methodName = "AddEnabledReposInOrg" + + testBadOptions(t, methodName, func() (err error) { + _, err = client.Actions.AddEnabledReposInOrg(ctx, "\n", 123) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + return client.Actions.AddEnabledReposInOrg(ctx, "o", 123) + }) +} + +func TestActionsService_RemoveEnabledReposInOrg(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/orgs/o/actions/permissions/repositories/123", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "DELETE") + w.WriteHeader(http.StatusNoContent) + }) + + ctx := context.Background() + _, err := client.Actions.RemoveEnabledReposInOrg(ctx, "o", 123) + if err != nil { + t.Errorf("Actions.RemoveEnabledReposInOrg returned error: %v", err) + } + + const methodName = "RemoveEnabledReposInOrg" + + testBadOptions(t, methodName, func() (err error) { + _, err = client.Actions.RemoveEnabledReposInOrg(ctx, "\n", 123) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + return client.Actions.RemoveEnabledReposInOrg(ctx, "o", 123) + }) +} + +func TestActionsService_GetActionsAllowed(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/orgs/o/actions/permissions/selected-actions", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + fmt.Fprint(w, `{"github_owned_allowed":true, "verified_allowed":false, "patterns_allowed":["a/b"]}`) + }) + + ctx := context.Background() + org, _, err := client.Actions.GetActionsAllowed(ctx, "o") + if err != nil { + t.Errorf("Actions.GetActionsAllowed returned error: %v", err) + } + want := &ActionsAllowed{GithubOwnedAllowed: Bool(true), VerifiedAllowed: Bool(false), PatternsAllowed: []string{"a/b"}} + if !cmp.Equal(org, want) { + t.Errorf("Actions.GetActionsAllowed returned %+v, want %+v", org, want) + } + + const methodName = "GetActionsAllowed" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Actions.GetActionsAllowed(ctx, "\n") + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Actions.GetActionsAllowed(ctx, "o") + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestActionsService_EditActionsAllowed(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + input := &ActionsAllowed{GithubOwnedAllowed: Bool(true), VerifiedAllowed: Bool(false), PatternsAllowed: []string{"a/b"}} + + mux.HandleFunc("/orgs/o/actions/permissions/selected-actions", func(w http.ResponseWriter, r *http.Request) { + v := new(ActionsAllowed) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) + + testMethod(t, r, "PUT") + if !cmp.Equal(v, input) { + t.Errorf("Request body = %+v, want %+v", v, input) + } + + fmt.Fprint(w, `{"github_owned_allowed":true, "verified_allowed":false, "patterns_allowed":["a/b"]}`) + }) + + ctx := context.Background() + org, _, err := client.Actions.EditActionsAllowed(ctx, "o", *input) + if err != nil { + t.Errorf("Actions.EditActionsAllowed returned error: %v", err) + } + + want := &ActionsAllowed{GithubOwnedAllowed: Bool(true), VerifiedAllowed: Bool(false), PatternsAllowed: []string{"a/b"}} + if !cmp.Equal(org, want) { + t.Errorf("Actions.EditActionsAllowed returned %+v, want %+v", org, want) + } + + const methodName = "EditActionsAllowed" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Actions.EditActionsAllowed(ctx, "\n", *input) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Actions.EditActionsAllowed(ctx, "o", *input) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestActionsAllowed_Marshal(t *testing.T) { + testJSONMarshal(t, &ActionsAllowed{}, "{}") + + u := &ActionsAllowed{ + GithubOwnedAllowed: Bool(false), + VerifiedAllowed: Bool(false), + PatternsAllowed: []string{"s"}, + } + + want := `{ + "github_owned_allowed": false, + "verified_allowed": false, + "patterns_allowed": [ + "s" + ] + }` + + testJSONMarshal(t, u, want) +} + +func TestActionsPermissions_Marshal(t *testing.T) { + testJSONMarshal(t, &ActionsPermissions{}, "{}") + + u := &ActionsPermissions{ + EnabledRepositories: String("e"), + AllowedActions: String("a"), + SelectedActionsURL: String("sau"), + } + + want := `{ + "enabled_repositories": "e", + "allowed_actions": "a", + "selected_actions_url": "sau" + }` + + testJSONMarshal(t, u, want) +} diff --git a/github/actions_runners.go b/github/actions_runners.go index 7427451ccfa..d54d6d41ca2 100644 --- a/github/actions_runners.go +++ b/github/actions_runners.go @@ -20,12 +20,6 @@ type RunnerApplicationDownload struct { SHA256Checksum *string `json:"sha256_checksum,omitempty"` } -// ActionsEnabledOnOrgRepos represents all the repositories in an organization for which Actions is enabled. -type ActionsEnabledOnOrgRepos struct { - TotalCount int `json:"total_count"` - Repositories []*Repository `json:"repositories"` -} - // ListRunnerApplicationDownloads lists self-hosted runner application binaries that can be downloaded and run. // // GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runners#list-runner-applications-for-a-repository @@ -295,89 +289,6 @@ func (s *ActionsService) ListOrganizationRunners(ctx context.Context, owner stri return runners, resp, nil } -// ListEnabledReposInOrg lists the selected repositories that are enabled for GitHub Actions in an organization. -// -// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#list-selected-repositories-enabled-for-github-actions-in-an-organization -func (s *ActionsService) ListEnabledReposInOrg(ctx context.Context, owner string, opts *ListOptions) (*ActionsEnabledOnOrgRepos, *Response, error) { - u := fmt.Sprintf("orgs/%v/actions/permissions/repositories", owner) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - repos := &ActionsEnabledOnOrgRepos{} - resp, err := s.client.Do(ctx, req, repos) - if err != nil { - return nil, resp, err - } - - return repos, resp, nil -} - -// SetEnabledReposInOrg replaces the list of selected repositories that are enabled for GitHub Actions in an organization.. -// -// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#set-selected-repositories-enabled-for-github-actions-in-an-organization -func (s *ActionsService) SetEnabledReposInOrg(ctx context.Context, owner string, repositoryIDs []int64) (*Response, error) { - u := fmt.Sprintf("orgs/%v/actions/permissions/repositories", owner) - - req, err := s.client.NewRequest("PUT", u, struct { - IDs []int64 `json:"selected_repository_ids"` - }{IDs: repositoryIDs}) - if err != nil { - return nil, err - } - - resp, err := s.client.Do(ctx, req, nil) - if err != nil { - return resp, err - } - - return resp, nil -} - -// AddEnabledReposInOrg adds a repository to the list of selected repositories that are enabled for GitHub Actions in an organization. -// -// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#enable-a-selected-repository-for-github-actions-in-an-organization -func (s *ActionsService) AddEnabledReposInOrg(ctx context.Context, owner string, repositoryID int64) (*Response, error) { - u := fmt.Sprintf("orgs/%v/actions/permissions/repositories/%v", owner, repositoryID) - - req, err := s.client.NewRequest("PUT", u, nil) - if err != nil { - return nil, err - } - - resp, err := s.client.Do(ctx, req, nil) - if err != nil { - return resp, err - } - - return resp, nil -} - -// RemoveEnabledRepoInOrg removes a single repository from the list of enabled repos for GitHub Actions in an organization. -// -// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#disable-a-selected-repository-for-github-actions-in-an-organization -func (s *ActionsService) RemoveEnabledRepoInOrg(ctx context.Context, owner string, repositoryID int64) (*Response, error) { - u := fmt.Sprintf("orgs/%v/actions/permissions/repositories/%v", owner, repositoryID) - - req, err := s.client.NewRequest("DELETE", u, nil) - if err != nil { - return nil, err - } - - resp, err := s.client.Do(ctx, req, nil) - if err != nil { - return resp, err - } - - return resp, nil -} - // GetOrganizationRunner gets a specific self-hosted runner for an organization using its runner ID. // // GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runners#get-a-self-hosted-runner-for-an-organization diff --git a/github/actions_runners_test.go b/github/actions_runners_test.go index d059d6e82ac..581e459442d 100644 --- a/github/actions_runners_test.go +++ b/github/actions_runners_test.go @@ -446,133 +446,6 @@ func TestActionsService_ListOrganizationRunners(t *testing.T) { }) } -func TestActionsService_ListEnabledReposInOrg(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() - - mux.HandleFunc("/orgs/o/actions/permissions/repositories", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - testFormValues(t, r, values{ - "page": "1", - }) - fmt.Fprint(w, `{"total_count":2,"repositories":[{"id":2}, {"id": 3}]}`) - }) - - ctx := context.Background() - opt := &ListOptions{ - Page: 1, - } - got, _, err := client.Actions.ListEnabledReposInOrg(ctx, "o", opt) - if err != nil { - t.Errorf("Actions.ListEnabledReposInOrg returned error: %v", err) - } - - want := &ActionsEnabledOnOrgRepos{TotalCount: int(2), Repositories: []*Repository{ - {ID: Int64(2)}, - {ID: Int64(3)}, - }} - if !cmp.Equal(got, want) { - t.Errorf("Actions.ListEnabledReposInOrg returned %+v, want %+v", got, want) - } - - const methodName = "ListEnabledReposInOrg" - testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Actions.ListEnabledReposInOrg(ctx, "\n", opt) - return err - }) - - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Actions.ListEnabledReposInOrg(ctx, "o", opt) - if got != nil { - t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) - } - return resp, err - }) -} - -func TestActionsService_SetEnabledReposInOrg(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() - - mux.HandleFunc("/orgs/o/actions/permissions/repositories", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "PUT") - testHeader(t, r, "Content-Type", "application/json") - testBody(t, r, `{"selected_repository_ids":[123,1234]}`+"\n") - w.WriteHeader(http.StatusNoContent) - }) - - ctx := context.Background() - _, err := client.Actions.SetEnabledReposInOrg(ctx, "o", []int64{123, 1234}) - if err != nil { - t.Errorf("Actions.SetEnabledReposInOrg returned error: %v", err) - } - - const methodName = "SetEnabledReposInOrg" - - testBadOptions(t, methodName, func() (err error) { - _, err = client.Actions.SetEnabledReposInOrg(ctx, "\n", []int64{123, 1234}) - return err - }) - - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - return client.Actions.SetEnabledReposInOrg(ctx, "o", []int64{123, 1234}) - }) -} - -func TestActionsService_AddEnabledReposInOrg(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() - - mux.HandleFunc("/orgs/o/actions/permissions/repositories/123", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "PUT") - w.WriteHeader(http.StatusNoContent) - }) - - ctx := context.Background() - _, err := client.Actions.AddEnabledReposInOrg(ctx, "o", 123) - if err != nil { - t.Errorf("Actions.AddEnabledReposInOrg returned error: %v", err) - } - - const methodName = "AddEnabledReposInOrg" - - testBadOptions(t, methodName, func() (err error) { - _, err = client.Actions.AddEnabledReposInOrg(ctx, "\n", 123) - return err - }) - - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - return client.Actions.AddEnabledReposInOrg(ctx, "o", 123) - }) -} - -func TestActionsService_RemoveEnabledRepoInOrg(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() - - mux.HandleFunc("/orgs/o/actions/permissions/repositories/123", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "DELETE") - w.WriteHeader(http.StatusNoContent) - }) - - ctx := context.Background() - _, err := client.Actions.RemoveEnabledRepoInOrg(ctx, "o", 123) - if err != nil { - t.Errorf("Actions.RemoveEnabledRepoInOrg returned error: %v", err) - } - - const methodName = "RemoveEnabledRepoInOrg" - - testBadOptions(t, methodName, func() (err error) { - _, err = client.Actions.RemoveEnabledRepoInOrg(ctx, "\n", 123) - return err - }) - - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - return client.Actions.RemoveEnabledRepoInOrg(ctx, "o", 123) - }) -} - func TestActionsService_GetOrganizationRunner(t *testing.T) { client, mux, _, teardown := setup() defer teardown() diff --git a/github/github-accessors.go b/github/github-accessors.go index 083d6139148..03ebc9a111c 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -150,6 +150,30 @@ func (a *ActionsPermissions) GetSelectedActionsURL() string { return *a.SelectedActionsURL } +// GetAllowedActions returns the AllowedActions field if it's non-nil, zero value otherwise. +func (a *ActionsPermissionsEnterprise) GetAllowedActions() string { + if a == nil || a.AllowedActions == nil { + return "" + } + return *a.AllowedActions +} + +// GetEnabledOrganizations returns the EnabledOrganizations field if it's non-nil, zero value otherwise. +func (a *ActionsPermissionsEnterprise) GetEnabledOrganizations() string { + if a == nil || a.EnabledOrganizations == nil { + return "" + } + return *a.EnabledOrganizations +} + +// GetSelectedActionsURL returns the SelectedActionsURL field if it's non-nil, zero value otherwise. +func (a *ActionsPermissionsEnterprise) GetSelectedActionsURL() string { + if a == nil || a.SelectedActionsURL == nil { + return "" + } + return *a.SelectedActionsURL +} + // GetAllowedActions returns the AllowedActions field if it's non-nil, zero value otherwise. func (a *ActionsPermissionsRepository) GetAllowedActions() string { if a == nil || a.AllowedActions == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 90d15369d0b..45f1f1cfef9 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -185,6 +185,36 @@ func TestActionsPermissions_GetSelectedActionsURL(tt *testing.T) { a.GetSelectedActionsURL() } +func TestActionsPermissionsEnterprise_GetAllowedActions(tt *testing.T) { + var zeroValue string + a := &ActionsPermissionsEnterprise{AllowedActions: &zeroValue} + a.GetAllowedActions() + a = &ActionsPermissionsEnterprise{} + a.GetAllowedActions() + a = nil + a.GetAllowedActions() +} + +func TestActionsPermissionsEnterprise_GetEnabledOrganizations(tt *testing.T) { + var zeroValue string + a := &ActionsPermissionsEnterprise{EnabledOrganizations: &zeroValue} + a.GetEnabledOrganizations() + a = &ActionsPermissionsEnterprise{} + a.GetEnabledOrganizations() + a = nil + a.GetEnabledOrganizations() +} + +func TestActionsPermissionsEnterprise_GetSelectedActionsURL(tt *testing.T) { + var zeroValue string + a := &ActionsPermissionsEnterprise{SelectedActionsURL: &zeroValue} + a.GetSelectedActionsURL() + a = &ActionsPermissionsEnterprise{} + a.GetSelectedActionsURL() + a = nil + a.GetSelectedActionsURL() +} + func TestActionsPermissionsRepository_GetAllowedActions(tt *testing.T) { var zeroValue string a := &ActionsPermissionsRepository{AllowedActions: &zeroValue} diff --git a/github/github-stringify_test.go b/github/github-stringify_test.go index c14412c2ceb..1dfd878fd59 100644 --- a/github/github-stringify_test.go +++ b/github/github-stringify_test.go @@ -39,6 +39,18 @@ func TestActionsPermissions_String(t *testing.T) { } } +func TestActionsPermissionsEnterprise_String(t *testing.T) { + v := ActionsPermissionsEnterprise{ + EnabledOrganizations: String(""), + AllowedActions: String(""), + SelectedActionsURL: String(""), + } + want := `github.ActionsPermissionsEnterprise{EnabledOrganizations:"", AllowedActions:"", SelectedActionsURL:""}` + if got := v.String(); got != want { + t.Errorf("ActionsPermissionsEnterprise.String = %v, want %v", got, want) + } +} + func TestActionsPermissionsRepository_String(t *testing.T) { v := ActionsPermissionsRepository{ Enabled: Bool(false), diff --git a/github/orgs_actions_allowed.go b/github/orgs_actions_allowed.go index e3b35b1df1f..c467c11546b 100644 --- a/github/orgs_actions_allowed.go +++ b/github/orgs_actions_allowed.go @@ -7,57 +7,22 @@ package github import ( "context" - "fmt" ) -// ActionsAllowed represents selected actions that are allowed. -// -// GitHub API docs: https://docs.github.com/en/rest/actions/permissions -type ActionsAllowed struct { - GithubOwnedAllowed *bool `json:"github_owned_allowed,omitempty"` - VerifiedAllowed *bool `json:"verified_allowed,omitempty"` - PatternsAllowed []string `json:"patterns_allowed,omitempty"` -} - -func (a ActionsAllowed) String() string { - return Stringify(a) -} - // GetActionsAllowed gets the actions that are allowed in an organization. // // GitHub API docs: https://docs.github.com/en/rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-an-organization +// Deprecated: please use `client.Actions.GetActionsAllowed` instead. func (s *OrganizationsService) GetActionsAllowed(ctx context.Context, org string) (*ActionsAllowed, *Response, error) { - u := fmt.Sprintf("orgs/%v/actions/permissions/selected-actions", org) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - actionsAllowed := new(ActionsAllowed) - resp, err := s.client.Do(ctx, req, actionsAllowed) - if err != nil { - return nil, resp, err - } - - return actionsAllowed, resp, nil + s2 := (*ActionsService)(s) + return s2.GetActionsAllowed(ctx, org) } // EditActionsAllowed sets the actions that are allowed in an organization. // // GitHub API docs: https://docs.github.com/en/rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-an-organization +// Deprecated: please use `client.Actions.EditActionsAllowed` instead. func (s *OrganizationsService) EditActionsAllowed(ctx context.Context, org string, actionsAllowed ActionsAllowed) (*ActionsAllowed, *Response, error) { - u := fmt.Sprintf("orgs/%v/actions/permissions/selected-actions", org) - req, err := s.client.NewRequest("PUT", u, actionsAllowed) - if err != nil { - return nil, nil, err - } - - p := new(ActionsAllowed) - resp, err := s.client.Do(ctx, req, p) - if err != nil { - return nil, resp, err - } - - return p, resp, nil + s2 := (*ActionsService)(s) + return s2.EditActionsAllowed(ctx, org, actionsAllowed) } diff --git a/github/orgs_actions_allowed_test.go b/github/orgs_actions_allowed_test.go index 6461dcf9a39..de4c6d5a0bc 100644 --- a/github/orgs_actions_allowed_test.go +++ b/github/orgs_actions_allowed_test.go @@ -91,41 +91,3 @@ func TestOrganizationsService_EditActionsAllowed(t *testing.T) { return resp, err }) } - -func TestActionsAllowed_Marshal(t *testing.T) { - testJSONMarshal(t, &ActionsAllowed{}, "{}") - - u := &ActionsAllowed{ - GithubOwnedAllowed: Bool(false), - VerifiedAllowed: Bool(false), - PatternsAllowed: []string{"s"}, - } - - want := `{ - "github_owned_allowed": false, - "verified_allowed": false, - "patterns_allowed": [ - "s" - ] - }` - - testJSONMarshal(t, u, want) -} - -func TestActionsPermissions_Marshal(t *testing.T) { - testJSONMarshal(t, &ActionsPermissions{}, "{}") - - u := &ActionsPermissions{ - EnabledRepositories: String("e"), - AllowedActions: String("a"), - SelectedActionsURL: String("sau"), - } - - want := `{ - "enabled_repositories": "e", - "allowed_actions": "a", - "selected_actions_url": "sau" - }` - - testJSONMarshal(t, u, want) -} diff --git a/github/orgs_actions_permissions.go b/github/orgs_actions_permissions.go index 6d1db2ee0a3..607ffca7981 100644 --- a/github/orgs_actions_permissions.go +++ b/github/orgs_actions_permissions.go @@ -7,57 +7,22 @@ package github import ( "context" - "fmt" ) -// ActionsPermissions represents a policy for repositories and allowed actions in an organization. -// -// GitHub API docs: https://docs.github.com/en/rest/actions/permissions -type ActionsPermissions struct { - EnabledRepositories *string `json:"enabled_repositories,omitempty"` - AllowedActions *string `json:"allowed_actions,omitempty"` - SelectedActionsURL *string `json:"selected_actions_url,omitempty"` -} - -func (a ActionsPermissions) String() string { - return Stringify(a) -} - // GetActionsPermissions gets the GitHub Actions permissions policy for repositories and allowed actions in an organization. // // GitHub API docs: https://docs.github.com/en/rest/actions/permissions#get-github-actions-permissions-for-an-organization +// Deprecated: please use `client.Actions.GetActionsPermissions` instead. func (s *OrganizationsService) GetActionsPermissions(ctx context.Context, org string) (*ActionsPermissions, *Response, error) { - u := fmt.Sprintf("orgs/%v/actions/permissions", org) - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - permissions := new(ActionsPermissions) - resp, err := s.client.Do(ctx, req, permissions) - if err != nil { - return nil, resp, err - } - - return permissions, resp, nil + s2 := (*ActionsService)(s) + return s2.GetActionsPermissions(ctx, org) } // EditActionsPermissions sets the permissions policy for repositories and allowed actions in an organization. // // GitHub API docs: https://docs.github.com/en/rest/actions/permissions#set-github-actions-permissions-for-an-organization +// Deprecated: please use `client.Actions.EditActionsPermissions` instead. func (s *OrganizationsService) EditActionsPermissions(ctx context.Context, org string, actionsPermissions ActionsPermissions) (*ActionsPermissions, *Response, error) { - u := fmt.Sprintf("orgs/%v/actions/permissions", org) - req, err := s.client.NewRequest("PUT", u, actionsPermissions) - if err != nil { - return nil, nil, err - } - - p := new(ActionsPermissions) - resp, err := s.client.Do(ctx, req, p) - if err != nil { - return nil, resp, err - } - - return p, resp, nil + s2 := (*ActionsService)(s) + return s2.EditActionsPermissions(ctx, org, actionsPermissions) } From d99d3dff14f7581047f510b74cc4213d58fb78e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Nordl=C3=A9n?= Date: Fri, 29 Sep 2023 14:53:37 +0200 Subject: [PATCH 028/145] Add SAML SSO audit log fields (#2941) --- github/github-accessors.go | 16 ++++ github/github-accessors_test.go | 20 ++++ github/orgs_audit_log.go | 158 ++++++++++++++++---------------- github/orgs_audit_log_test.go | 92 ++++++++++--------- 4 files changed, 164 insertions(+), 122 deletions(-) diff --git a/github/github-accessors.go b/github/github-accessors.go index 03ebc9a111c..b305bfc6448 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -1230,6 +1230,22 @@ func (a *AuditEntry) GetExplanation() string { return *a.Explanation } +// GetExternalIdentityNameID returns the ExternalIdentityNameID field if it's non-nil, zero value otherwise. +func (a *AuditEntry) GetExternalIdentityNameID() string { + if a == nil || a.ExternalIdentityNameID == nil { + return "" + } + return *a.ExternalIdentityNameID +} + +// GetExternalIdentityUsername returns the ExternalIdentityUsername field if it's non-nil, zero value otherwise. +func (a *AuditEntry) GetExternalIdentityUsername() string { + if a == nil || a.ExternalIdentityUsername == nil { + return "" + } + return *a.ExternalIdentityUsername +} + // GetFingerprint returns the Fingerprint field if it's non-nil, zero value otherwise. func (a *AuditEntry) GetFingerprint() string { if a == nil || a.Fingerprint == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 45f1f1cfef9..962e5e8f733 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -1451,6 +1451,26 @@ func TestAuditEntry_GetExplanation(tt *testing.T) { a.GetExplanation() } +func TestAuditEntry_GetExternalIdentityNameID(tt *testing.T) { + var zeroValue string + a := &AuditEntry{ExternalIdentityNameID: &zeroValue} + a.GetExternalIdentityNameID() + a = &AuditEntry{} + a.GetExternalIdentityNameID() + a = nil + a.GetExternalIdentityNameID() +} + +func TestAuditEntry_GetExternalIdentityUsername(tt *testing.T) { + var zeroValue string + a := &AuditEntry{ExternalIdentityUsername: &zeroValue} + a.GetExternalIdentityUsername() + a = &AuditEntry{} + a.GetExternalIdentityUsername() + a = nil + a.GetExternalIdentityUsername() +} + func TestAuditEntry_GetFingerprint(tt *testing.T) { var zeroValue string a := &AuditEntry{Fingerprint: &zeroValue} diff --git a/github/orgs_audit_log.go b/github/orgs_audit_log.go index 4c34445fa1b..e2f8fc24ffd 100644 --- a/github/orgs_audit_log.go +++ b/github/orgs_audit_log.go @@ -43,84 +43,86 @@ type PolicyOverrideReason struct { // AuditEntry describes the fields that may be represented by various audit-log "action" entries. // For a list of actions see - https://docs.github.com/en/github/setting-up-and-managing-organizations-and-teams/reviewing-the-audit-log-for-your-organization#audit-log-actions type AuditEntry struct { - ActorIP *string `json:"actor_ip,omitempty"` - Action *string `json:"action,omitempty"` // The name of the action that was performed, for example `user.login` or `repo.create`. - Active *bool `json:"active,omitempty"` - ActiveWas *bool `json:"active_was,omitempty"` - Actor *string `json:"actor,omitempty"` // The actor who performed the action. - ActorLocation *ActorLocation `json:"actor_location,omitempty"` - BlockedUser *string `json:"blocked_user,omitempty"` - Business *string `json:"business,omitempty"` - CancelledAt *Timestamp `json:"cancelled_at,omitempty"` - CompletedAt *Timestamp `json:"completed_at,omitempty"` - Conclusion *string `json:"conclusion,omitempty"` - Config *HookConfig `json:"config,omitempty"` - ConfigWas *HookConfig `json:"config_was,omitempty"` - ContentType *string `json:"content_type,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - DeployKeyFingerprint *string `json:"deploy_key_fingerprint,omitempty"` - DocumentID *string `json:"_document_id,omitempty"` - Emoji *string `json:"emoji,omitempty"` - EnvironmentName *string `json:"environment_name,omitempty"` - Event *string `json:"event,omitempty"` - Events []string `json:"events,omitempty"` - EventsWere []string `json:"events_were,omitempty"` - Explanation *string `json:"explanation,omitempty"` - Fingerprint *string `json:"fingerprint,omitempty"` - HashedToken *string `json:"hashed_token,omitempty"` - HeadBranch *string `json:"head_branch,omitempty"` - HeadSHA *string `json:"head_sha,omitempty"` - HookID *int64 `json:"hook_id,omitempty"` - IsHostedRunner *bool `json:"is_hosted_runner,omitempty"` - JobName *string `json:"job_name,omitempty"` - JobWorkflowRef *string `json:"job_workflow_ref,omitempty"` - LimitedAvailability *bool `json:"limited_availability,omitempty"` - Message *string `json:"message,omitempty"` - Name *string `json:"name,omitempty"` - OAuthApplicationID *int64 `json:"oauth_application_id,omitempty"` - OldUser *string `json:"old_user,omitempty"` - OldPermission *string `json:"old_permission,omitempty"` // The permission level for membership changes, for example `admin` or `read`. - OpenSSHPublicKey *string `json:"openssh_public_key,omitempty"` - OperationType *string `json:"operation_type,omitempty"` - Org *string `json:"org,omitempty"` - OrgID *int64 `json:"org_id,omitempty"` - OverriddenCodes []string `json:"overridden_codes,omitempty"` - Permission *string `json:"permission,omitempty"` // The permission level for membership changes, for example `admin` or `read`. - PreviousVisibility *string `json:"previous_visibility,omitempty"` - ProgrammaticAccessType *string `json:"programmatic_access_type,omitempty"` - PullRequestID *int64 `json:"pull_request_id,omitempty"` - PullRequestTitle *string `json:"pull_request_title,omitempty"` - PullRequestURL *string `json:"pull_request_url,omitempty"` - ReadOnly *string `json:"read_only,omitempty"` - Reasons []*PolicyOverrideReason `json:"reasons,omitempty"` - Repo *string `json:"repo,omitempty"` - Repository *string `json:"repository,omitempty"` - RepositoryPublic *bool `json:"repository_public,omitempty"` - RunAttempt *int64 `json:"run_attempt,omitempty"` - RunnerGroupID *int64 `json:"runner_group_id,omitempty"` - RunnerGroupName *string `json:"runner_group_name,omitempty"` - RunnerID *int64 `json:"runner_id,omitempty"` - RunnerLabels []string `json:"runner_labels,omitempty"` - RunnerName *string `json:"runner_name,omitempty"` - RunNumber *int64 `json:"run_number,omitempty"` - SecretsPassed []string `json:"secrets_passed,omitempty"` - SourceVersion *string `json:"source_version,omitempty"` - StartedAt *Timestamp `json:"started_at,omitempty"` - TargetLogin *string `json:"target_login,omitempty"` - TargetVersion *string `json:"target_version,omitempty"` - Team *string `json:"team,omitempty"` - Timestamp *Timestamp `json:"@timestamp,omitempty"` // The time the audit log event occurred, given as a [Unix timestamp](http://en.wikipedia.org/wiki/Unix_time). - TokenID *int64 `json:"token_id,omitempty"` - TokenScopes *string `json:"token_scopes,omitempty"` - Topic *string `json:"topic,omitempty"` - TransportProtocolName *string `json:"transport_protocol_name,omitempty"` // A human readable name for the protocol (for example, HTTP or SSH) used to transfer Git data. - TransportProtocol *int `json:"transport_protocol,omitempty"` // The type of protocol (for example, HTTP=1 or SSH=2) used to transfer Git data. - TriggerID *int64 `json:"trigger_id,omitempty"` - User *string `json:"user,omitempty"` // The user that was affected by the action performed (if available). - UserAgent *string `json:"user_agent,omitempty"` - Visibility *string `json:"visibility,omitempty"` // The repository visibility, for example `public` or `private`. - WorkflowID *int64 `json:"workflow_id,omitempty"` - WorkflowRunID *int64 `json:"workflow_run_id,omitempty"` + ActorIP *string `json:"actor_ip,omitempty"` + Action *string `json:"action,omitempty"` // The name of the action that was performed, for example `user.login` or `repo.create`. + Active *bool `json:"active,omitempty"` + ActiveWas *bool `json:"active_was,omitempty"` + Actor *string `json:"actor,omitempty"` // The actor who performed the action. + ActorLocation *ActorLocation `json:"actor_location,omitempty"` + BlockedUser *string `json:"blocked_user,omitempty"` + Business *string `json:"business,omitempty"` + CancelledAt *Timestamp `json:"cancelled_at,omitempty"` + CompletedAt *Timestamp `json:"completed_at,omitempty"` + Conclusion *string `json:"conclusion,omitempty"` + Config *HookConfig `json:"config,omitempty"` + ConfigWas *HookConfig `json:"config_was,omitempty"` + ContentType *string `json:"content_type,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + DeployKeyFingerprint *string `json:"deploy_key_fingerprint,omitempty"` + DocumentID *string `json:"_document_id,omitempty"` + Emoji *string `json:"emoji,omitempty"` + EnvironmentName *string `json:"environment_name,omitempty"` + Event *string `json:"event,omitempty"` + Events []string `json:"events,omitempty"` + EventsWere []string `json:"events_were,omitempty"` + Explanation *string `json:"explanation,omitempty"` + ExternalIdentityNameID *string `json:"external_identity_nameid,omitempty"` + ExternalIdentityUsername *string `json:"external_identity_username,omitempty"` + Fingerprint *string `json:"fingerprint,omitempty"` + HashedToken *string `json:"hashed_token,omitempty"` + HeadBranch *string `json:"head_branch,omitempty"` + HeadSHA *string `json:"head_sha,omitempty"` + HookID *int64 `json:"hook_id,omitempty"` + IsHostedRunner *bool `json:"is_hosted_runner,omitempty"` + JobName *string `json:"job_name,omitempty"` + JobWorkflowRef *string `json:"job_workflow_ref,omitempty"` + LimitedAvailability *bool `json:"limited_availability,omitempty"` + Message *string `json:"message,omitempty"` + Name *string `json:"name,omitempty"` + OAuthApplicationID *int64 `json:"oauth_application_id,omitempty"` + OldUser *string `json:"old_user,omitempty"` + OldPermission *string `json:"old_permission,omitempty"` // The permission level for membership changes, for example `admin` or `read`. + OpenSSHPublicKey *string `json:"openssh_public_key,omitempty"` + OperationType *string `json:"operation_type,omitempty"` + Org *string `json:"org,omitempty"` + OrgID *int64 `json:"org_id,omitempty"` + OverriddenCodes []string `json:"overridden_codes,omitempty"` + Permission *string `json:"permission,omitempty"` // The permission level for membership changes, for example `admin` or `read`. + PreviousVisibility *string `json:"previous_visibility,omitempty"` + ProgrammaticAccessType *string `json:"programmatic_access_type,omitempty"` + PullRequestID *int64 `json:"pull_request_id,omitempty"` + PullRequestTitle *string `json:"pull_request_title,omitempty"` + PullRequestURL *string `json:"pull_request_url,omitempty"` + ReadOnly *string `json:"read_only,omitempty"` + Reasons []*PolicyOverrideReason `json:"reasons,omitempty"` + Repo *string `json:"repo,omitempty"` + Repository *string `json:"repository,omitempty"` + RepositoryPublic *bool `json:"repository_public,omitempty"` + RunAttempt *int64 `json:"run_attempt,omitempty"` + RunnerGroupID *int64 `json:"runner_group_id,omitempty"` + RunnerGroupName *string `json:"runner_group_name,omitempty"` + RunnerID *int64 `json:"runner_id,omitempty"` + RunnerLabels []string `json:"runner_labels,omitempty"` + RunnerName *string `json:"runner_name,omitempty"` + RunNumber *int64 `json:"run_number,omitempty"` + SecretsPassed []string `json:"secrets_passed,omitempty"` + SourceVersion *string `json:"source_version,omitempty"` + StartedAt *Timestamp `json:"started_at,omitempty"` + TargetLogin *string `json:"target_login,omitempty"` + TargetVersion *string `json:"target_version,omitempty"` + Team *string `json:"team,omitempty"` + Timestamp *Timestamp `json:"@timestamp,omitempty"` // The time the audit log event occurred, given as a [Unix timestamp](http://en.wikipedia.org/wiki/Unix_time). + TokenID *int64 `json:"token_id,omitempty"` + TokenScopes *string `json:"token_scopes,omitempty"` + Topic *string `json:"topic,omitempty"` + TransportProtocolName *string `json:"transport_protocol_name,omitempty"` // A human readable name for the protocol (for example, HTTP or SSH) used to transfer Git data. + TransportProtocol *int `json:"transport_protocol,omitempty"` // The type of protocol (for example, HTTP=1 or SSH=2) used to transfer Git data. + TriggerID *int64 `json:"trigger_id,omitempty"` + User *string `json:"user,omitempty"` // The user that was affected by the action performed (if available). + UserAgent *string `json:"user_agent,omitempty"` + Visibility *string `json:"visibility,omitempty"` // The repository visibility, for example `public` or `private`. + WorkflowID *int64 `json:"workflow_id,omitempty"` + WorkflowRunID *int64 `json:"workflow_run_id,omitempty"` Data *AuditEntryData `json:"data,omitempty"` } diff --git a/github/orgs_audit_log_test.go b/github/orgs_audit_log_test.go index 89cdf46242e..1a82471face 100644 --- a/github/orgs_audit_log_test.go +++ b/github/orgs_audit_log_test.go @@ -223,50 +223,52 @@ func TestAuditEntry_Marshal(t *testing.T) { testJSONMarshal(t, &AuditEntry{}, "{}") u := &AuditEntry{ - Action: String("a"), - Active: Bool(false), - ActiveWas: Bool(false), - Actor: String("ac"), - ActorIP: String("aip"), - ActorLocation: &ActorLocation{CountryCode: String("alcc")}, - BlockedUser: String("bu"), - Business: String("b"), - CancelledAt: &Timestamp{referenceTime}, - CompletedAt: &Timestamp{referenceTime}, - Conclusion: String("c"), - Config: &HookConfig{URL: String("s")}, - ConfigWas: &HookConfig{URL: String("s")}, - ContentType: String("ct"), - CreatedAt: &Timestamp{referenceTime}, - DeployKeyFingerprint: String("dkf"), - DocumentID: String("did"), - Emoji: String("e"), - EnvironmentName: String("en"), - Event: String("e"), - Events: []string{"s"}, - EventsWere: []string{"s"}, - Explanation: String("e"), - Fingerprint: String("f"), - HashedToken: String("ht"), - HeadBranch: String("hb"), - HeadSHA: String("hsha"), - HookID: Int64(1), - IsHostedRunner: Bool(false), - JobName: String("jn"), - LimitedAvailability: Bool(false), - Message: String("m"), - Name: String("n"), - OldPermission: String("op"), - OldUser: String("ou"), - OpenSSHPublicKey: String("osshpk"), - Org: String("o"), - OrgID: Int64(1), - Permission: String("p"), - PreviousVisibility: String("pv"), - ProgrammaticAccessType: String("pat"), - PullRequestID: Int64(1), - PullRequestTitle: String("prt"), - PullRequestURL: String("pru"), + Action: String("a"), + Active: Bool(false), + ActiveWas: Bool(false), + Actor: String("ac"), + ActorIP: String("aip"), + ActorLocation: &ActorLocation{CountryCode: String("alcc")}, + BlockedUser: String("bu"), + Business: String("b"), + CancelledAt: &Timestamp{referenceTime}, + CompletedAt: &Timestamp{referenceTime}, + Conclusion: String("c"), + Config: &HookConfig{URL: String("s")}, + ConfigWas: &HookConfig{URL: String("s")}, + ContentType: String("ct"), + CreatedAt: &Timestamp{referenceTime}, + DeployKeyFingerprint: String("dkf"), + DocumentID: String("did"), + Emoji: String("e"), + EnvironmentName: String("en"), + Event: String("e"), + Events: []string{"s"}, + EventsWere: []string{"s"}, + Explanation: String("e"), + ExternalIdentityNameID: String("ein"), + ExternalIdentityUsername: String("eiu"), + Fingerprint: String("f"), + HashedToken: String("ht"), + HeadBranch: String("hb"), + HeadSHA: String("hsha"), + HookID: Int64(1), + IsHostedRunner: Bool(false), + JobName: String("jn"), + LimitedAvailability: Bool(false), + Message: String("m"), + Name: String("n"), + OldPermission: String("op"), + OldUser: String("ou"), + OpenSSHPublicKey: String("osshpk"), + Org: String("o"), + OrgID: Int64(1), + Permission: String("p"), + PreviousVisibility: String("pv"), + ProgrammaticAccessType: String("pat"), + PullRequestID: Int64(1), + PullRequestTitle: String("prt"), + PullRequestURL: String("pru"), Reasons: []*PolicyOverrideReason{{ Code: String("c"), Message: String("m"), @@ -339,6 +341,8 @@ func TestAuditEntry_Marshal(t *testing.T) { "s" ], "explanation": "e", + "external_identity_nameid": "ein", + "external_identity_username": "eiu", "fingerprint": "f", "hashed_token": "ht", "head_branch": "hb", From 25309f38d8d017ce7a6305842ed0b40b72e4a59e Mon Sep 17 00:00:00 2001 From: Julien Midedji Date: Sun, 1 Oct 2023 19:15:41 +0200 Subject: [PATCH 029/145] Add test for resource JSON marshaling - ActionVariable (#2942) --- github/actions_variables_test.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/github/actions_variables_test.go b/github/actions_variables_test.go index 646da92b1e8..a9f773c261e 100644 --- a/github/actions_variables_test.go +++ b/github/actions_variables_test.go @@ -657,3 +657,31 @@ func TestActionsService_DeleteEnvVariable(t *testing.T) { return client.Actions.DeleteEnvVariable(ctx, 1, "r", "variable") }) } + +func TestActionVariable_Marshal(t *testing.T) { + testJSONMarshal(t, &ActionsVariable{}, "{}") + + av := &ActionsVariable{ + Name: "n", + Value: "v", + CreatedAt: &Timestamp{referenceTime}, + UpdatedAt: &Timestamp{referenceTime}, + Visibility: String("v"), + SelectedRepositoriesURL: String("s"), + SelectedRepositoryIDs: &SelectedRepoIDs{1, 2, 3}, + } + + want := fmt.Sprintf(`{ + "name": "n", + "value": "v", + "created_at": %s, + "updated_at": %s, + "visibility": "v", + "selected_repositories_url": "s", + "selected_repository_ids": [1,2,3] + }`, referenceTimeStr, referenceTimeStr) + + fmt.Println(want) + + testJSONMarshal(t, av, want) +} From 8cd452b85e821c32eefcc5964e91e57f9731891f Mon Sep 17 00:00:00 2001 From: Ramesh Gaikwad Date: Sun, 1 Oct 2023 22:56:23 +0530 Subject: [PATCH 030/145] Add json marshaling tests for action usage and OIDC types (#2944) --- github/actions_cache_test.go | 130 +++++++++++++++++++++++++++++++++++ github/actions_oidc_test.go | 18 +++++ 2 files changed, 148 insertions(+) diff --git a/github/actions_cache_test.go b/github/actions_cache_test.go index b72d5cb8284..c13b772691c 100644 --- a/github/actions_cache_test.go +++ b/github/actions_cache_test.go @@ -515,3 +515,133 @@ func TestActionsService_GetCacheUsageForEnterprise_notFound(t *testing.T) { t.Errorf("Actions.GetTotalCacheUsageForEnterprise return %+v, want nil", caches) } } + +func TestActionsCache_Marshal(t *testing.T) { + testJSONMarshal(t, &ActionsCache{}, "{}") + + u := &ActionsCache{ + ID: Int64(1), + Ref: String("refAction"), + Key: String("key1"), + Version: String("alpha"), + LastAccessedAt: &Timestamp{referenceTime}, + CreatedAt: &Timestamp{referenceTime}, + SizeInBytes: Int64(1), + } + + want := `{ + "id": 1, + "ref": "refAction", + "key": "key1", + "version": "alpha", + "last_accessed_at": ` + referenceTimeStr + `, + "created_at": ` + referenceTimeStr + `, + "size_in_bytes": 1 + }` + + testJSONMarshal(t, u, want) +} + +func TestActionsCacheList_Marshal(t *testing.T) { + testJSONMarshal(t, &ActionsCacheList{}, "{}") + + u := &ActionsCacheList{ + TotalCount: 2, + ActionsCaches: []*ActionsCache{ + { + ID: Int64(1), + Key: String("key1"), + Version: String("alpha"), + LastAccessedAt: &Timestamp{referenceTime}, + CreatedAt: &Timestamp{referenceTime}, + SizeInBytes: Int64(1), + }, + { + ID: Int64(2), + Ref: String("refAction"), + LastAccessedAt: &Timestamp{referenceTime}, + CreatedAt: &Timestamp{referenceTime}, + SizeInBytes: Int64(1), + }, + }, + } + want := `{ + "total_count": 2, + "actions_caches": [{ + "id": 1, + "key": "key1", + "version": "alpha", + "last_accessed_at": ` + referenceTimeStr + `, + "created_at": ` + referenceTimeStr + `, + "size_in_bytes": 1 + }, + { + "id": 2, + "ref": "refAction", + "last_accessed_at": ` + referenceTimeStr + `, + "created_at": ` + referenceTimeStr + `, + "size_in_bytes": 1 + }] + }` + testJSONMarshal(t, u, want) +} + +func TestActionsCacheUsage_Marshal(t *testing.T) { + testJSONMarshal(t, &ActionsCacheUsage{}, "{}") + + u := &ActionsCacheUsage{ + FullName: "cache_usage1", + ActiveCachesSizeInBytes: 2, + ActiveCachesCount: 2, + } + + want := `{ + "full_name": "cache_usage1", + "active_caches_size_in_bytes": 2, + "active_caches_count": 2 + }` + + testJSONMarshal(t, u, want) +} + +func TestActionsCacheUsageList_Marshal(t *testing.T) { + testJSONMarshal(t, &ActionsCacheUsageList{}, "{}") + + u := &ActionsCacheUsageList{ + TotalCount: 1, + RepoCacheUsage: []*ActionsCacheUsage{ + { + FullName: "cache_usage1", + ActiveCachesSizeInBytes: 2, + ActiveCachesCount: 2, + }, + }, + } + + want := `{ + "total_count": 1, + "repository_cache_usages": [{ + "full_name": "cache_usage1", + "active_caches_size_in_bytes": 2, + "active_caches_count": 2 + }] + }` + + testJSONMarshal(t, u, want) +} + +func TestTotalCacheUsage_Marshal(t *testing.T) { + testJSONMarshal(t, &TotalCacheUsage{}, "{}") + + u := &TotalCacheUsage{ + TotalActiveCachesUsageSizeInBytes: 2, + TotalActiveCachesCount: 2, + } + + want := `{ + "total_active_caches_size_in_bytes": 2, + "total_active_caches_count": 2 + }` + + testJSONMarshal(t, u, want) +} diff --git a/github/actions_oidc_test.go b/github/actions_oidc_test.go index c56dfef3d9d..a1eee7c3157 100644 --- a/github/actions_oidc_test.go +++ b/github/actions_oidc_test.go @@ -179,3 +179,21 @@ func TestActionService_SetRepoOIDCSubjectClaimCustomTemplateToDefault(t *testing return client.Actions.SetRepoOIDCSubjectClaimCustomTemplate(ctx, "o", "r", input) }) } + +func TestOIDCSubjectClaimCustomTemplate_Marshal(t *testing.T) { + testJSONMarshal(t, &OIDCSubjectClaimCustomTemplate{}, "{}") + + u := &OIDCSubjectClaimCustomTemplate{ + UseDefault: Bool(false), + IncludeClaimKeys: []string{"s"}, + } + + want := `{ + "use_default": false, + "include_claim_keys": [ + "s" + ] + }` + + testJSONMarshal(t, u, want) +} From 7d26b99722ae97b2549526161aa2150cb6401ec6 Mon Sep 17 00:00:00 2001 From: Abhijit Hota Date: Wed, 4 Oct 2023 04:30:16 +0530 Subject: [PATCH 031/145] Add List Installation Requests API (#2947) --- github/apps.go | 32 ++++++++++++++++++++++ github/apps_test.go | 47 +++++++++++++++++++++++++++++++++ github/github-accessors.go | 40 ++++++++++++++++++++++++++++ github/github-accessors_test.go | 44 ++++++++++++++++++++++++++++++ 4 files changed, 163 insertions(+) diff --git a/github/apps.go b/github/apps.go index ab83d59ab2f..8965e66815c 100644 --- a/github/apps.go +++ b/github/apps.go @@ -102,6 +102,15 @@ type InstallationPermissions struct { Workflows *string `json:"workflows,omitempty"` } +// InstallationRequest represents a pending GitHub App installation request. +type InstallationRequest struct { + ID *int64 `json:"id,omitempty"` + NodeID *string `json:"node_id,omitempty"` + Account *User `json:"account,omitempty"` + Requester *User `json:"requester,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` +} + // Installation represents a GitHub Apps installation. type Installation struct { ID *int64 `json:"id,omitempty"` @@ -175,6 +184,29 @@ func (s *AppsService) Get(ctx context.Context, appSlug string) (*App, *Response, return app, resp, nil } +// ListInstallationRequests lists the pending installation requests that the current GitHub App has. +// +// GitHub API docs: https://docs.github.com/en/rest/apps/apps#list-installation-requests-for-the-authenticated-app +func (s *AppsService) ListInstallationRequests(ctx context.Context, opts *ListOptions) ([]*InstallationRequest, *Response, error) { + u, err := addOptions("app/installation-requests", opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var i []*InstallationRequest + resp, err := s.client.Do(ctx, req, &i) + if err != nil { + return nil, resp, err + } + + return i, resp, nil +} + // ListInstallations lists the installations that the current GitHub App has. // // GitHub API docs: https://docs.github.com/en/rest/apps/apps#list-installations-for-the-authenticated-app diff --git a/github/apps_test.go b/github/apps_test.go index f87d5006873..a58326ea5ee 100644 --- a/github/apps_test.go +++ b/github/apps_test.go @@ -72,6 +72,53 @@ func TestAppsService_Get_specifiedApp(t *testing.T) { } } +func TestAppsService_ListInstallationRequests(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/app/installation-requests", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + testFormValues(t, r, values{ + "page": "1", + "per_page": "2", + }) + fmt.Fprint(w, `[{ + "id": 1, + "account": { "id": 2 }, + "requester": { "id": 3 }, + "created_at": "2018-01-01T00:00:00Z" + }]`, + ) + }) + + opt := &ListOptions{Page: 1, PerPage: 2} + ctx := context.Background() + installationRequests, _, err := client.Apps.ListInstallationRequests(ctx, opt) + if err != nil { + t.Errorf("Apps.ListInstallations returned error: %v", err) + } + + date := Timestamp{Time: time.Date(2018, time.January, 1, 0, 0, 0, 0, time.UTC)} + want := []*InstallationRequest{{ + ID: Int64(1), + Account: &User{ID: Int64(2)}, + Requester: &User{ID: Int64(3)}, + CreatedAt: &date, + }} + if !cmp.Equal(installationRequests, want) { + t.Errorf("Apps.ListInstallationRequests returned %+v, want %+v", installationRequests, want) + } + + const methodName = "ListInstallationRequests" + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Apps.ListInstallationRequests(ctx, opt) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + func TestAppsService_ListInstallations(t *testing.T) { client, mux, _, teardown := setup() defer teardown() diff --git a/github/github-accessors.go b/github/github-accessors.go index b305bfc6448..f34d9a4afdf 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -8910,6 +8910,46 @@ func (i *InstallationRepositoriesEvent) GetSender() *User { return i.Sender } +// GetAccount returns the Account field. +func (i *InstallationRequest) GetAccount() *User { + if i == nil { + return nil + } + return i.Account +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (i *InstallationRequest) GetCreatedAt() Timestamp { + if i == nil || i.CreatedAt == nil { + return Timestamp{} + } + return *i.CreatedAt +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (i *InstallationRequest) GetID() int64 { + if i == nil || i.ID == nil { + return 0 + } + return *i.ID +} + +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (i *InstallationRequest) GetNodeID() string { + if i == nil || i.NodeID == nil { + return "" + } + return *i.NodeID +} + +// GetRequester returns the Requester field. +func (i *InstallationRequest) GetRequester() *User { + if i == nil { + return nil + } + return i.Requester +} + // GetFrom returns the From field if it's non-nil, zero value otherwise. func (i *InstallationSlugChange) GetFrom() string { if i == nil || i.From == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 962e5e8f733..25c8ab7e4b4 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -10487,6 +10487,50 @@ func TestInstallationRepositoriesEvent_GetSender(tt *testing.T) { i.GetSender() } +func TestInstallationRequest_GetAccount(tt *testing.T) { + i := &InstallationRequest{} + i.GetAccount() + i = nil + i.GetAccount() +} + +func TestInstallationRequest_GetCreatedAt(tt *testing.T) { + var zeroValue Timestamp + i := &InstallationRequest{CreatedAt: &zeroValue} + i.GetCreatedAt() + i = &InstallationRequest{} + i.GetCreatedAt() + i = nil + i.GetCreatedAt() +} + +func TestInstallationRequest_GetID(tt *testing.T) { + var zeroValue int64 + i := &InstallationRequest{ID: &zeroValue} + i.GetID() + i = &InstallationRequest{} + i.GetID() + i = nil + i.GetID() +} + +func TestInstallationRequest_GetNodeID(tt *testing.T) { + var zeroValue string + i := &InstallationRequest{NodeID: &zeroValue} + i.GetNodeID() + i = &InstallationRequest{} + i.GetNodeID() + i = nil + i.GetNodeID() +} + +func TestInstallationRequest_GetRequester(tt *testing.T) { + i := &InstallationRequest{} + i.GetRequester() + i = nil + i.GetRequester() +} + func TestInstallationSlugChange_GetFrom(tt *testing.T) { var zeroValue string i := &InstallationSlugChange{From: &zeroValue} From 5224e344009ffb8dd77256afe3b3528f1c0cddfb Mon Sep 17 00:00:00 2001 From: Pj Meyer Date: Tue, 3 Oct 2023 17:13:19 -0600 Subject: [PATCH 032/145] Add support for "performed_via_github_app" and "requested_team" in IssueEvent (#2946) Fixes: #2495. --- github/event_types.go | 6 ++ github/event_types_test.go | 148 ++++++++++++++++++++------------ github/github-accessors.go | 40 +++++++++ github/github-accessors_test.go | 35 ++++++++ github/issues_events.go | 26 +++--- github/issues_events_test.go | 112 ++++++++++++++++++++++++ github/issues_timeline.go | 2 + 7 files changed, 301 insertions(+), 68 deletions(-) diff --git a/github/event_types.go b/github/event_types.go index 1a403da9b9d..3161384f15d 100644 --- a/github/event_types.go +++ b/github/event_types.go @@ -1086,6 +1086,9 @@ type PullRequestEvent struct { // The following fields are only populated when the Action is "synchronize". Before *string `json:"before,omitempty"` After *string `json:"after,omitempty"` + + // The following will be populated if the event was performed by an App + PerformedViaGithubApp *App `json:"performed_via_github_app,omitempty"` } // PullRequestReviewEvent is triggered when a review is submitted on a pull @@ -1186,6 +1189,9 @@ type PullRequestTargetEvent struct { // The following fields are only populated when the Action is "synchronize". Before *string `json:"before,omitempty"` After *string `json:"after,omitempty"` + + // The following will be populated if the event was performed by an App + PerformedViaGithubApp *App `json:"performed_via_github_app,omitempty"` } // PushEvent represents a git push to a GitHub repository. diff --git a/github/event_types_test.go b/github/event_types_test.go index 31b94479f3b..91ac291205f 100644 --- a/github/event_types_test.go +++ b/github/event_types_test.go @@ -15177,6 +15177,15 @@ func TestPullRequestEvent_Marshal(t *testing.T) { URL: String("s"), Name: String("n"), }, + PerformedViaGithubApp: &App{ + ID: Int64(1), + NodeID: String("n"), + Slug: String("s"), + Name: String("n"), + Description: String("d"), + ExternalURL: String("e"), + HTMLURL: String("h"), + }, Organization: &Organization{ BillingEmail: String("be"), Blog: String("b"), @@ -15346,11 +15355,47 @@ func TestPullRequestEvent_Marshal(t *testing.T) { "requested_team": { "id": 1 }, + "label": { + "id": 1 + }, + "before": "before", + "after": "after", "repository": { "id": 1, "name": "n", "url": "s" }, + "performed_via_github_app": { + "id": 1, + "node_id": "n", + "slug": "s", + "name": "n", + "description": "d", + "external_url": "e", + "html_url": "h" + }, + "organization": { + "name": "n", + "company": "c", + "blog": "b", + "location": "loc", + "email": "e", + "twitter_username": "tu", + "description": "d", + "billing_email": "be", + "is_verified": true, + "has_organization_projects": true, + "has_repository_projects": true, + "default_repository_permission": "drp", + "members_can_create_repositories": true, + "members_can_create_public_repositories": false, + "members_can_create_private_repositories": true, + "members_can_create_internal_repositories": true, + "members_allowed_repository_creation_type": "marct", + "members_can_create_pages": true, + "members_can_create_public_pages": false, + "members_can_create_private_pages": true + }, "sender": { "login": "l", "id": 1, @@ -15456,34 +15501,7 @@ func TestPullRequestEvent_Marshal(t *testing.T) { "url": "u" }, "suspended_at": ` + referenceTimeStr + ` - }, - "label": { - "id": 1 - }, - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true - }, - "before": "before", - "after": "after" + } }` testJSONMarshal(t, u, want) @@ -16060,6 +16078,15 @@ func TestPullRequestTargetEvent_Marshal(t *testing.T) { URL: String("s"), Name: String("n"), }, + PerformedViaGithubApp: &App{ + ID: Int64(1), + NodeID: String("n"), + Slug: String("s"), + Name: String("n"), + Description: String("d"), + ExternalURL: String("e"), + HTMLURL: String("h"), + }, Organization: &Organization{ BillingEmail: String("be"), Blog: String("b"), @@ -16229,11 +16256,47 @@ func TestPullRequestTargetEvent_Marshal(t *testing.T) { "requested_team": { "id": 1 }, + "label": { + "id": 1 + }, + "before": "before", + "after": "after", "repository": { "id": 1, "name": "n", "url": "s" }, + "performed_via_github_app": { + "id": 1, + "node_id": "n", + "slug": "s", + "name": "n", + "description": "d", + "external_url": "e", + "html_url": "h" + }, + "organization": { + "name": "n", + "company": "c", + "blog": "b", + "location": "loc", + "email": "e", + "twitter_username": "tu", + "description": "d", + "billing_email": "be", + "is_verified": true, + "has_organization_projects": true, + "has_repository_projects": true, + "default_repository_permission": "drp", + "members_can_create_repositories": true, + "members_can_create_public_repositories": false, + "members_can_create_private_repositories": true, + "members_can_create_internal_repositories": true, + "members_allowed_repository_creation_type": "marct", + "members_can_create_pages": true, + "members_can_create_public_pages": false, + "members_can_create_private_pages": true + }, "sender": { "login": "l", "id": 1, @@ -16339,34 +16402,7 @@ func TestPullRequestTargetEvent_Marshal(t *testing.T) { "url": "u" }, "suspended_at": ` + referenceTimeStr + ` - }, - "label": { - "id": 1 - }, - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true - }, - "before": "before", - "after": "after" + } }` testJSONMarshal(t, u, want) diff --git a/github/github-accessors.go b/github/github-accessors.go index f34d9a4afdf..7317081668e 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -9638,6 +9638,14 @@ func (i *IssueEvent) GetMilestone() *Milestone { return i.Milestone } +// GetPerformedViaGithubApp returns the PerformedViaGithubApp field. +func (i *IssueEvent) GetPerformedViaGithubApp() *App { + if i == nil { + return nil + } + return i.PerformedViaGithubApp +} + // GetProjectCard returns the ProjectCard field. func (i *IssueEvent) GetProjectCard() *ProjectCard { if i == nil { @@ -9662,6 +9670,14 @@ func (i *IssueEvent) GetRequestedReviewer() *User { return i.RequestedReviewer } +// GetRequestedTeam returns the RequestedTeam field. +func (i *IssueEvent) GetRequestedTeam() *Team { + if i == nil { + return nil + } + return i.RequestedTeam +} + // GetReviewRequester returns the ReviewRequester field. func (i *IssueEvent) GetReviewRequester() *User { if i == nil { @@ -16198,6 +16214,14 @@ func (p *PullRequestEvent) GetOrganization() *Organization { return p.Organization } +// GetPerformedViaGithubApp returns the PerformedViaGithubApp field. +func (p *PullRequestEvent) GetPerformedViaGithubApp() *App { + if p == nil { + return nil + } + return p.PerformedViaGithubApp +} + // GetPullRequest returns the PullRequest field. func (p *PullRequestEvent) GetPullRequest() *PullRequest { if p == nil { @@ -16734,6 +16758,14 @@ func (p *PullRequestTargetEvent) GetOrganization() *Organization { return p.Organization } +// GetPerformedViaGithubApp returns the PerformedViaGithubApp field. +func (p *PullRequestTargetEvent) GetPerformedViaGithubApp() *App { + if p == nil { + return nil + } + return p.PerformedViaGithubApp +} + // GetPullRequest returns the PullRequest field. func (p *PullRequestTargetEvent) GetPullRequest() *PullRequest { if p == nil { @@ -22566,6 +22598,14 @@ func (t *Timeline) GetMilestone() *Milestone { return t.Milestone } +// GetPerformedViaGithubApp returns the PerformedViaGithubApp field. +func (t *Timeline) GetPerformedViaGithubApp() *App { + if t == nil { + return nil + } + return t.PerformedViaGithubApp +} + // GetProjectCard returns the ProjectCard field. func (t *Timeline) GetProjectCard() *ProjectCard { if t == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 25c8ab7e4b4..bdb4209a270 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -11292,6 +11292,13 @@ func TestIssueEvent_GetMilestone(tt *testing.T) { i.GetMilestone() } +func TestIssueEvent_GetPerformedViaGithubApp(tt *testing.T) { + i := &IssueEvent{} + i.GetPerformedViaGithubApp() + i = nil + i.GetPerformedViaGithubApp() +} + func TestIssueEvent_GetProjectCard(tt *testing.T) { i := &IssueEvent{} i.GetProjectCard() @@ -11313,6 +11320,13 @@ func TestIssueEvent_GetRequestedReviewer(tt *testing.T) { i.GetRequestedReviewer() } +func TestIssueEvent_GetRequestedTeam(tt *testing.T) { + i := &IssueEvent{} + i.GetRequestedTeam() + i = nil + i.GetRequestedTeam() +} + func TestIssueEvent_GetReviewRequester(tt *testing.T) { i := &IssueEvent{} i.GetReviewRequester() @@ -18856,6 +18870,13 @@ func TestPullRequestEvent_GetOrganization(tt *testing.T) { p.GetOrganization() } +func TestPullRequestEvent_GetPerformedViaGithubApp(tt *testing.T) { + p := &PullRequestEvent{} + p.GetPerformedViaGithubApp() + p = nil + p.GetPerformedViaGithubApp() +} + func TestPullRequestEvent_GetPullRequest(tt *testing.T) { p := &PullRequestEvent{} p.GetPullRequest() @@ -19424,6 +19445,13 @@ func TestPullRequestTargetEvent_GetOrganization(tt *testing.T) { p.GetOrganization() } +func TestPullRequestTargetEvent_GetPerformedViaGithubApp(tt *testing.T) { + p := &PullRequestTargetEvent{} + p.GetPerformedViaGithubApp() + p = nil + p.GetPerformedViaGithubApp() +} + func TestPullRequestTargetEvent_GetPullRequest(tt *testing.T) { p := &PullRequestTargetEvent{} p.GetPullRequest() @@ -26258,6 +26286,13 @@ func TestTimeline_GetMilestone(tt *testing.T) { t.GetMilestone() } +func TestTimeline_GetPerformedViaGithubApp(tt *testing.T) { + t := &Timeline{} + t.GetPerformedViaGithubApp() + t = nil + t.GetPerformedViaGithubApp() +} + func TestTimeline_GetProjectCard(tt *testing.T) { t := &Timeline{} t.GetProjectCard() diff --git a/github/issues_events.go b/github/issues_events.go index ed076591701..0305fca1168 100644 --- a/github/issues_events.go +++ b/github/issues_events.go @@ -66,7 +66,7 @@ type IssueEvent struct { // // review_requested, review_request_removed // The Actor requested or removed the request for a review. - // RequestedReviewer and ReviewRequester will be populated below. + // RequestedReviewer or RequestedTeam, and ReviewRequester will be populated below. // Event *string `json:"event,omitempty"` @@ -74,17 +74,19 @@ type IssueEvent struct { Issue *Issue `json:"issue,omitempty"` // Only present on certain events; see above. - Assignee *User `json:"assignee,omitempty"` - Assigner *User `json:"assigner,omitempty"` - CommitID *string `json:"commit_id,omitempty"` - Milestone *Milestone `json:"milestone,omitempty"` - Label *Label `json:"label,omitempty"` - Rename *Rename `json:"rename,omitempty"` - LockReason *string `json:"lock_reason,omitempty"` - ProjectCard *ProjectCard `json:"project_card,omitempty"` - DismissedReview *DismissedReview `json:"dismissed_review,omitempty"` - RequestedReviewer *User `json:"requested_reviewer,omitempty"` - ReviewRequester *User `json:"review_requester,omitempty"` + Assignee *User `json:"assignee,omitempty"` + Assigner *User `json:"assigner,omitempty"` + CommitID *string `json:"commit_id,omitempty"` + Milestone *Milestone `json:"milestone,omitempty"` + Label *Label `json:"label,omitempty"` + Rename *Rename `json:"rename,omitempty"` + LockReason *string `json:"lock_reason,omitempty"` + ProjectCard *ProjectCard `json:"project_card,omitempty"` + DismissedReview *DismissedReview `json:"dismissed_review,omitempty"` + RequestedReviewer *User `json:"requested_reviewer,omitempty"` + RequestedTeam *Team `json:"requested_team,omitempty"` + ReviewRequester *User `json:"review_requester,omitempty"` + PerformedViaGithubApp *App `json:"performed_via_github_app,omitempty"` } // DismissedReview represents details for 'dismissed_review' events. diff --git a/github/issues_events_test.go b/github/issues_events_test.go index 1d8d3233d19..e8118b6ddcd 100644 --- a/github/issues_events_test.go +++ b/github/issues_events_test.go @@ -270,6 +270,62 @@ func TestIssueEvent_Marshal(t *testing.T) { CreatedAt: &Timestamp{referenceTime}, SuspendedAt: &Timestamp{referenceTime}, }, + RequestedTeam: &Team{ + ID: Int64(1), + NodeID: String("n"), + Name: String("n"), + Description: String("d"), + URL: String("u"), + Slug: String("s"), + Permission: String("p"), + Privacy: String("p"), + MembersCount: Int(1), + ReposCount: Int(1), + MembersURL: String("m"), + RepositoriesURL: String("r"), + Organization: &Organization{ + Login: String("l"), + ID: Int64(1), + NodeID: String("n"), + AvatarURL: String("a"), + HTMLURL: String("h"), + Name: String("n"), + Company: String("c"), + Blog: String("b"), + Location: String("l"), + Email: String("e"), + }, + Parent: &Team{ + ID: Int64(1), + NodeID: String("n"), + Name: String("n"), + Description: String("d"), + URL: String("u"), + Slug: String("s"), + Permission: String("p"), + Privacy: String("p"), + MembersCount: Int(1), + ReposCount: Int(1), + }, + LDAPDN: String("l"), + }, + PerformedViaGithubApp: &App{ + ID: Int64(1), + NodeID: String("n"), + Owner: &User{ + Login: String("l"), + ID: Int64(1), + NodeID: String("n"), + URL: String("u"), + ReposURL: String("r"), + EventsURL: String("e"), + AvatarURL: String("a"), + }, + Name: String("n"), + Description: String("d"), + HTMLURL: String("h"), + ExternalURL: String("u"), + }, ReviewRequester: &User{ Login: String("l"), ID: Int64(1), @@ -401,6 +457,62 @@ func TestIssueEvent_Marshal(t *testing.T) { "suspended_at": ` + referenceTimeStr + `, "url": "u" }, + "requested_team": { + "id": 1, + "node_id": "n", + "name": "n", + "description": "d", + "url": "u", + "slug": "s", + "permission": "p", + "privacy": "p", + "members_count": 1, + "repos_count": 1, + "members_url": "m", + "repositories_url": "r", + "organization": { + "login": "l", + "id": 1, + "node_id": "n", + "avatar_url": "a", + "html_url": "h", + "name": "n", + "company": "c", + "blog": "b", + "location": "l", + "email": "e" + }, + "parent": { + "id": 1, + "node_id": "n", + "name": "n", + "description": "d", + "url": "u", + "slug": "s", + "permission": "p", + "privacy": "p", + "members_count": 1, + "repos_count": 1 + }, + "ldap_dn": "l" + }, + "performed_via_github_app": { + "id": 1, + "node_id": "n", + "owner": { + "login": "l", + "id": 1, + "node_id": "n", + "url": "u", + "repos_url": "r", + "events_url": "e", + "avatar_url": "a" + }, + "name": "n", + "description": "d", + "html_url": "h", + "external_url": "u" + }, "review_requester": { "login": "l", "id": 1, diff --git a/github/issues_timeline.go b/github/issues_timeline.go index 9c73e6176d1..8ac02ac14dc 100644 --- a/github/issues_timeline.go +++ b/github/issues_timeline.go @@ -151,6 +151,8 @@ type Timeline struct { // The review summary text. Body *string `json:"body,omitempty"` SubmittedAt *Timestamp `json:"submitted_at,omitempty"` + + PerformedViaGithubApp *App `json:"performed_via_github_app,omitempty"` } // Source represents a reference's source. From 84651d1d8c93c5016e4d19da00eeb38307b6c286 Mon Sep 17 00:00:00 2001 From: billnapier Date: Wed, 4 Oct 2023 08:06:36 -0700 Subject: [PATCH 033/145] Add "organization" field to more events (#2949) Fixes: #2950. --- github/event_types.go | 76 ++++++++++++++++ github/github-accessors.go | 152 ++++++++++++++++++++++++++++++++ github/github-accessors_test.go | 133 ++++++++++++++++++++++++++++ 3 files changed, 361 insertions(+) diff --git a/github/event_types.go b/github/event_types.go index 3161384f15d..b3e58b3318f 100644 --- a/github/event_types.go +++ b/github/event_types.go @@ -76,6 +76,10 @@ type CommitCommentEvent struct { Repo *Repository `json:"repository,omitempty"` Sender *User `json:"sender,omitempty"` Installation *Installation `json:"installation,omitempty"` + + // The following field is only present when the webhook is triggered on + // a repository belonging to an organization. + Org *Organization `json:"organization,omitempty"` } // ContentReferenceEvent is triggered when the body or comment of an issue or @@ -132,6 +136,10 @@ type DeleteEvent struct { Repo *Repository `json:"repository,omitempty"` Sender *User `json:"sender,omitempty"` Installation *Installation `json:"installation,omitempty"` + + // The following field is only present when the webhook is triggered on + // a repository belonging to an organization. + Org *Organization `json:"organization,omitempty"` } // DependabotAlertEvent is triggered when there is activity relating to Dependabot alerts. @@ -192,6 +200,10 @@ type DeploymentEvent struct { // The following fields are only populated by Webhook events. Sender *User `json:"sender,omitempty"` Installation *Installation `json:"installation,omitempty"` + + // The following field is only present when the webhook is triggered on + // a repository belonging to an organization. + Org *Organization `json:"organization,omitempty"` } // DeploymentProtectionRuleEvent represents a deployment protection rule event. @@ -227,6 +239,10 @@ type DeploymentStatusEvent struct { // The following fields are only populated by Webhook events. Sender *User `json:"sender,omitempty"` Installation *Installation `json:"installation,omitempty"` + + // The following field is only present when the webhook is triggered on + // a repository belonging to an organization. + Org *Organization `json:"organization,omitempty"` } // DiscussionCommentEvent represents a webhook event for a comment on discussion. @@ -363,6 +379,10 @@ type GollumEvent struct { Repo *Repository `json:"repository,omitempty"` Sender *User `json:"sender,omitempty"` Installation *Installation `json:"installation,omitempty"` + + // The following field is only present when the webhook is triggered on + // a repository belonging to an organization. + Org *Organization `json:"organization,omitempty"` } // EditChange represents the changes when an issue, pull request, comment, @@ -510,6 +530,10 @@ type InstallationEvent struct { Sender *User `json:"sender,omitempty"` Installation *Installation `json:"installation,omitempty"` Requester *User `json:"requester,omitempty"` + + // The following field is only present when the webhook is triggered on + // a repository belonging to an organization. + Org *Organization `json:"organization,omitempty"` } // InstallationRepositoriesEvent is triggered when a repository is added or @@ -524,6 +548,10 @@ type InstallationRepositoriesEvent struct { RepositorySelection *string `json:"repository_selection,omitempty"` Sender *User `json:"sender,omitempty"` Installation *Installation `json:"installation,omitempty"` + + // The following field is only present when the webhook is triggered on + // a repository belonging to an organization. + Org *Organization `json:"organization,omitempty"` } // InstallationLoginChange represents a change in login on an installation. @@ -603,6 +631,10 @@ type IssuesEvent struct { Sender *User `json:"sender,omitempty"` Installation *Installation `json:"installation,omitempty"` Milestone *Milestone `json:"milestone,omitempty"` + + // The following field is only present when the webhook is triggered on + // a repository belonging to an organization. + Org *Organization `json:"organization,omitempty"` } // LabelEvent is triggered when a repository's label is created, edited, or deleted. @@ -639,6 +671,10 @@ type MarketplacePurchaseEvent struct { PreviousMarketplacePurchase *MarketplacePurchase `json:"previous_marketplace_purchase,omitempty"` Sender *User `json:"sender,omitempty"` Installation *Installation `json:"installation,omitempty"` + + // The following field is only present when the webhook is triggered on + // a repository belonging to an organization. + Org *Organization `json:"organization,omitempty"` } // MemberEvent is triggered when a user is added as a collaborator to a repository. @@ -654,6 +690,10 @@ type MemberEvent struct { Repo *Repository `json:"repository,omitempty"` Sender *User `json:"sender,omitempty"` Installation *Installation `json:"installation,omitempty"` + + // The following field is only present when the webhook is triggered on + // a repository belonging to an organization. + Org *Organization `json:"organization,omitempty"` } // MembershipEvent is triggered when a user is added or removed from a team. @@ -825,6 +865,10 @@ type PageBuildEvent struct { Repo *Repository `json:"repository,omitempty"` Sender *User `json:"sender,omitempty"` Installation *Installation `json:"installation,omitempty"` + + // The following field is only present when the webhook is triggered on + // a repository belonging to an organization. + Org *Organization `json:"organization,omitempty"` } // PersonalAccessTokenRequestEvent occurs when there is activity relating to a @@ -885,6 +929,10 @@ type PersonalAccessTokenRequest struct { // Date and time when the associated fine-grained personal access token was last used for authentication. TokenLastUsedAt *Timestamp `json:"token_last_used_at,omitempty"` + + // The following field is only present when the webhook is triggered on + // a repository belonging to an organization. + Org *Organization `json:"organization,omitempty"` } // PersonalAccessTokenPermissions represents the original or newly requested @@ -1044,6 +1092,10 @@ type PublicEvent struct { Repo *Repository `json:"repository,omitempty"` Sender *User `json:"sender,omitempty"` Installation *Installation `json:"installation,omitempty"` + + // The following field is only present when the webhook is triggered on + // a repository belonging to an organization. + Org *Organization `json:"organization,omitempty"` } // PullRequestEvent is triggered when a pull request is assigned, unassigned, labeled, @@ -1129,6 +1181,10 @@ type PullRequestReviewCommentEvent struct { Repo *Repository `json:"repository,omitempty"` Sender *User `json:"sender,omitempty"` Installation *Installation `json:"installation,omitempty"` + + // The following field is only present when the webhook is triggered on + // a repository belonging to an organization. + Org *Organization `json:"organization,omitempty"` } // PullRequestReviewThreadEvent is triggered when a comment made as part of a @@ -1147,6 +1203,10 @@ type PullRequestReviewThreadEvent struct { Repo *Repository `json:"repository,omitempty"` Sender *User `json:"sender,omitempty"` Installation *Installation `json:"installation,omitempty"` + + // The following field is only present when the webhook is triggered on + // a repository belonging to an organization. + Org *Organization `json:"organization,omitempty"` } // PullRequestTargetEvent is triggered when a pull request is assigned, unassigned, labeled, @@ -1315,6 +1375,10 @@ type ReleaseEvent struct { Repo *Repository `json:"repository,omitempty"` Sender *User `json:"sender,omitempty"` Installation *Installation `json:"installation,omitempty"` + + // The following field is only present when the webhook is triggered on + // a repository belonging to an organization. + Org *Organization `json:"organization,omitempty"` } // RepositoryEvent is triggered when a repository is created, archived, unarchived, @@ -1385,6 +1449,10 @@ type RepositoryVulnerabilityAlertEvent struct { // The user that triggered the event. Sender *User `json:"sender,omitempty"` + + // The following field is only present when the webhook is triggered on + // a repository belonging to an organization. + Org *Organization `json:"organization,omitempty"` } // RepositoryVulnerabilityAlert represents a repository security alert. @@ -1491,6 +1559,10 @@ type StatusEvent struct { Repo *Repository `json:"repository,omitempty"` Sender *User `json:"sender,omitempty"` Installation *Installation `json:"installation,omitempty"` + + // The following field is only present when the webhook is triggered on + // a repository belonging to an organization. + Org *Organization `json:"organization,omitempty"` } // TeamEvent is triggered when an organization's team is created, modified or deleted. @@ -1561,6 +1633,10 @@ type WatchEvent struct { Repo *Repository `json:"repository,omitempty"` Sender *User `json:"sender,omitempty"` Installation *Installation `json:"installation,omitempty"` + + // The following field is only present when the webhook is triggered on + // a repository belonging to an organization. + Org *Organization `json:"organization,omitempty"` } // WorkflowDispatchEvent is triggered when someone triggers a workflow run on GitHub or diff --git a/github/github-accessors.go b/github/github-accessors.go index 7317081668e..8519de2de9d 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -3814,6 +3814,14 @@ func (c *CommitCommentEvent) GetInstallation() *Installation { return c.Installation } +// GetOrg returns the Org field. +func (c *CommitCommentEvent) GetOrg() *Organization { + if c == nil { + return nil + } + return c.Org +} + // GetRepo returns the Repo field. func (c *CommitCommentEvent) GetRepo() *Repository { if c == nil { @@ -5046,6 +5054,14 @@ func (d *DeleteEvent) GetInstallation() *Installation { return d.Installation } +// GetOrg returns the Org field. +func (d *DeleteEvent) GetOrg() *Organization { + if d == nil { + return nil + } + return d.Org +} + // GetPusherType returns the PusherType field if it's non-nil, zero value otherwise. func (d *DeleteEvent) GetPusherType() string { if d == nil || d.PusherType == nil { @@ -5582,6 +5598,14 @@ func (d *DeploymentEvent) GetInstallation() *Installation { return d.Installation } +// GetOrg returns the Org field. +func (d *DeploymentEvent) GetOrg() *Organization { + if d == nil { + return nil + } + return d.Org +} + // GetRepo returns the Repo field. func (d *DeploymentEvent) GetRepo() *Repository { if d == nil { @@ -5886,6 +5910,14 @@ func (d *DeploymentStatusEvent) GetInstallation() *Installation { return d.Installation } +// GetOrg returns the Org field. +func (d *DeploymentStatusEvent) GetOrg() *Organization { + if d == nil { + return nil + } + return d.Org +} + // GetRepo returns the Repo field. func (d *DeploymentStatusEvent) GetRepo() *Repository { if d == nil { @@ -7686,6 +7718,14 @@ func (g *GollumEvent) GetInstallation() *Installation { return g.Installation } +// GetOrg returns the Org field. +func (g *GollumEvent) GetOrg() *Organization { + if g == nil { + return nil + } + return g.Org +} + // GetRepo returns the Repo field. func (g *GollumEvent) GetRepo() *Repository { if g == nil { @@ -8558,6 +8598,14 @@ func (i *InstallationEvent) GetInstallation() *Installation { return i.Installation } +// GetOrg returns the Org field. +func (i *InstallationEvent) GetOrg() *Organization { + if i == nil { + return nil + } + return i.Org +} + // GetRequester returns the Requester field. func (i *InstallationEvent) GetRequester() *User { if i == nil { @@ -8894,6 +8942,14 @@ func (i *InstallationRepositoriesEvent) GetInstallation() *Installation { return i.Installation } +// GetOrg returns the Org field. +func (i *InstallationRepositoriesEvent) GetOrg() *Organization { + if i == nil { + return nil + } + return i.Org +} + // GetRepositorySelection returns the RepositorySelection field if it's non-nil, zero value otherwise. func (i *InstallationRepositoriesEvent) GetRepositorySelection() string { if i == nil || i.RepositorySelection == nil { @@ -9998,6 +10054,14 @@ func (i *IssuesEvent) GetMilestone() *Milestone { return i.Milestone } +// GetOrg returns the Org field. +func (i *IssuesEvent) GetOrg() *Organization { + if i == nil { + return nil + } + return i.Org +} + // GetRepo returns the Repo field. func (i *IssuesEvent) GetRepo() *Repository { if i == nil { @@ -11046,6 +11110,14 @@ func (m *MarketplacePurchaseEvent) GetMarketplacePurchase() *MarketplacePurchase return m.MarketplacePurchase } +// GetOrg returns the Org field. +func (m *MarketplacePurchaseEvent) GetOrg() *Organization { + if m == nil { + return nil + } + return m.Org +} + // GetPreviousMarketplacePurchase returns the PreviousMarketplacePurchase field. func (m *MarketplacePurchaseEvent) GetPreviousMarketplacePurchase() *MarketplacePurchase { if m == nil { @@ -11094,6 +11166,14 @@ func (m *MemberEvent) GetMember() *User { return m.Member } +// GetOrg returns the Org field. +func (m *MemberEvent) GetOrg() *Organization { + if m == nil { + return nil + } + return m.Org +} + // GetRepo returns the Repo field. func (m *MemberEvent) GetRepo() *Repository { if m == nil { @@ -13326,6 +13406,14 @@ func (p *PageBuildEvent) GetInstallation() *Installation { return p.Installation } +// GetOrg returns the Org field. +func (p *PageBuildEvent) GetOrg() *Organization { + if p == nil { + return nil + } + return p.Org +} + // GetRepo returns the Repo field. func (p *PageBuildEvent) GetRepo() *Repository { if p == nil { @@ -13862,6 +13950,14 @@ func (p *PersonalAccessTokenRequest) GetID() int64 { return *p.ID } +// GetOrg returns the Org field. +func (p *PersonalAccessTokenRequest) GetOrg() *Organization { + if p == nil { + return nil + } + return p.Org +} + // GetOwner returns the Owner field. func (p *PersonalAccessTokenRequest) GetOwner() *User { if p == nil { @@ -15454,6 +15550,14 @@ func (p *PublicEvent) GetInstallation() *Installation { return p.Installation } +// GetOrg returns the Org field. +func (p *PublicEvent) GetOrg() *Organization { + if p == nil { + return nil + } + return p.Org +} + // GetRepo returns the Repo field. func (p *PublicEvent) GetRepo() *Repository { if p == nil { @@ -16430,6 +16534,14 @@ func (p *PullRequestReviewCommentEvent) GetInstallation() *Installation { return p.Installation } +// GetOrg returns the Org field. +func (p *PullRequestReviewCommentEvent) GetOrg() *Organization { + if p == nil { + return nil + } + return p.Org +} + // GetPullRequest returns the PullRequest field. func (p *PullRequestReviewCommentEvent) GetPullRequest() *PullRequest { if p == nil { @@ -16654,6 +16766,14 @@ func (p *PullRequestReviewThreadEvent) GetInstallation() *Installation { return p.Installation } +// GetOrg returns the Org field. +func (p *PullRequestReviewThreadEvent) GetOrg() *Organization { + if p == nil { + return nil + } + return p.Org +} + // GetPullRequest returns the PullRequest field. func (p *PullRequestReviewThreadEvent) GetPullRequest() *PullRequest { if p == nil { @@ -17686,6 +17806,14 @@ func (r *ReleaseEvent) GetInstallation() *Installation { return r.Installation } +// GetOrg returns the Org field. +func (r *ReleaseEvent) GetOrg() *Organization { + if r == nil { + return nil + } + return r.Org +} + // GetRelease returns the Release field. func (r *ReleaseEvent) GetRelease() *RepositoryRelease { if r == nil { @@ -19774,6 +19902,14 @@ func (r *RepositoryVulnerabilityAlertEvent) GetInstallation() *Installation { return r.Installation } +// GetOrg returns the Org field. +func (r *RepositoryVulnerabilityAlertEvent) GetOrg() *Organization { + if r == nil { + return nil + } + return r.Org +} + // GetRepository returns the Repository field. func (r *RepositoryVulnerabilityAlertEvent) GetRepository() *Repository { if r == nil { @@ -21622,6 +21758,14 @@ func (s *StatusEvent) GetName() string { return *s.Name } +// GetOrg returns the Org field. +func (s *StatusEvent) GetOrg() *Organization { + if s == nil { + return nil + } + return s.Org +} + // GetRepo returns the Repo field. func (s *StatusEvent) GetRepo() *Repository { if s == nil { @@ -23950,6 +24094,14 @@ func (w *WatchEvent) GetInstallation() *Installation { return w.Installation } +// GetOrg returns the Org field. +func (w *WatchEvent) GetOrg() *Organization { + if w == nil { + return nil + } + return w.Org +} + // GetRepo returns the Repo field. func (w *WatchEvent) GetRepo() *Repository { if w == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index bdb4209a270..c3e02988ae7 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -4519,6 +4519,13 @@ func TestCommitCommentEvent_GetInstallation(tt *testing.T) { c.GetInstallation() } +func TestCommitCommentEvent_GetOrg(tt *testing.T) { + c := &CommitCommentEvent{} + c.GetOrg() + c = nil + c.GetOrg() +} + func TestCommitCommentEvent_GetRepo(tt *testing.T) { c := &CommitCommentEvent{} c.GetRepo() @@ -5969,6 +5976,13 @@ func TestDeleteEvent_GetInstallation(tt *testing.T) { d.GetInstallation() } +func TestDeleteEvent_GetOrg(tt *testing.T) { + d := &DeleteEvent{} + d.GetOrg() + d = nil + d.GetOrg() +} + func TestDeleteEvent_GetPusherType(tt *testing.T) { var zeroValue string d := &DeleteEvent{PusherType: &zeroValue} @@ -6570,6 +6584,13 @@ func TestDeploymentEvent_GetInstallation(tt *testing.T) { d.GetInstallation() } +func TestDeploymentEvent_GetOrg(tt *testing.T) { + d := &DeploymentEvent{} + d.GetOrg() + d = nil + d.GetOrg() +} + func TestDeploymentEvent_GetRepo(tt *testing.T) { d := &DeploymentEvent{} d.GetRepo() @@ -6911,6 +6932,13 @@ func TestDeploymentStatusEvent_GetInstallation(tt *testing.T) { d.GetInstallation() } +func TestDeploymentStatusEvent_GetOrg(tt *testing.T) { + d := &DeploymentStatusEvent{} + d.GetOrg() + d = nil + d.GetOrg() +} + func TestDeploymentStatusEvent_GetRepo(tt *testing.T) { d := &DeploymentStatusEvent{} d.GetRepo() @@ -9011,6 +9039,13 @@ func TestGollumEvent_GetInstallation(tt *testing.T) { g.GetInstallation() } +func TestGollumEvent_GetOrg(tt *testing.T) { + g := &GollumEvent{} + g.GetOrg() + g = nil + g.GetOrg() +} + func TestGollumEvent_GetRepo(tt *testing.T) { g := &GollumEvent{} g.GetRepo() @@ -10059,6 +10094,13 @@ func TestInstallationEvent_GetInstallation(tt *testing.T) { i.GetInstallation() } +func TestInstallationEvent_GetOrg(tt *testing.T) { + i := &InstallationEvent{} + i.GetOrg() + i = nil + i.GetOrg() +} + func TestInstallationEvent_GetRequester(tt *testing.T) { i := &InstallationEvent{} i.GetRequester() @@ -10470,6 +10512,13 @@ func TestInstallationRepositoriesEvent_GetInstallation(tt *testing.T) { i.GetInstallation() } +func TestInstallationRepositoriesEvent_GetOrg(tt *testing.T) { + i := &InstallationRepositoriesEvent{} + i.GetOrg() + i = nil + i.GetOrg() +} + func TestInstallationRepositoriesEvent_GetRepositorySelection(tt *testing.T) { var zeroValue string i := &InstallationRepositoriesEvent{RepositorySelection: &zeroValue} @@ -11706,6 +11755,13 @@ func TestIssuesEvent_GetMilestone(tt *testing.T) { i.GetMilestone() } +func TestIssuesEvent_GetOrg(tt *testing.T) { + i := &IssuesEvent{} + i.GetOrg() + i = nil + i.GetOrg() +} + func TestIssuesEvent_GetRepo(tt *testing.T) { i := &IssuesEvent{} i.GetRepo() @@ -12965,6 +13021,13 @@ func TestMarketplacePurchaseEvent_GetMarketplacePurchase(tt *testing.T) { m.GetMarketplacePurchase() } +func TestMarketplacePurchaseEvent_GetOrg(tt *testing.T) { + m := &MarketplacePurchaseEvent{} + m.GetOrg() + m = nil + m.GetOrg() +} + func TestMarketplacePurchaseEvent_GetPreviousMarketplacePurchase(tt *testing.T) { m := &MarketplacePurchaseEvent{} m.GetPreviousMarketplacePurchase() @@ -13013,6 +13076,13 @@ func TestMemberEvent_GetMember(tt *testing.T) { m.GetMember() } +func TestMemberEvent_GetOrg(tt *testing.T) { + m := &MemberEvent{} + m.GetOrg() + m = nil + m.GetOrg() +} + func TestMemberEvent_GetRepo(tt *testing.T) { m := &MemberEvent{} m.GetRepo() @@ -15620,6 +15690,13 @@ func TestPageBuildEvent_GetInstallation(tt *testing.T) { p.GetInstallation() } +func TestPageBuildEvent_GetOrg(tt *testing.T) { + p := &PageBuildEvent{} + p.GetOrg() + p = nil + p.GetOrg() +} + func TestPageBuildEvent_GetRepo(tt *testing.T) { p := &PageBuildEvent{} p.GetRepo() @@ -16263,6 +16340,13 @@ func TestPersonalAccessTokenRequest_GetID(tt *testing.T) { p.GetID() } +func TestPersonalAccessTokenRequest_GetOrg(tt *testing.T) { + p := &PersonalAccessTokenRequest{} + p.GetOrg() + p = nil + p.GetOrg() +} + func TestPersonalAccessTokenRequest_GetOwner(tt *testing.T) { p := &PersonalAccessTokenRequest{} p.GetOwner() @@ -17980,6 +18064,13 @@ func TestPublicEvent_GetInstallation(tt *testing.T) { p.GetInstallation() } +func TestPublicEvent_GetOrg(tt *testing.T) { + p := &PublicEvent{} + p.GetOrg() + p = nil + p.GetOrg() +} + func TestPublicEvent_GetRepo(tt *testing.T) { p := &PublicEvent{} p.GetRepo() @@ -19110,6 +19201,13 @@ func TestPullRequestReviewCommentEvent_GetInstallation(tt *testing.T) { p.GetInstallation() } +func TestPullRequestReviewCommentEvent_GetOrg(tt *testing.T) { + p := &PullRequestReviewCommentEvent{} + p.GetOrg() + p = nil + p.GetOrg() +} + func TestPullRequestReviewCommentEvent_GetPullRequest(tt *testing.T) { p := &PullRequestReviewCommentEvent{} p.GetPullRequest() @@ -19342,6 +19440,13 @@ func TestPullRequestReviewThreadEvent_GetInstallation(tt *testing.T) { p.GetInstallation() } +func TestPullRequestReviewThreadEvent_GetOrg(tt *testing.T) { + p := &PullRequestReviewThreadEvent{} + p.GetOrg() + p = nil + p.GetOrg() +} + func TestPullRequestReviewThreadEvent_GetPullRequest(tt *testing.T) { p := &PullRequestReviewThreadEvent{} p.GetPullRequest() @@ -20530,6 +20635,13 @@ func TestReleaseEvent_GetInstallation(tt *testing.T) { r.GetInstallation() } +func TestReleaseEvent_GetOrg(tt *testing.T) { + r := &ReleaseEvent{} + r.GetOrg() + r = nil + r.GetOrg() +} + func TestReleaseEvent_GetRelease(tt *testing.T) { r := &ReleaseEvent{} r.GetRelease() @@ -23011,6 +23123,13 @@ func TestRepositoryVulnerabilityAlertEvent_GetInstallation(tt *testing.T) { r.GetInstallation() } +func TestRepositoryVulnerabilityAlertEvent_GetOrg(tt *testing.T) { + r := &RepositoryVulnerabilityAlertEvent{} + r.GetOrg() + r = nil + r.GetOrg() +} + func TestRepositoryVulnerabilityAlertEvent_GetRepository(tt *testing.T) { r := &RepositoryVulnerabilityAlertEvent{} r.GetRepository() @@ -25165,6 +25284,13 @@ func TestStatusEvent_GetName(tt *testing.T) { s.GetName() } +func TestStatusEvent_GetOrg(tt *testing.T) { + s := &StatusEvent{} + s.GetOrg() + s = nil + s.GetOrg() +} + func TestStatusEvent_GetRepo(tt *testing.T) { s := &StatusEvent{} s.GetRepo() @@ -27925,6 +28051,13 @@ func TestWatchEvent_GetInstallation(tt *testing.T) { w.GetInstallation() } +func TestWatchEvent_GetOrg(tt *testing.T) { + w := &WatchEvent{} + w.GetOrg() + w = nil + w.GetOrg() +} + func TestWatchEvent_GetRepo(tt *testing.T) { w := &WatchEvent{} w.GetRepo() From 5ea85e29d8e8ea9c5573bd3994ad7aa75b128fc8 Mon Sep 17 00:00:00 2001 From: k0ral Date: Wed, 4 Oct 2023 21:35:21 +0200 Subject: [PATCH 034/145] Escape branch string before inserting it in URL (#2948) --- github/repos.go | 125 +- github/repos_test.go | 4400 +++++++++++++++++++++++------------------- 2 files changed, 2539 insertions(+), 1986 deletions(-) diff --git a/github/repos.go b/github/repos.go index e09971abea9..f2059926ec8 100644 --- a/github/repos.go +++ b/github/repos.go @@ -11,6 +11,7 @@ import ( "errors" "fmt" "net/http" + "net/url" "strings" ) @@ -1273,9 +1274,11 @@ func (s *RepositoriesService) ListBranches(ctx context.Context, owner string, re // GetBranch gets the specified branch for a repository. // +// Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// // GitHub API docs: https://docs.github.com/en/rest/branches/branches#get-a-branch func (s *RepositoriesService) GetBranch(ctx context.Context, owner, repo, branch string, maxRedirects int) (*Branch, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v", owner, repo, branch) + u := fmt.Sprintf("repos/%v/%v/branches/%v", owner, repo, url.PathEscape(branch)) resp, err := s.client.roundTripWithOptionalFollowRedirect(ctx, u, maxRedirects) if err != nil { @@ -1302,9 +1305,11 @@ type renameBranchRequest struct { // To rename a non-default branch: Users must have push access. GitHub Apps must have the `contents:write` repository permission. // To rename the default branch: Users must have admin or owner permissions. GitHub Apps must have the `administration:write` repository permission. // +// Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// // GitHub API docs: https://docs.github.com/en/rest/branches/branches#rename-a-branch func (s *RepositoriesService) RenameBranch(ctx context.Context, owner, repo, branch, newName string) (*Branch, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/rename", owner, repo, branch) + u := fmt.Sprintf("repos/%v/%v/branches/%v/rename", owner, repo, url.PathEscape(branch)) r := &renameBranchRequest{NewName: newName} req, err := s.client.NewRequest("POST", u, r) if err != nil { @@ -1322,9 +1327,11 @@ func (s *RepositoriesService) RenameBranch(ctx context.Context, owner, repo, bra // GetBranchProtection gets the protection of a given branch. // +// Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// // GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#get-branch-protection func (s *RepositoriesService) GetBranchProtection(ctx context.Context, owner, repo, branch string) (*Protection, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection", owner, repo, branch) + u := fmt.Sprintf("repos/%v/%v/branches/%v/protection", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err @@ -1347,9 +1354,11 @@ func (s *RepositoriesService) GetBranchProtection(ctx context.Context, owner, re // GetRequiredStatusChecks gets the required status checks for a given protected branch. // +// Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// // GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#get-status-checks-protection func (s *RepositoriesService) GetRequiredStatusChecks(ctx context.Context, owner, repo, branch string) (*RequiredStatusChecks, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_status_checks", owner, repo, branch) + u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_status_checks", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err @@ -1369,9 +1378,11 @@ func (s *RepositoriesService) GetRequiredStatusChecks(ctx context.Context, owner // ListRequiredStatusChecksContexts lists the required status checks contexts for a given protected branch. // +// Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// // GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#get-all-status-check-contexts func (s *RepositoriesService) ListRequiredStatusChecksContexts(ctx context.Context, owner, repo, branch string) (contexts []string, resp *Response, err error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_status_checks/contexts", owner, repo, branch) + u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_status_checks/contexts", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err @@ -1390,9 +1401,11 @@ func (s *RepositoriesService) ListRequiredStatusChecksContexts(ctx context.Conte // UpdateBranchProtection updates the protection of a given branch. // +// Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// // GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#update-branch-protection func (s *RepositoriesService) UpdateBranchProtection(ctx context.Context, owner, repo, branch string, preq *ProtectionRequest) (*Protection, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection", owner, repo, branch) + u := fmt.Sprintf("repos/%v/%v/branches/%v/protection", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("PUT", u, preq) if err != nil { return nil, nil, err @@ -1412,9 +1425,11 @@ func (s *RepositoriesService) UpdateBranchProtection(ctx context.Context, owner, // RemoveBranchProtection removes the protection of a given branch. // +// Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// // GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#delete-branch-protection func (s *RepositoriesService) RemoveBranchProtection(ctx context.Context, owner, repo, branch string) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection", owner, repo, branch) + u := fmt.Sprintf("repos/%v/%v/branches/%v/protection", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { return nil, err @@ -1425,9 +1440,11 @@ func (s *RepositoriesService) RemoveBranchProtection(ctx context.Context, owner, // GetSignaturesProtectedBranch gets required signatures of protected branch. // +// Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// // GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#get-commit-signature-protection func (s *RepositoriesService) GetSignaturesProtectedBranch(ctx context.Context, owner, repo, branch string) (*SignaturesProtectedBranch, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_signatures", owner, repo, branch) + u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_signatures", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err @@ -1448,9 +1465,11 @@ func (s *RepositoriesService) GetSignaturesProtectedBranch(ctx context.Context, // RequireSignaturesOnProtectedBranch makes signed commits required on a protected branch. // It requires admin access and branch protection to be enabled. // +// Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// // GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#create-commit-signature-protection func (s *RepositoriesService) RequireSignaturesOnProtectedBranch(ctx context.Context, owner, repo, branch string) (*SignaturesProtectedBranch, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_signatures", owner, repo, branch) + u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_signatures", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("POST", u, nil) if err != nil { return nil, nil, err @@ -1470,9 +1489,11 @@ func (s *RepositoriesService) RequireSignaturesOnProtectedBranch(ctx context.Con // OptionalSignaturesOnProtectedBranch removes required signed commits on a given branch. // +// Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// // GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#delete-commit-signature-protection func (s *RepositoriesService) OptionalSignaturesOnProtectedBranch(ctx context.Context, owner, repo, branch string) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_signatures", owner, repo, branch) + u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_signatures", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { return nil, err @@ -1486,9 +1507,11 @@ func (s *RepositoriesService) OptionalSignaturesOnProtectedBranch(ctx context.Co // UpdateRequiredStatusChecks updates the required status checks for a given protected branch. // +// Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// // GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#update-status-check-protection func (s *RepositoriesService) UpdateRequiredStatusChecks(ctx context.Context, owner, repo, branch string, sreq *RequiredStatusChecksRequest) (*RequiredStatusChecks, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_status_checks", owner, repo, branch) + u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_status_checks", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("PATCH", u, sreq) if err != nil { return nil, nil, err @@ -1505,9 +1528,11 @@ func (s *RepositoriesService) UpdateRequiredStatusChecks(ctx context.Context, ow // RemoveRequiredStatusChecks removes the required status checks for a given protected branch. // +// Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// // GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#remove-status-check-protection func (s *RepositoriesService) RemoveRequiredStatusChecks(ctx context.Context, owner, repo, branch string) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_status_checks", owner, repo, branch) + u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_status_checks", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { return nil, err @@ -1537,9 +1562,11 @@ func (s *RepositoriesService) License(ctx context.Context, owner, repo string) ( // GetPullRequestReviewEnforcement gets pull request review enforcement of a protected branch. // +// Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// // GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#get-pull-request-review-protection func (s *RepositoriesService) GetPullRequestReviewEnforcement(ctx context.Context, owner, repo, branch string) (*PullRequestReviewsEnforcement, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_pull_request_reviews", owner, repo, branch) + u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_pull_request_reviews", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err @@ -1560,9 +1587,11 @@ func (s *RepositoriesService) GetPullRequestReviewEnforcement(ctx context.Contex // UpdatePullRequestReviewEnforcement patches pull request review enforcement of a protected branch. // It requires admin access and branch protection to be enabled. // +// Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// // GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#update-pull-request-review-protection func (s *RepositoriesService) UpdatePullRequestReviewEnforcement(ctx context.Context, owner, repo, branch string, patch *PullRequestReviewsEnforcementUpdate) (*PullRequestReviewsEnforcement, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_pull_request_reviews", owner, repo, branch) + u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_pull_request_reviews", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("PATCH", u, patch) if err != nil { return nil, nil, err @@ -1583,9 +1612,11 @@ func (s *RepositoriesService) UpdatePullRequestReviewEnforcement(ctx context.Con // DisableDismissalRestrictions disables dismissal restrictions of a protected branch. // It requires admin access and branch protection to be enabled. // +// Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// // GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#update-pull-request-review-protection func (s *RepositoriesService) DisableDismissalRestrictions(ctx context.Context, owner, repo, branch string) (*PullRequestReviewsEnforcement, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_pull_request_reviews", owner, repo, branch) + u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_pull_request_reviews", owner, repo, url.PathEscape(branch)) data := new(struct { DismissalRestrictionsRequest `json:"dismissal_restrictions"` @@ -1610,9 +1641,11 @@ func (s *RepositoriesService) DisableDismissalRestrictions(ctx context.Context, // RemovePullRequestReviewEnforcement removes pull request enforcement of a protected branch. // +// Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// // GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#delete-pull-request-review-protection func (s *RepositoriesService) RemovePullRequestReviewEnforcement(ctx context.Context, owner, repo, branch string) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_pull_request_reviews", owner, repo, branch) + u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_pull_request_reviews", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { return nil, err @@ -1623,9 +1656,11 @@ func (s *RepositoriesService) RemovePullRequestReviewEnforcement(ctx context.Con // GetAdminEnforcement gets admin enforcement information of a protected branch. // +// Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// // GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#get-admin-branch-protection func (s *RepositoriesService) GetAdminEnforcement(ctx context.Context, owner, repo, branch string) (*AdminEnforcement, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/enforce_admins", owner, repo, branch) + u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/enforce_admins", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err @@ -1643,9 +1678,11 @@ func (s *RepositoriesService) GetAdminEnforcement(ctx context.Context, owner, re // AddAdminEnforcement adds admin enforcement to a protected branch. // It requires admin access and branch protection to be enabled. // +// Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// // GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#set-admin-branch-protection func (s *RepositoriesService) AddAdminEnforcement(ctx context.Context, owner, repo, branch string) (*AdminEnforcement, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/enforce_admins", owner, repo, branch) + u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/enforce_admins", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("POST", u, nil) if err != nil { return nil, nil, err @@ -1662,9 +1699,11 @@ func (s *RepositoriesService) AddAdminEnforcement(ctx context.Context, owner, re // RemoveAdminEnforcement removes admin enforcement from a protected branch. // +// Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// // GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#delete-admin-branch-protection func (s *RepositoriesService) RemoveAdminEnforcement(ctx context.Context, owner, repo, branch string) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/enforce_admins", owner, repo, branch) + u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/enforce_admins", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { return nil, err @@ -1731,11 +1770,13 @@ func (s *RepositoriesService) ReplaceAllTopics(ctx context.Context, owner, repo // ListApps lists the GitHub apps that have push access to a given protected branch. // It requires the GitHub apps to have `write` access to the `content` permission. // +// Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// // GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#get-apps-with-access-to-the-protected-branch // // Deprecated: Please use ListAppRestrictions instead. func (s *RepositoriesService) ListApps(ctx context.Context, owner, repo, branch string) ([]*App, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/apps", owner, repo, branch) + u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/apps", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err @@ -1766,9 +1807,11 @@ func (s *RepositoriesService) ListAppRestrictions(ctx context.Context, owner, re // // Note: The list of users, apps, and teams in total is limited to 100 items. // +// Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// // GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#set-app-access-restrictions func (s *RepositoriesService) ReplaceAppRestrictions(ctx context.Context, owner, repo, branch string, apps []string) ([]*App, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/apps", owner, repo, branch) + u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/apps", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("PUT", u, apps) if err != nil { return nil, nil, err @@ -1788,9 +1831,11 @@ func (s *RepositoriesService) ReplaceAppRestrictions(ctx context.Context, owner, // // Note: The list of users, apps, and teams in total is limited to 100 items. // +// Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// // GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#add-app-access-restrictions func (s *RepositoriesService) AddAppRestrictions(ctx context.Context, owner, repo, branch string, apps []string) ([]*App, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/apps", owner, repo, branch) + u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/apps", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("POST", u, apps) if err != nil { return nil, nil, err @@ -1810,9 +1855,11 @@ func (s *RepositoriesService) AddAppRestrictions(ctx context.Context, owner, rep // // Note: The list of users, apps, and teams in total is limited to 100 items. // +// Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// // GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#remove-app-access-restrictions func (s *RepositoriesService) RemoveAppRestrictions(ctx context.Context, owner, repo, branch string, apps []string) ([]*App, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/apps", owner, repo, branch) + u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/apps", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("DELETE", u, apps) if err != nil { return nil, nil, err @@ -1830,9 +1877,11 @@ func (s *RepositoriesService) RemoveAppRestrictions(ctx context.Context, owner, // ListTeamRestrictions lists the GitHub teams that have push access to a given protected branch. // It requires the GitHub teams to have `write` access to the `content` permission. // +// Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// // GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#get-teams-with-access-to-the-protected-branch func (s *RepositoriesService) ListTeamRestrictions(ctx context.Context, owner, repo, branch string) ([]*Team, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/teams", owner, repo, branch) + u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/teams", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err @@ -1853,9 +1902,11 @@ func (s *RepositoriesService) ListTeamRestrictions(ctx context.Context, owner, r // // Note: The list of users, apps, and teams in total is limited to 100 items. // +// Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// // GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#set-team-access-restrictions func (s *RepositoriesService) ReplaceTeamRestrictions(ctx context.Context, owner, repo, branch string, teams []string) ([]*Team, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/teams", owner, repo, branch) + u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/teams", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("PUT", u, teams) if err != nil { return nil, nil, err @@ -1875,9 +1926,11 @@ func (s *RepositoriesService) ReplaceTeamRestrictions(ctx context.Context, owner // // Note: The list of users, apps, and teams in total is limited to 100 items. // +// Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// // GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#add-team-access-restrictions func (s *RepositoriesService) AddTeamRestrictions(ctx context.Context, owner, repo, branch string, teams []string) ([]*Team, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/teams", owner, repo, branch) + u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/teams", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("POST", u, teams) if err != nil { return nil, nil, err @@ -1897,9 +1950,11 @@ func (s *RepositoriesService) AddTeamRestrictions(ctx context.Context, owner, re // // Note: The list of users, apps, and teams in total is limited to 100 items. // +// Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// // GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#remove-team-access-restrictions func (s *RepositoriesService) RemoveTeamRestrictions(ctx context.Context, owner, repo, branch string, teams []string) ([]*Team, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/teams", owner, repo, branch) + u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/teams", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("DELETE", u, teams) if err != nil { return nil, nil, err @@ -1917,9 +1972,11 @@ func (s *RepositoriesService) RemoveTeamRestrictions(ctx context.Context, owner, // ListUserRestrictions lists the GitHub users that have push access to a given protected branch. // It requires the GitHub users to have `write` access to the `content` permission. // +// Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// // GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#get-users-with-access-to-the-protected-branch func (s *RepositoriesService) ListUserRestrictions(ctx context.Context, owner, repo, branch string) ([]*User, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/users", owner, repo, branch) + u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/users", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err @@ -1940,9 +1997,11 @@ func (s *RepositoriesService) ListUserRestrictions(ctx context.Context, owner, r // // Note: The list of users, apps, and teams in total is limited to 100 items. // +// Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// // GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#set-team-access-restrictions func (s *RepositoriesService) ReplaceUserRestrictions(ctx context.Context, owner, repo, branch string, users []string) ([]*User, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/users", owner, repo, branch) + u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/users", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("PUT", u, users) if err != nil { return nil, nil, err @@ -1962,9 +2021,11 @@ func (s *RepositoriesService) ReplaceUserRestrictions(ctx context.Context, owner // // Note: The list of users, apps, and teams in total is limited to 100 items. // +// Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// // GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#add-team-access-restrictions func (s *RepositoriesService) AddUserRestrictions(ctx context.Context, owner, repo, branch string, users []string) ([]*User, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/users", owner, repo, branch) + u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/users", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("POST", u, users) if err != nil { return nil, nil, err @@ -1984,9 +2045,11 @@ func (s *RepositoriesService) AddUserRestrictions(ctx context.Context, owner, re // // Note: The list of users, apps, and teams in total is limited to 100 items. // +// Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . +// // GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#remove-team-access-restrictions func (s *RepositoriesService) RemoveUserRestrictions(ctx context.Context, owner, repo, branch string, users []string) ([]*User, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/users", owner, repo, branch) + u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/users", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("DELETE", u, users) if err != nil { return nil, nil, err diff --git a/github/repos_test.go b/github/repos_test.go index 6aba962a91f..7486e488fe6 100644 --- a/github/repos_test.go +++ b/github/repos_test.go @@ -919,51 +919,73 @@ func TestRepositoriesService_GetBranch(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - mux.HandleFunc("/repos/o/r/branches/b", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, `{"name":"n", "commit":{"sha":"s","commit":{"message":"m"}}, "protected":true}`) - }) + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%"}, + } + + for _, test := range tests { + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + fmt.Fprint(w, `{"name":"n", "commit":{"sha":"s","commit":{"message":"m"}}, "protected":true}`) + }) - ctx := context.Background() - branch, _, err := client.Repositories.GetBranch(ctx, "o", "r", "b", 0) - if err != nil { - t.Errorf("Repositories.GetBranch returned error: %v", err) - } + ctx := context.Background() + branch, _, err := client.Repositories.GetBranch(ctx, "o", "r", test.branch, 0) + if err != nil { + t.Errorf("Repositories.GetBranch returned error: %v", err) + } - want := &Branch{ - Name: String("n"), - Commit: &RepositoryCommit{ - SHA: String("s"), - Commit: &Commit{ - Message: String("m"), + want := &Branch{ + Name: String("n"), + Commit: &RepositoryCommit{ + SHA: String("s"), + Commit: &Commit{ + Message: String("m"), + }, }, - }, - Protected: Bool(true), - } + Protected: Bool(true), + } - if !cmp.Equal(branch, want) { - t.Errorf("Repositories.GetBranch returned %+v, want %+v", branch, want) - } + if !cmp.Equal(branch, want) { + t.Errorf("Repositories.GetBranch returned %+v, want %+v", branch, want) + } - const methodName = "GetBranch" - testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Repositories.GetBranch(ctx, "\n", "\n", "\n", 0) - return err - }) + const methodName = "GetBranch" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Repositories.GetBranch(ctx, "\n", "\n", "\n", 0) + return err + }) + } } func TestRepositoriesService_GetBranch_BadJSONResponse(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() - - mux.HandleFunc("/repos/o/r/branches/b", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, `{"name":"n", "commit":{"sha":...truncated`) - }) - - ctx := context.Background() - if _, _, err := client.Repositories.GetBranch(ctx, "o", "r", "b", 0); err == nil { - t.Error("Repositories.GetBranch returned no error; wanted JSON error") + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%"}, + } + + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + fmt.Fprint(w, `{"name":"n", "commit":{"sha":...truncated`) + }) + + ctx := context.Background() + if _, _, err := client.Repositories.GetBranch(ctx, "o", "r", test.branch, 0); err == nil { + t.Error("Repositories.GetBranch returned no error; wanted JSON error") + } + }) } } @@ -1005,492 +1027,1013 @@ func TestRepositoriesService_GetBranch_StatusMovedPermanently_followRedirects(t } func TestRepositoriesService_GetBranch_notFound(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat-branch-50%"}, + } + + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + http.Error(w, "branch not found", http.StatusNotFound) + }) + ctx := context.Background() + _, resp, err := client.Repositories.GetBranch(ctx, "o", "r", test.branch, 1) + if err == nil { + t.Error("Repositories.GetBranch returned error: nil") + } + if resp.StatusCode != http.StatusNotFound { + t.Errorf("Repositories.GetBranch returned status: %d, want %d", resp.StatusCode, http.StatusNotFound) + } - mux.HandleFunc("/repos/o/r/branches/b", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - http.Error(w, "branch not found", http.StatusNotFound) - }) - ctx := context.Background() - _, resp, err := client.Repositories.GetBranch(ctx, "o", "r", "b", 1) - if err == nil { - t.Error("Repositories.GetBranch returned error: nil") + // Add custom round tripper + client.client.Transport = roundTripperFunc(func(r *http.Request) (*http.Response, error) { + return nil, errors.New("failed to get branch") + }) + + const methodName = "GetBranch" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Repositories.GetBranch(ctx, "\n", "\n", "\n", 1) + return err + }) + }) } - if resp.StatusCode != http.StatusNotFound { - t.Errorf("Repositories.GetBranch returned status: %d, want %d", resp.StatusCode, http.StatusNotFound) +} + +func TestRepositoriesService_RenameBranch(t *testing.T) { + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b/rename"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%/rename"}, } - // Add custom round tripper - client.client.Transport = roundTripperFunc(func(r *http.Request) (*http.Response, error) { - return nil, errors.New("failed to get branch") - }) + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() - const methodName = "GetBranch" - testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Repositories.GetBranch(ctx, "\n", "\n", "\n", 1) - return err - }) -} + renameBranchReq := "nn" -func TestRepositoriesService_RenameBranch(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + v := new(renameBranchRequest) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) - renameBranchReq := "nn" + testMethod(t, r, "POST") + want := &renameBranchRequest{NewName: renameBranchReq} + if !cmp.Equal(v, want) { + t.Errorf("Request body = %+v, want %+v", v, want) + } - mux.HandleFunc("/repos/o/r/branches/b/rename", func(w http.ResponseWriter, r *http.Request) { - v := new(renameBranchRequest) - assertNilError(t, json.NewDecoder(r.Body).Decode(v)) + fmt.Fprint(w, `{"protected":true,"name":"nn"}`) + }) - testMethod(t, r, "POST") - want := &renameBranchRequest{NewName: "nn"} - if !cmp.Equal(v, want) { - t.Errorf("Request body = %+v, want %+v", v, want) - } + ctx := context.Background() + got, _, err := client.Repositories.RenameBranch(ctx, "o", "r", test.branch, renameBranchReq) + if err != nil { + t.Errorf("Repositories.RenameBranch returned error: %v", err) + } - fmt.Fprint(w, `{"protected":true,"name":"nn"}`) - }) + want := &Branch{Name: String("nn"), Protected: Bool(true)} + if !cmp.Equal(got, want) { + t.Errorf("Repositories.RenameBranch returned %+v, want %+v", got, want) + } - ctx := context.Background() - got, _, err := client.Repositories.RenameBranch(ctx, "o", "r", "b", renameBranchReq) - if err != nil { - t.Errorf("Repositories.RenameBranch returned error: %v", err) - } + const methodName = "RenameBranch" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Repositories.RenameBranch(ctx, "\n", "\n", "\n", renameBranchReq) + return err + }) - want := &Branch{Name: String("nn"), Protected: Bool(true)} - if !cmp.Equal(got, want) { - t.Errorf("Repositories.RenameBranch returned %+v, want %+v", got, want) + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Repositories.RenameBranch(ctx, "o", "r", test.branch, renameBranchReq) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) + }) } +} - const methodName = "RenameBranch" - testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Repositories.RenameBranch(ctx, "\n", "\n", "\n", renameBranchReq) - return err - }) +func TestRepositoriesService_GetBranchProtection(t *testing.T) { + tests := []struct { + branch string + urlPath string + enforceAdminsURLPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b/protection", enforceAdminsURLPath: "/repos/o/r/branches/b/protection/enforce_admins"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%/protection", enforceAdminsURLPath: "/repos/o/r/branches/feat/branch-50%/protection/enforce_admins"}, + } + + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + // TODO: remove custom Accept header when this API fully launches + testHeader(t, r, "Accept", mediaTypeRequiredApprovingReviewsPreview) + fmt.Fprintf(w, `{ + "required_status_checks":{ + "strict":true, + "contexts":["continuous-integration"], + "checks": [ + { + "context": "continuous-integration", + "app_id": null + } + ] + }, + "required_pull_request_reviews":{ + "dismissal_restrictions":{ + "users":[{ + "id":3, + "login":"u" + }], + "teams":[{ + "id":4, + "slug":"t" + }], + "apps":[{ + "id":5, + "slug":"a" + }] + }, + "dismiss_stale_reviews":true, + "require_code_owner_reviews":true, + "require_last_push_approval":false, + "required_approving_review_count":1 + }, + "enforce_admins":{ + "url":"%s", + "enabled":true + }, + "restrictions":{ + "users":[{"id":1,"login":"u"}], + "teams":[{"id":2,"slug":"t"}], + "apps":[{"id":3,"slug":"a"}] + }, + "required_conversation_resolution": { + "enabled": true + }, + "block_creations": { + "enabled": false + }, + "lock_branch": { + "enabled": false + }, + "allow_fork_syncing": { + "enabled": false + } + }`, test.enforceAdminsURLPath) + }) + + ctx := context.Background() + protection, _, err := client.Repositories.GetBranchProtection(ctx, "o", "r", test.branch) + if err != nil { + t.Errorf("Repositories.GetBranchProtection returned error: %v", err) + } - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Repositories.RenameBranch(ctx, "o", "r", "b", renameBranchReq) - if got != nil { - t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) - } - return resp, err - }) + want := &Protection{ + RequiredStatusChecks: &RequiredStatusChecks{ + Strict: true, + Contexts: []string{"continuous-integration"}, + Checks: []*RequiredStatusCheck{ + { + Context: "continuous-integration", + }, + }, + }, + RequiredPullRequestReviews: &PullRequestReviewsEnforcement{ + DismissStaleReviews: true, + DismissalRestrictions: &DismissalRestrictions{ + Users: []*User{ + {Login: String("u"), ID: Int64(3)}, + }, + Teams: []*Team{ + {Slug: String("t"), ID: Int64(4)}, + }, + Apps: []*App{ + {Slug: String("a"), ID: Int64(5)}, + }, + }, + RequireCodeOwnerReviews: true, + RequiredApprovingReviewCount: 1, + RequireLastPushApproval: false, + }, + EnforceAdmins: &AdminEnforcement{ + URL: String(test.enforceAdminsURLPath), + Enabled: true, + }, + Restrictions: &BranchRestrictions{ + Users: []*User{ + {Login: String("u"), ID: Int64(1)}, + }, + Teams: []*Team{ + {Slug: String("t"), ID: Int64(2)}, + }, + Apps: []*App{ + {Slug: String("a"), ID: Int64(3)}, + }, + }, + RequiredConversationResolution: &RequiredConversationResolution{ + Enabled: true, + }, + BlockCreations: &BlockCreations{ + Enabled: Bool(false), + }, + LockBranch: &LockBranch{ + Enabled: Bool(false), + }, + AllowForkSyncing: &AllowForkSyncing{ + Enabled: Bool(false), + }, + } + if !cmp.Equal(protection, want) { + t.Errorf("Repositories.GetBranchProtection returned %+v, want %+v", protection, want) + } + + const methodName = "GetBranchProtection" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Repositories.GetBranchProtection(ctx, "\n", "\n", "\n") + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Repositories.GetBranchProtection(ctx, "o", "r", test.branch) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) + }) + } } -func TestRepositoriesService_GetBranchProtection(t *testing.T) { +func TestRepositoriesService_GetBranchProtection_noDismissalRestrictions(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - mux.HandleFunc("/repos/o/r/branches/b/protection", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - // TODO: remove custom Accept header when this API fully launches - testHeader(t, r, "Accept", mediaTypeRequiredApprovingReviewsPreview) - fmt.Fprintf(w, `{ - "required_status_checks":{ - "strict":true, - "contexts":["continuous-integration"], - "checks": [ - { - "context": "continuous-integration", - "app_id": null + tests := []struct { + branch string + urlPath string + enforceAdminsURLPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b/protection", enforceAdminsURLPath: "/repos/o/r/branches/b/protection/enforce_admins"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%/protection", enforceAdminsURLPath: "/repos/o/r/branches/feat/branch-50%/protection/enforce_admins"}, + } + + for _, test := range tests { + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + // TODO: remove custom Accept header when this API fully launches + testHeader(t, r, "Accept", mediaTypeRequiredApprovingReviewsPreview) + fmt.Fprintf(w, `{ + "required_status_checks":{ + "strict":true, + "contexts":["continuous-integration"], + "checks": [ + { + "context": "continuous-integration", + "app_id": null + } + ] + }, + "required_pull_request_reviews":{ + "dismiss_stale_reviews":true, + "require_code_owner_reviews":true, + "required_approving_review_count":1 + }, + "enforce_admins":{ + "url":"%s", + "enabled":true + }, + "restrictions":{ + "users":[{"id":1,"login":"u"}], + "teams":[{"id":2,"slug":"t"}] } - ] + }`, test.enforceAdminsURLPath) + }) + + ctx := context.Background() + protection, _, err := client.Repositories.GetBranchProtection(ctx, "o", "r", test.branch) + if err != nil { + t.Errorf("Repositories.GetBranchProtection returned error: %v", err) + } + + want := &Protection{ + RequiredStatusChecks: &RequiredStatusChecks{ + Strict: true, + Contexts: []string{"continuous-integration"}, + Checks: []*RequiredStatusCheck{ + { + Context: "continuous-integration", + }, }, - "required_pull_request_reviews":{ - "dismissal_restrictions":{ - "users":[{ - "id":3, - "login":"u" - }], - "teams":[{ - "id":4, - "slug":"t" - }], - "apps":[{ - "id":5, - "slug":"a" - }] + }, + RequiredPullRequestReviews: &PullRequestReviewsEnforcement{ + DismissStaleReviews: true, + DismissalRestrictions: nil, + RequireCodeOwnerReviews: true, + RequiredApprovingReviewCount: 1, + }, + EnforceAdmins: &AdminEnforcement{ + URL: String(test.enforceAdminsURLPath), + Enabled: true, + }, + Restrictions: &BranchRestrictions{ + Users: []*User{ + {Login: String("u"), ID: Int64(1)}, + }, + Teams: []*Team{ + {Slug: String("t"), ID: Int64(2)}, + }, + }, + } + if !cmp.Equal(protection, want) { + t.Errorf("Repositories.GetBranchProtection returned %+v, want %+v", protection, want) + } + } +} + +func TestRepositoriesService_GetBranchProtection_branchNotProtected(t *testing.T) { + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b/protection"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%/protection"}, + } + + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + + w.WriteHeader(http.StatusBadRequest) + fmt.Fprintf(w, `{ + "message": %q, + "documentation_url": "https://docs.github.com/rest/repos#get-branch-protection" + }`, githubBranchNotProtected) + }) + + ctx := context.Background() + protection, _, err := client.Repositories.GetBranchProtection(ctx, "o", "r", test.branch) + + if protection != nil { + t.Errorf("Repositories.GetBranchProtection returned non-nil protection data") + } + + if err != ErrBranchNotProtected { + t.Errorf("Repositories.GetBranchProtection returned an invalid error: %v", err) + } + }) + } +} + +func TestRepositoriesService_UpdateBranchProtection_Contexts(t *testing.T) { + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b/protection"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%/protection"}, + } + + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + input := &ProtectionRequest{ + RequiredStatusChecks: &RequiredStatusChecks{ + Strict: true, + Contexts: []string{"continuous-integration"}, + }, + RequiredPullRequestReviews: &PullRequestReviewsEnforcementRequest{ + DismissStaleReviews: true, + DismissalRestrictionsRequest: &DismissalRestrictionsRequest{ + Users: &[]string{"uu"}, + Teams: &[]string{"tt"}, + Apps: &[]string{"aa"}, }, - "dismiss_stale_reviews":true, - "require_code_owner_reviews":true, - "require_last_push_approval":false, - "required_approving_review_count":1 + BypassPullRequestAllowancesRequest: &BypassPullRequestAllowancesRequest{ + Users: []string{"uuu"}, + Teams: []string{"ttt"}, + Apps: []string{"aaa"}, + }, + }, + Restrictions: &BranchRestrictionsRequest{ + Users: []string{"u"}, + Teams: []string{"t"}, + Apps: []string{"a"}, + }, + BlockCreations: Bool(true), + LockBranch: Bool(true), + AllowForkSyncing: Bool(true), + } + + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + v := new(ProtectionRequest) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) + + testMethod(t, r, "PUT") + if !cmp.Equal(v, input) { + t.Errorf("Request body = %+v, want %+v", v, input) + } + + // TODO: remove custom Accept header when this API fully launches + testHeader(t, r, "Accept", mediaTypeRequiredApprovingReviewsPreview) + fmt.Fprintf(w, `{ + "required_status_checks":{ + "strict":true, + "contexts":["continuous-integration"], + "checks": [ + { + "context": "continuous-integration", + "app_id": null + } + ] }, - "enforce_admins":{ - "url":"/repos/o/r/branches/b/protection/enforce_admins", - "enabled":true + "required_pull_request_reviews":{ + "dismissal_restrictions":{ + "users":[{ + "id":3, + "login":"uu" + }], + "teams":[{ + "id":4, + "slug":"tt" + }], + "apps":[{ + "id":5, + "slug":"aa" + }] + }, + "dismiss_stale_reviews":true, + "require_code_owner_reviews":true, + "bypass_pull_request_allowances": { + "users":[{"id":10,"login":"uuu"}], + "teams":[{"id":20,"slug":"ttt"}], + "apps":[{"id":30,"slug":"aaa"}] + } }, "restrictions":{ "users":[{"id":1,"login":"u"}], "teams":[{"id":2,"slug":"t"}], "apps":[{"id":3,"slug":"a"}] }, - "required_conversation_resolution": { - "enabled": true - }, "block_creations": { - "enabled": false + "enabled": true }, "lock_branch": { - "enabled": false + "enabled": true }, "allow_fork_syncing": { - "enabled": false + "enabled": true } }`) - }) + }) - ctx := context.Background() - protection, _, err := client.Repositories.GetBranchProtection(ctx, "o", "r", "b") - if err != nil { - t.Errorf("Repositories.GetBranchProtection returned error: %v", err) - } + ctx := context.Background() + protection, _, err := client.Repositories.UpdateBranchProtection(ctx, "o", "r", test.branch, input) + if err != nil { + t.Errorf("Repositories.UpdateBranchProtection returned error: %v", err) + } - want := &Protection{ - RequiredStatusChecks: &RequiredStatusChecks{ - Strict: true, - Contexts: []string{"continuous-integration"}, - Checks: []*RequiredStatusCheck{ - { - Context: "continuous-integration", + want := &Protection{ + RequiredStatusChecks: &RequiredStatusChecks{ + Strict: true, + Contexts: []string{"continuous-integration"}, + Checks: []*RequiredStatusCheck{ + { + Context: "continuous-integration", + }, + }, }, - }, - }, - RequiredPullRequestReviews: &PullRequestReviewsEnforcement{ - DismissStaleReviews: true, - DismissalRestrictions: &DismissalRestrictions{ - Users: []*User{ - {Login: String("u"), ID: Int64(3)}, + RequiredPullRequestReviews: &PullRequestReviewsEnforcement{ + DismissStaleReviews: true, + DismissalRestrictions: &DismissalRestrictions{ + Users: []*User{ + {Login: String("uu"), ID: Int64(3)}, + }, + Teams: []*Team{ + {Slug: String("tt"), ID: Int64(4)}, + }, + Apps: []*App{ + {Slug: String("aa"), ID: Int64(5)}, + }, + }, + RequireCodeOwnerReviews: true, + BypassPullRequestAllowances: &BypassPullRequestAllowances{ + Users: []*User{ + {Login: String("uuu"), ID: Int64(10)}, + }, + Teams: []*Team{ + {Slug: String("ttt"), ID: Int64(20)}, + }, + Apps: []*App{ + {Slug: String("aaa"), ID: Int64(30)}, + }, + }, }, - Teams: []*Team{ - {Slug: String("t"), ID: Int64(4)}, + Restrictions: &BranchRestrictions{ + Users: []*User{ + {Login: String("u"), ID: Int64(1)}, + }, + Teams: []*Team{ + {Slug: String("t"), ID: Int64(2)}, + }, + Apps: []*App{ + {Slug: String("a"), ID: Int64(3)}, + }, }, - Apps: []*App{ - {Slug: String("a"), ID: Int64(5)}, + BlockCreations: &BlockCreations{ + Enabled: Bool(true), }, - }, - RequireCodeOwnerReviews: true, - RequiredApprovingReviewCount: 1, - RequireLastPushApproval: false, - }, - EnforceAdmins: &AdminEnforcement{ - URL: String("/repos/o/r/branches/b/protection/enforce_admins"), - Enabled: true, - }, - Restrictions: &BranchRestrictions{ - Users: []*User{ - {Login: String("u"), ID: Int64(1)}, - }, - Teams: []*Team{ - {Slug: String("t"), ID: Int64(2)}, - }, - Apps: []*App{ - {Slug: String("a"), ID: Int64(3)}, - }, - }, - RequiredConversationResolution: &RequiredConversationResolution{ - Enabled: true, - }, - BlockCreations: &BlockCreations{ - Enabled: Bool(false), - }, - LockBranch: &LockBranch{ - Enabled: Bool(false), - }, - AllowForkSyncing: &AllowForkSyncing{ - Enabled: Bool(false), - }, - } - if !cmp.Equal(protection, want) { - t.Errorf("Repositories.GetBranchProtection returned %+v, want %+v", protection, want) - } + LockBranch: &LockBranch{ + Enabled: Bool(true), + }, + AllowForkSyncing: &AllowForkSyncing{ + Enabled: Bool(true), + }, + } + if !cmp.Equal(protection, want) { + t.Errorf("Repositories.UpdateBranchProtection returned %+v, want %+v", protection, want) + } - const methodName = "GetBranchProtection" - testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Repositories.GetBranchProtection(ctx, "\n", "\n", "\n") - return err - }) + const methodName = "UpdateBranchProtection" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Repositories.UpdateBranchProtection(ctx, "\n", "\n", "\n", input) + return err + }) - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Repositories.GetBranchProtection(ctx, "o", "r", "b") - if got != nil { - t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) - } - return resp, err - }) + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Repositories.UpdateBranchProtection(ctx, "o", "r", test.branch, input) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) + }) + } } -func TestRepositoriesService_GetBranchProtection_noDismissalRestrictions(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() - - mux.HandleFunc("/repos/o/r/branches/b/protection", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - // TODO: remove custom Accept header when this API fully launches - testHeader(t, r, "Accept", mediaTypeRequiredApprovingReviewsPreview) - fmt.Fprintf(w, `{ - "required_status_checks":{ - "strict":true, - "contexts":["continuous-integration"], - "checks": [ +func TestRepositoriesService_UpdateBranchProtection_Checks(t *testing.T) { + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b/protection"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%/protection"}, + } + + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + input := &ProtectionRequest{ + RequiredStatusChecks: &RequiredStatusChecks{ + Strict: true, + Checks: []*RequiredStatusCheck{ { - "context": "continuous-integration", - "app_id": null - } - ] + Context: "continuous-integration", + }, + }, }, - "required_pull_request_reviews":{ - "dismiss_stale_reviews":true, - "require_code_owner_reviews":true, - "required_approving_review_count":1 + RequiredPullRequestReviews: &PullRequestReviewsEnforcementRequest{ + DismissStaleReviews: true, + DismissalRestrictionsRequest: &DismissalRestrictionsRequest{ + Users: &[]string{"uu"}, + Teams: &[]string{"tt"}, + Apps: &[]string{"aa"}, + }, + BypassPullRequestAllowancesRequest: &BypassPullRequestAllowancesRequest{ + Users: []string{"uuu"}, + Teams: []string{"ttt"}, + Apps: []string{"aaa"}, + }, + }, + Restrictions: &BranchRestrictionsRequest{ + Users: []string{"u"}, + Teams: []string{"t"}, + Apps: []string{"a"}, + }, + } + + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + v := new(ProtectionRequest) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) + + testMethod(t, r, "PUT") + if !cmp.Equal(v, input) { + t.Errorf("Request body = %+v, want %+v", v, input) + } + + // TODO: remove custom Accept header when this API fully launches + testHeader(t, r, "Accept", mediaTypeRequiredApprovingReviewsPreview) + fmt.Fprintf(w, `{ + "required_status_checks":{ + "strict":true, + "contexts":["continuous-integration"], + "checks": [ + { + "context": "continuous-integration", + "app_id": null + } + ] }, - "enforce_admins":{ - "url":"/repos/o/r/branches/b/protection/enforce_admins", - "enabled":true + "required_pull_request_reviews":{ + "dismissal_restrictions":{ + "users":[{ + "id":3, + "login":"uu" + }], + "teams":[{ + "id":4, + "slug":"tt" + }], + "apps":[{ + "id":5, + "slug":"aa" + }] + }, + "dismiss_stale_reviews":true, + "require_code_owner_reviews":true, + "bypass_pull_request_allowances": { + "users":[{"id":10,"login":"uuu"}], + "teams":[{"id":20,"slug":"ttt"}], + "apps":[{"id":30,"slug":"aaa"}] + } }, "restrictions":{ "users":[{"id":1,"login":"u"}], - "teams":[{"id":2,"slug":"t"}] + "teams":[{"id":2,"slug":"t"}], + "apps":[{"id":3,"slug":"a"}] } }`) - }) + }) - ctx := context.Background() - protection, _, err := client.Repositories.GetBranchProtection(ctx, "o", "r", "b") - if err != nil { - t.Errorf("Repositories.GetBranchProtection returned error: %v", err) - } + ctx := context.Background() + protection, _, err := client.Repositories.UpdateBranchProtection(ctx, "o", "r", test.branch, input) + if err != nil { + t.Errorf("Repositories.UpdateBranchProtection returned error: %v", err) + } - want := &Protection{ - RequiredStatusChecks: &RequiredStatusChecks{ - Strict: true, - Contexts: []string{"continuous-integration"}, - Checks: []*RequiredStatusCheck{ - { - Context: "continuous-integration", + want := &Protection{ + RequiredStatusChecks: &RequiredStatusChecks{ + Strict: true, + Contexts: []string{"continuous-integration"}, + Checks: []*RequiredStatusCheck{ + { + Context: "continuous-integration", + }, + }, }, - }, - }, - RequiredPullRequestReviews: &PullRequestReviewsEnforcement{ - DismissStaleReviews: true, - DismissalRestrictions: nil, - RequireCodeOwnerReviews: true, - RequiredApprovingReviewCount: 1, - }, - EnforceAdmins: &AdminEnforcement{ - URL: String("/repos/o/r/branches/b/protection/enforce_admins"), - Enabled: true, - }, - Restrictions: &BranchRestrictions{ - Users: []*User{ - {Login: String("u"), ID: Int64(1)}, - }, - Teams: []*Team{ - {Slug: String("t"), ID: Int64(2)}, - }, - }, - } - if !cmp.Equal(protection, want) { - t.Errorf("Repositories.GetBranchProtection returned %+v, want %+v", protection, want) + RequiredPullRequestReviews: &PullRequestReviewsEnforcement{ + DismissStaleReviews: true, + DismissalRestrictions: &DismissalRestrictions{ + Users: []*User{ + {Login: String("uu"), ID: Int64(3)}, + }, + Teams: []*Team{ + {Slug: String("tt"), ID: Int64(4)}, + }, + Apps: []*App{ + {Slug: String("aa"), ID: Int64(5)}, + }, + }, + RequireCodeOwnerReviews: true, + BypassPullRequestAllowances: &BypassPullRequestAllowances{ + Users: []*User{ + {Login: String("uuu"), ID: Int64(10)}, + }, + Teams: []*Team{ + {Slug: String("ttt"), ID: Int64(20)}, + }, + Apps: []*App{ + {Slug: String("aaa"), ID: Int64(30)}, + }, + }, + }, + Restrictions: &BranchRestrictions{ + Users: []*User{ + {Login: String("u"), ID: Int64(1)}, + }, + Teams: []*Team{ + {Slug: String("t"), ID: Int64(2)}, + }, + Apps: []*App{ + {Slug: String("a"), ID: Int64(3)}, + }, + }, + } + if !cmp.Equal(protection, want) { + t.Errorf("Repositories.UpdateBranchProtection returned %+v, want %+v", protection, want) + } + }) } } -func TestRepositoriesService_GetBranchProtection_branchNotProtected(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() +func TestRepositoriesService_UpdateBranchProtection_StrictNoChecks(t *testing.T) { + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b/protection"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%/protection"}, + } + + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + input := &ProtectionRequest{ + RequiredStatusChecks: &RequiredStatusChecks{ + Strict: true, + Checks: []*RequiredStatusCheck{}, + }, + RequiredPullRequestReviews: &PullRequestReviewsEnforcementRequest{ + DismissStaleReviews: true, + DismissalRestrictionsRequest: &DismissalRestrictionsRequest{ + Users: &[]string{"uu"}, + Teams: &[]string{"tt"}, + Apps: &[]string{"aa"}, + }, + BypassPullRequestAllowancesRequest: &BypassPullRequestAllowancesRequest{ + Users: []string{"uuu"}, + Teams: []string{"ttt"}, + Apps: []string{"aaa"}, + }, + }, + Restrictions: &BranchRestrictionsRequest{ + Users: []string{"u"}, + Teams: []string{"t"}, + Apps: []string{"a"}, + }, + } - mux.HandleFunc("/repos/o/r/branches/b/protection", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + v := new(ProtectionRequest) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) - w.WriteHeader(http.StatusBadRequest) - fmt.Fprintf(w, `{ - "message": %q, - "documentation_url": "https://docs.github.com/rest/repos#get-branch-protection" - }`, githubBranchNotProtected) - }) + testMethod(t, r, "PUT") + if !cmp.Equal(v, input) { + t.Errorf("Request body = %+v, want %+v", v, input) + } - ctx := context.Background() - protection, _, err := client.Repositories.GetBranchProtection(ctx, "o", "r", "b") + // TODO: remove custom Accept header when this API fully launches + testHeader(t, r, "Accept", mediaTypeRequiredApprovingReviewsPreview) + fmt.Fprintf(w, `{ + "required_status_checks":{ + "strict":true, + "contexts":[], + "checks": [] + }, + "required_pull_request_reviews":{ + "dismissal_restrictions":{ + "users":[{ + "id":3, + "login":"uu" + }], + "teams":[{ + "id":4, + "slug":"tt" + }], + "apps":[{ + "id":5, + "slug":"aa" + }] + }, + "dismiss_stale_reviews":true, + "require_code_owner_reviews":true, + "require_last_push_approval":false, + "bypass_pull_request_allowances": { + "users":[{"id":10,"login":"uuu"}], + "teams":[{"id":20,"slug":"ttt"}], + "apps":[{"id":30,"slug":"aaa"}] + } + }, + "restrictions":{ + "users":[{"id":1,"login":"u"}], + "teams":[{"id":2,"slug":"t"}], + "apps":[{"id":3,"slug":"a"}] + } + }`) + }) - if protection != nil { - t.Errorf("Repositories.GetBranchProtection returned non-nil protection data") - } + ctx := context.Background() + protection, _, err := client.Repositories.UpdateBranchProtection(ctx, "o", "r", test.branch, input) + if err != nil { + t.Errorf("Repositories.UpdateBranchProtection returned error: %v", err) + } - if err != ErrBranchNotProtected { - t.Errorf("Repositories.GetBranchProtection returned an invalid error: %v", err) + want := &Protection{ + RequiredStatusChecks: &RequiredStatusChecks{ + Strict: true, + Contexts: []string{}, + Checks: []*RequiredStatusCheck{}, + }, + RequiredPullRequestReviews: &PullRequestReviewsEnforcement{ + DismissStaleReviews: true, + DismissalRestrictions: &DismissalRestrictions{ + Users: []*User{ + {Login: String("uu"), ID: Int64(3)}, + }, + Teams: []*Team{ + {Slug: String("tt"), ID: Int64(4)}, + }, + Apps: []*App{ + {Slug: String("aa"), ID: Int64(5)}, + }, + }, + RequireCodeOwnerReviews: true, + BypassPullRequestAllowances: &BypassPullRequestAllowances{ + Users: []*User{ + {Login: String("uuu"), ID: Int64(10)}, + }, + Teams: []*Team{ + {Slug: String("ttt"), ID: Int64(20)}, + }, + Apps: []*App{ + {Slug: String("aaa"), ID: Int64(30)}, + }, + }, + }, + Restrictions: &BranchRestrictions{ + Users: []*User{ + {Login: String("u"), ID: Int64(1)}, + }, + Teams: []*Team{ + {Slug: String("t"), ID: Int64(2)}, + }, + Apps: []*App{ + {Slug: String("a"), ID: Int64(3)}, + }, + }, + } + if !cmp.Equal(protection, want) { + t.Errorf("Repositories.UpdateBranchProtection returned %+v, want %+v", protection, want) + } + }) } } -func TestRepositoriesService_UpdateBranchProtection_Contexts(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() - - input := &ProtectionRequest{ - RequiredStatusChecks: &RequiredStatusChecks{ - Strict: true, - Contexts: []string{"continuous-integration"}, - }, - RequiredPullRequestReviews: &PullRequestReviewsEnforcementRequest{ - DismissStaleReviews: true, - DismissalRestrictionsRequest: &DismissalRestrictionsRequest{ - Users: &[]string{"uu"}, - Teams: &[]string{"tt"}, - Apps: &[]string{"aa"}, - }, - BypassPullRequestAllowancesRequest: &BypassPullRequestAllowancesRequest{ - Users: []string{"uuu"}, - Teams: []string{"ttt"}, - Apps: []string{"aaa"}, - }, - }, - Restrictions: &BranchRestrictionsRequest{ - Users: []string{"u"}, - Teams: []string{"t"}, - Apps: []string{"a"}, - }, - BlockCreations: Bool(true), - LockBranch: Bool(true), - AllowForkSyncing: Bool(true), - } +func TestRepositoriesService_UpdateBranchProtection_RequireLastPushApproval(t *testing.T) { + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b/protection"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%/protection"}, + } + + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + input := &ProtectionRequest{ + RequiredPullRequestReviews: &PullRequestReviewsEnforcementRequest{ + RequireLastPushApproval: Bool(true), + }, + } - mux.HandleFunc("/repos/o/r/branches/b/protection", func(w http.ResponseWriter, r *http.Request) { - v := new(ProtectionRequest) - assertNilError(t, json.NewDecoder(r.Body).Decode(v)) + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + v := new(ProtectionRequest) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) - testMethod(t, r, "PUT") - if !cmp.Equal(v, input) { - t.Errorf("Request body = %+v, want %+v", v, input) - } + testMethod(t, r, "PUT") + if !cmp.Equal(v, input) { + t.Errorf("Request body = %+v, want %+v", v, input) + } - // TODO: remove custom Accept header when this API fully launches - testHeader(t, r, "Accept", mediaTypeRequiredApprovingReviewsPreview) - fmt.Fprintf(w, `{ - "required_status_checks":{ - "strict":true, - "contexts":["continuous-integration"], - "checks": [ - { - "context": "continuous-integration", - "app_id": null + fmt.Fprintf(w, `{ + "required_pull_request_reviews":{ + "require_last_push_approval":true } - ] - }, - "required_pull_request_reviews":{ - "dismissal_restrictions":{ - "users":[{ - "id":3, - "login":"uu" - }], - "teams":[{ - "id":4, - "slug":"tt" - }], - "apps":[{ - "id":5, - "slug":"aa" - }] + }`) + }) + + ctx := context.Background() + protection, _, err := client.Repositories.UpdateBranchProtection(ctx, "o", "r", test.branch, input) + if err != nil { + t.Errorf("Repositories.UpdateBranchProtection returned error: %v", err) + } + + want := &Protection{ + RequiredPullRequestReviews: &PullRequestReviewsEnforcement{ + RequireLastPushApproval: true, }, - "dismiss_stale_reviews":true, - "require_code_owner_reviews":true, - "bypass_pull_request_allowances": { - "users":[{"id":10,"login":"uuu"}], - "teams":[{"id":20,"slug":"ttt"}], - "apps":[{"id":30,"slug":"aaa"}] - } - }, - "restrictions":{ - "users":[{"id":1,"login":"u"}], - "teams":[{"id":2,"slug":"t"}], - "apps":[{"id":3,"slug":"a"}] - }, - "block_creations": { - "enabled": true - }, - "lock_branch": { - "enabled": true - }, - "allow_fork_syncing": { - "enabled": true } - }`) + if !cmp.Equal(protection, want) { + t.Errorf("Repositories.UpdateBranchProtection returned %+v, want %+v", protection, want) + } + }) + } +} + +func TestRepositoriesService_RemoveBranchProtection(t *testing.T) { + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b/protection"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%/protection"}, + } + + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "DELETE") + w.WriteHeader(http.StatusNoContent) + }) + + ctx := context.Background() + _, err := client.Repositories.RemoveBranchProtection(ctx, "o", "r", test.branch) + if err != nil { + t.Errorf("Repositories.RemoveBranchProtection returned error: %v", err) + } + + const methodName = "RemoveBranchProtection" + testBadOptions(t, methodName, func() (err error) { + _, err = client.Repositories.RemoveBranchProtection(ctx, "\n", "\n", "\n") + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + return client.Repositories.RemoveBranchProtection(ctx, "o", "r", test.branch) + }) + }) + } +} + +func TestRepositoriesService_ListLanguages_invalidOwner(t *testing.T) { + client, _, _, teardown := setup() + defer teardown() + + ctx := context.Background() + _, _, err := client.Repositories.ListLanguages(ctx, "%", "%") + testURLParseError(t, err) +} + +func TestRepositoriesService_License(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/repos/o/r/license", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + fmt.Fprint(w, `{"name": "LICENSE", "path": "LICENSE", "license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","featured":true}}`) }) ctx := context.Background() - protection, _, err := client.Repositories.UpdateBranchProtection(ctx, "o", "r", "b", input) + got, _, err := client.Repositories.License(ctx, "o", "r") if err != nil { - t.Errorf("Repositories.UpdateBranchProtection returned error: %v", err) + t.Errorf("Repositories.License returned error: %v", err) } - want := &Protection{ - RequiredStatusChecks: &RequiredStatusChecks{ - Strict: true, - Contexts: []string{"continuous-integration"}, - Checks: []*RequiredStatusCheck{ - { - Context: "continuous-integration", - }, - }, - }, - RequiredPullRequestReviews: &PullRequestReviewsEnforcement{ - DismissStaleReviews: true, - DismissalRestrictions: &DismissalRestrictions{ - Users: []*User{ - {Login: String("uu"), ID: Int64(3)}, - }, - Teams: []*Team{ - {Slug: String("tt"), ID: Int64(4)}, - }, - Apps: []*App{ - {Slug: String("aa"), ID: Int64(5)}, - }, - }, - RequireCodeOwnerReviews: true, - BypassPullRequestAllowances: &BypassPullRequestAllowances{ - Users: []*User{ - {Login: String("uuu"), ID: Int64(10)}, - }, - Teams: []*Team{ - {Slug: String("ttt"), ID: Int64(20)}, - }, - Apps: []*App{ - {Slug: String("aaa"), ID: Int64(30)}, - }, - }, - }, - Restrictions: &BranchRestrictions{ - Users: []*User{ - {Login: String("u"), ID: Int64(1)}, - }, - Teams: []*Team{ - {Slug: String("t"), ID: Int64(2)}, - }, - Apps: []*App{ - {Slug: String("a"), ID: Int64(3)}, - }, - }, - BlockCreations: &BlockCreations{ - Enabled: Bool(true), - }, - LockBranch: &LockBranch{ - Enabled: Bool(true), - }, - AllowForkSyncing: &AllowForkSyncing{ - Enabled: Bool(true), + want := &RepositoryLicense{ + Name: String("LICENSE"), + Path: String("LICENSE"), + License: &License{ + Name: String("MIT License"), + Key: String("mit"), + SPDXID: String("MIT"), + URL: String("https://api.github.com/licenses/mit"), + Featured: Bool(true), }, } - if !cmp.Equal(protection, want) { - t.Errorf("Repositories.UpdateBranchProtection returned %+v, want %+v", protection, want) + + if !cmp.Equal(got, want) { + t.Errorf("Repositories.License returned %+v, want %+v", got, want) } - const methodName = "UpdateBranchProtection" + const methodName = "License" testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Repositories.UpdateBranchProtection(ctx, "\n", "\n", "\n", input) + _, _, err = client.Repositories.License(ctx, "\n", "\n") return err }) testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Repositories.UpdateBranchProtection(ctx, "o", "r", "b", input) + got, resp, err := client.Repositories.License(ctx, "o", "r") if got != nil { t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) } @@ -1498,1532 +2041,1025 @@ func TestRepositoriesService_UpdateBranchProtection_Contexts(t *testing.T) { }) } -func TestRepositoriesService_UpdateBranchProtection_Checks(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() - - input := &ProtectionRequest{ - RequiredStatusChecks: &RequiredStatusChecks{ - Strict: true, - Checks: []*RequiredStatusCheck{ - { - Context: "continuous-integration", - }, - }, - }, - RequiredPullRequestReviews: &PullRequestReviewsEnforcementRequest{ - DismissStaleReviews: true, - DismissalRestrictionsRequest: &DismissalRestrictionsRequest{ - Users: &[]string{"uu"}, - Teams: &[]string{"tt"}, - Apps: &[]string{"aa"}, - }, - BypassPullRequestAllowancesRequest: &BypassPullRequestAllowancesRequest{ - Users: []string{"uuu"}, - Teams: []string{"ttt"}, - Apps: []string{"aaa"}, - }, - }, - Restrictions: &BranchRestrictionsRequest{ - Users: []string{"u"}, - Teams: []string{"t"}, - Apps: []string{"a"}, - }, - } - - mux.HandleFunc("/repos/o/r/branches/b/protection", func(w http.ResponseWriter, r *http.Request) { - v := new(ProtectionRequest) - assertNilError(t, json.NewDecoder(r.Body).Decode(v)) +func TestRepositoriesService_GetRequiredStatusChecks(t *testing.T) { + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b/protection/required_status_checks"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%/protection/required_status_checks"}, + } + + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + fmt.Fprint(w, `{ + "strict": true, + "contexts": ["x","y","z"], + "checks": [ + { + "context": "x", + "app_id": null + }, + { + "context": "y", + "app_id": null + }, + { + "context": "z", + "app_id": null + } + ] + }`) + }) - testMethod(t, r, "PUT") - if !cmp.Equal(v, input) { - t.Errorf("Request body = %+v, want %+v", v, input) - } + ctx := context.Background() + checks, _, err := client.Repositories.GetRequiredStatusChecks(ctx, "o", "r", test.branch) + if err != nil { + t.Errorf("Repositories.GetRequiredStatusChecks returned error: %v", err) + } - // TODO: remove custom Accept header when this API fully launches - testHeader(t, r, "Accept", mediaTypeRequiredApprovingReviewsPreview) - fmt.Fprintf(w, `{ - "required_status_checks":{ - "strict":true, - "contexts":["continuous-integration"], - "checks": [ + want := &RequiredStatusChecks{ + Strict: true, + Contexts: []string{"x", "y", "z"}, + Checks: []*RequiredStatusCheck{ { - "context": "continuous-integration", - "app_id": null - } - ] - }, - "required_pull_request_reviews":{ - "dismissal_restrictions":{ - "users":[{ - "id":3, - "login":"uu" - }], - "teams":[{ - "id":4, - "slug":"tt" - }], - "apps":[{ - "id":5, - "slug":"aa" - }] + Context: "x", + }, + { + Context: "y", + }, + { + Context: "z", + }, }, - "dismiss_stale_reviews":true, - "require_code_owner_reviews":true, - "bypass_pull_request_allowances": { - "users":[{"id":10,"login":"uuu"}], - "teams":[{"id":20,"slug":"ttt"}], - "apps":[{"id":30,"slug":"aaa"}] - } - }, - "restrictions":{ - "users":[{"id":1,"login":"u"}], - "teams":[{"id":2,"slug":"t"}], - "apps":[{"id":3,"slug":"a"}] } - }`) - }) + if !cmp.Equal(checks, want) { + t.Errorf("Repositories.GetRequiredStatusChecks returned %+v, want %+v", checks, want) + } - ctx := context.Background() - protection, _, err := client.Repositories.UpdateBranchProtection(ctx, "o", "r", "b", input) - if err != nil { - t.Errorf("Repositories.UpdateBranchProtection returned error: %v", err) - } + const methodName = "GetRequiredStatusChecks" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Repositories.GetRequiredStatusChecks(ctx, "\n", "\n", "\n") + return err + }) - want := &Protection{ - RequiredStatusChecks: &RequiredStatusChecks{ - Strict: true, - Contexts: []string{"continuous-integration"}, - Checks: []*RequiredStatusCheck{ - { - Context: "continuous-integration", - }, - }, - }, - RequiredPullRequestReviews: &PullRequestReviewsEnforcement{ - DismissStaleReviews: true, - DismissalRestrictions: &DismissalRestrictions{ - Users: []*User{ - {Login: String("uu"), ID: Int64(3)}, - }, - Teams: []*Team{ - {Slug: String("tt"), ID: Int64(4)}, - }, - Apps: []*App{ - {Slug: String("aa"), ID: Int64(5)}, - }, - }, - RequireCodeOwnerReviews: true, - BypassPullRequestAllowances: &BypassPullRequestAllowances{ - Users: []*User{ - {Login: String("uuu"), ID: Int64(10)}, - }, - Teams: []*Team{ - {Slug: String("ttt"), ID: Int64(20)}, - }, - Apps: []*App{ - {Slug: String("aaa"), ID: Int64(30)}, - }, - }, - }, - Restrictions: &BranchRestrictions{ - Users: []*User{ - {Login: String("u"), ID: Int64(1)}, - }, - Teams: []*Team{ - {Slug: String("t"), ID: Int64(2)}, - }, - Apps: []*App{ - {Slug: String("a"), ID: Int64(3)}, - }, - }, - } - if !cmp.Equal(protection, want) { - t.Errorf("Repositories.UpdateBranchProtection returned %+v, want %+v", protection, want) + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Repositories.GetRequiredStatusChecks(ctx, "o", "r", test.branch) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) + }) } } -func TestRepositoriesService_UpdateBranchProtection_StrictNoChecks(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() - - input := &ProtectionRequest{ - RequiredStatusChecks: &RequiredStatusChecks{ - Strict: true, - Checks: []*RequiredStatusCheck{}, - }, - RequiredPullRequestReviews: &PullRequestReviewsEnforcementRequest{ - DismissStaleReviews: true, - DismissalRestrictionsRequest: &DismissalRestrictionsRequest{ - Users: &[]string{"uu"}, - Teams: &[]string{"tt"}, - Apps: &[]string{"aa"}, - }, - BypassPullRequestAllowancesRequest: &BypassPullRequestAllowancesRequest{ - Users: []string{"uuu"}, - Teams: []string{"ttt"}, - Apps: []string{"aaa"}, - }, - }, - Restrictions: &BranchRestrictionsRequest{ - Users: []string{"u"}, - Teams: []string{"t"}, - Apps: []string{"a"}, - }, +func TestRepositoriesService_GetRequiredStatusChecks_branchNotProtected(t *testing.T) { + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b/protection/required_status_checks"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%/protection/required_status_checks"}, } - mux.HandleFunc("/repos/o/r/branches/b/protection", func(w http.ResponseWriter, r *http.Request) { - v := new(ProtectionRequest) - assertNilError(t, json.NewDecoder(r.Body).Decode(v)) + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() - testMethod(t, r, "PUT") - if !cmp.Equal(v, input) { - t.Errorf("Request body = %+v, want %+v", v, input) - } + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") - // TODO: remove custom Accept header when this API fully launches - testHeader(t, r, "Accept", mediaTypeRequiredApprovingReviewsPreview) - fmt.Fprintf(w, `{ - "required_status_checks":{ - "strict":true, - "contexts":[], - "checks": [] - }, - "required_pull_request_reviews":{ - "dismissal_restrictions":{ - "users":[{ - "id":3, - "login":"uu" - }], - "teams":[{ - "id":4, - "slug":"tt" - }], - "apps":[{ - "id":5, - "slug":"aa" - }] - }, - "dismiss_stale_reviews":true, - "require_code_owner_reviews":true, - "require_last_push_approval":false, - "bypass_pull_request_allowances": { - "users":[{"id":10,"login":"uuu"}], - "teams":[{"id":20,"slug":"ttt"}], - "apps":[{"id":30,"slug":"aaa"}] - } - }, - "restrictions":{ - "users":[{"id":1,"login":"u"}], - "teams":[{"id":2,"slug":"t"}], - "apps":[{"id":3,"slug":"a"}] - } - }`) - }) + w.WriteHeader(http.StatusBadRequest) + fmt.Fprintf(w, `{ + "message": %q, + "documentation_url": "https://docs.github.com/rest/repos#get-branch-protection" + }`, githubBranchNotProtected) + }) - ctx := context.Background() - protection, _, err := client.Repositories.UpdateBranchProtection(ctx, "o", "r", "b", input) - if err != nil { - t.Errorf("Repositories.UpdateBranchProtection returned error: %v", err) - } + ctx := context.Background() + checks, _, err := client.Repositories.GetRequiredStatusChecks(ctx, "o", "r", test.branch) - want := &Protection{ - RequiredStatusChecks: &RequiredStatusChecks{ - Strict: true, - Contexts: []string{}, - Checks: []*RequiredStatusCheck{}, - }, - RequiredPullRequestReviews: &PullRequestReviewsEnforcement{ - DismissStaleReviews: true, - DismissalRestrictions: &DismissalRestrictions{ - Users: []*User{ - {Login: String("uu"), ID: Int64(3)}, - }, - Teams: []*Team{ - {Slug: String("tt"), ID: Int64(4)}, - }, - Apps: []*App{ - {Slug: String("aa"), ID: Int64(5)}, - }, - }, - RequireCodeOwnerReviews: true, - BypassPullRequestAllowances: &BypassPullRequestAllowances{ - Users: []*User{ - {Login: String("uuu"), ID: Int64(10)}, - }, - Teams: []*Team{ - {Slug: String("ttt"), ID: Int64(20)}, - }, - Apps: []*App{ - {Slug: String("aaa"), ID: Int64(30)}, - }, - }, - }, - Restrictions: &BranchRestrictions{ - Users: []*User{ - {Login: String("u"), ID: Int64(1)}, - }, - Teams: []*Team{ - {Slug: String("t"), ID: Int64(2)}, - }, - Apps: []*App{ - {Slug: String("a"), ID: Int64(3)}, - }, - }, - } - if !cmp.Equal(protection, want) { - t.Errorf("Repositories.UpdateBranchProtection returned %+v, want %+v", protection, want) + if checks != nil { + t.Errorf("Repositories.GetRequiredStatusChecks returned non-nil status-checks data") + } + + if err != ErrBranchNotProtected { + t.Errorf("Repositories.GetRequiredStatusChecks returned an invalid error: %v", err) + } + }) } } -func TestRepositoriesService_UpdateBranchProtection_RequireLastPushApproval(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() +func TestRepositoriesService_UpdateRequiredStatusChecks_Contexts(t *testing.T) { + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b/protection/required_status_checks"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%/protection/required_status_checks"}, + } + + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + input := &RequiredStatusChecksRequest{ + Strict: Bool(true), + Contexts: []string{"continuous-integration"}, + } - input := &ProtectionRequest{ - RequiredPullRequestReviews: &PullRequestReviewsEnforcementRequest{ - RequireLastPushApproval: Bool(true), - }, - } + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + v := new(RequiredStatusChecksRequest) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) - mux.HandleFunc("/repos/o/r/branches/b/protection", func(w http.ResponseWriter, r *http.Request) { - v := new(ProtectionRequest) - assertNilError(t, json.NewDecoder(r.Body).Decode(v)) + testMethod(t, r, "PATCH") + if !cmp.Equal(v, input) { + t.Errorf("Request body = %+v, want %+v", v, input) + } + testHeader(t, r, "Accept", mediaTypeV3) + fmt.Fprintf(w, `{ + "strict":true, + "contexts":["continuous-integration"], + "checks": [ + { + "context": "continuous-integration", + "app_id": null + } + ] + }`) + }) - testMethod(t, r, "PUT") - if !cmp.Equal(v, input) { - t.Errorf("Request body = %+v, want %+v", v, input) - } + ctx := context.Background() + statusChecks, _, err := client.Repositories.UpdateRequiredStatusChecks(ctx, "o", "r", test.branch, input) + if err != nil { + t.Errorf("Repositories.UpdateRequiredStatusChecks returned error: %v", err) + } - fmt.Fprintf(w, `{ - "required_pull_request_reviews":{ - "require_last_push_approval":true + want := &RequiredStatusChecks{ + Strict: true, + Contexts: []string{"continuous-integration"}, + Checks: []*RequiredStatusCheck{ + { + Context: "continuous-integration", + }, + }, + } + if !cmp.Equal(statusChecks, want) { + t.Errorf("Repositories.UpdateRequiredStatusChecks returned %+v, want %+v", statusChecks, want) } - }`) - }) - ctx := context.Background() - protection, _, err := client.Repositories.UpdateBranchProtection(ctx, "o", "r", "b", input) - if err != nil { - t.Errorf("Repositories.UpdateBranchProtection returned error: %v", err) - } + const methodName = "UpdateRequiredStatusChecks" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Repositories.UpdateRequiredStatusChecks(ctx, "\n", "\n", "\n", input) + return err + }) - want := &Protection{ - RequiredPullRequestReviews: &PullRequestReviewsEnforcement{ - RequireLastPushApproval: true, - }, - } - if !cmp.Equal(protection, want) { - t.Errorf("Repositories.UpdateBranchProtection returned %+v, want %+v", protection, want) + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Repositories.UpdateRequiredStatusChecks(ctx, "o", "r", test.branch, input) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) + }) } } -func TestRepositoriesService_RemoveBranchProtection(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() - - mux.HandleFunc("/repos/o/r/branches/b/protection", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "DELETE") - w.WriteHeader(http.StatusNoContent) - }) - - ctx := context.Background() - _, err := client.Repositories.RemoveBranchProtection(ctx, "o", "r", "b") - if err != nil { - t.Errorf("Repositories.RemoveBranchProtection returned error: %v", err) - } +func TestRepositoriesService_UpdateRequiredStatusChecks_Checks(t *testing.T) { + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b/protection/required_status_checks"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%/protection/required_status_checks"}, + } + + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + appID := int64(123) + noAppID := int64(-1) + input := &RequiredStatusChecksRequest{ + Strict: Bool(true), + Checks: []*RequiredStatusCheck{ + { + Context: "continuous-integration", + }, + { + Context: "continuous-integration2", + AppID: &appID, + }, + { + Context: "continuous-integration3", + AppID: &noAppID, + }, + }, + } - const methodName = "RemoveBranchProtection" - testBadOptions(t, methodName, func() (err error) { - _, err = client.Repositories.RemoveBranchProtection(ctx, "\n", "\n", "\n") - return err - }) + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + v := new(RequiredStatusChecksRequest) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - return client.Repositories.RemoveBranchProtection(ctx, "o", "r", "b") - }) -} + testMethod(t, r, "PATCH") + if !cmp.Equal(v, input) { + t.Errorf("Request body = %+v, want %+v", v, input) + } + testHeader(t, r, "Accept", mediaTypeV3) + fmt.Fprintf(w, `{ + "strict":true, + "contexts":["continuous-integration"], + "checks": [ + { + "context": "continuous-integration", + "app_id": null + }, + { + "context": "continuous-integration2", + "app_id": 123 + }, + { + "context": "continuous-integration3", + "app_id": null + } + ] + }`) + }) -func TestRepositoriesService_ListLanguages_invalidOwner(t *testing.T) { - client, _, _, teardown := setup() - defer teardown() + ctx := context.Background() + statusChecks, _, err := client.Repositories.UpdateRequiredStatusChecks(ctx, "o", "r", test.branch, input) + if err != nil { + t.Errorf("Repositories.UpdateRequiredStatusChecks returned error: %v", err) + } - ctx := context.Background() - _, _, err := client.Repositories.ListLanguages(ctx, "%", "%") - testURLParseError(t, err) + want := &RequiredStatusChecks{ + Strict: true, + Contexts: []string{"continuous-integration"}, + Checks: []*RequiredStatusCheck{ + { + Context: "continuous-integration", + }, + { + Context: "continuous-integration2", + AppID: &appID, + }, + { + Context: "continuous-integration3", + }, + }, + } + if !cmp.Equal(statusChecks, want) { + t.Errorf("Repositories.UpdateRequiredStatusChecks returned %+v, want %+v", statusChecks, want) + } + }) + } } -func TestRepositoriesService_License(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() - - mux.HandleFunc("/repos/o/r/license", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, `{"name": "LICENSE", "path": "LICENSE", "license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","featured":true}}`) - }) - - ctx := context.Background() - got, _, err := client.Repositories.License(ctx, "o", "r") - if err != nil { - t.Errorf("Repositories.License returned error: %v", err) - } +func TestRepositoriesService_RemoveRequiredStatusChecks(t *testing.T) { + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b/protection/required_status_checks"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%/protection/required_status_checks"}, + } + + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "DELETE") + testHeader(t, r, "Accept", mediaTypeV3) + w.WriteHeader(http.StatusNoContent) + }) + + ctx := context.Background() + _, err := client.Repositories.RemoveRequiredStatusChecks(ctx, "o", "r", test.branch) + if err != nil { + t.Errorf("Repositories.RemoveRequiredStatusChecks returned error: %v", err) + } - want := &RepositoryLicense{ - Name: String("LICENSE"), - Path: String("LICENSE"), - License: &License{ - Name: String("MIT License"), - Key: String("mit"), - SPDXID: String("MIT"), - URL: String("https://api.github.com/licenses/mit"), - Featured: Bool(true), - }, - } + const methodName = "RemoveRequiredStatusChecks" + testBadOptions(t, methodName, func() (err error) { + _, err = client.Repositories.RemoveRequiredStatusChecks(ctx, "\n", "\n", "\n") + return err + }) - if !cmp.Equal(got, want) { - t.Errorf("Repositories.License returned %+v, want %+v", got, want) + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + return client.Repositories.RemoveRequiredStatusChecks(ctx, "o", "r", test.branch) + }) + }) } +} - const methodName = "License" - testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Repositories.License(ctx, "\n", "\n") - return err - }) +func TestRepositoriesService_ListRequiredStatusChecksContexts(t *testing.T) { + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b/protection/required_status_checks/contexts"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%/protection/required_status_checks/contexts"}, + } + + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + fmt.Fprint(w, `["x", "y", "z"]`) + }) + + ctx := context.Background() + contexts, _, err := client.Repositories.ListRequiredStatusChecksContexts(ctx, "o", "r", test.branch) + if err != nil { + t.Errorf("Repositories.ListRequiredStatusChecksContexts returned error: %v", err) + } - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Repositories.License(ctx, "o", "r") - if got != nil { - t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) - } - return resp, err - }) -} + want := []string{"x", "y", "z"} + if !cmp.Equal(contexts, want) { + t.Errorf("Repositories.ListRequiredStatusChecksContexts returned %+v, want %+v", contexts, want) + } -func TestRepositoriesService_GetRequiredStatusChecks(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() + const methodName = "ListRequiredStatusChecksContexts" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Repositories.ListRequiredStatusChecksContexts(ctx, "\n", "\n", "\n") + return err + }) - mux.HandleFunc("/repos/o/r/branches/b/protection/required_status_checks", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, `{ - "strict": true, - "contexts": ["x","y","z"], - "checks": [ - { - "context": "x", - "app_id": null - }, - { - "context": "y", - "app_id": null - }, - { - "context": "z", - "app_id": null + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Repositories.ListRequiredStatusChecksContexts(ctx, "o", "r", test.branch) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) } - ] - }`) - }) - - ctx := context.Background() - checks, _, err := client.Repositories.GetRequiredStatusChecks(ctx, "o", "r", "b") - if err != nil { - t.Errorf("Repositories.GetRequiredStatusChecks returned error: %v", err) + return resp, err + }) + }) } +} - want := &RequiredStatusChecks{ - Strict: true, - Contexts: []string{"x", "y", "z"}, - Checks: []*RequiredStatusCheck{ - { - Context: "x", - }, - { - Context: "y", - }, - { - Context: "z", - }, - }, - } - if !cmp.Equal(checks, want) { - t.Errorf("Repositories.GetRequiredStatusChecks returned %+v, want %+v", checks, want) +func TestRepositoriesService_ListRequiredStatusChecksContexts_branchNotProtected(t *testing.T) { + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b/protection/required_status_checks/contexts"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%/protection/required_status_checks/contexts"}, } - const methodName = "GetRequiredStatusChecks" - testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Repositories.GetRequiredStatusChecks(ctx, "\n", "\n", "\n") - return err - }) - - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Repositories.GetRequiredStatusChecks(ctx, "o", "r", "b") - if got != nil { - t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) - } - return resp, err - }) -} - -func TestRepositoriesService_GetRequiredStatusChecks_branchNotProtected(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() - mux.HandleFunc("/repos/o/r/branches/b/protection/required_status_checks", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") - w.WriteHeader(http.StatusBadRequest) - fmt.Fprintf(w, `{ + w.WriteHeader(http.StatusBadRequest) + fmt.Fprintf(w, `{ "message": %q, "documentation_url": "https://docs.github.com/rest/repos#get-branch-protection" }`, githubBranchNotProtected) - }) + }) - ctx := context.Background() - checks, _, err := client.Repositories.GetRequiredStatusChecks(ctx, "o", "r", "b") + ctx := context.Background() + contexts, _, err := client.Repositories.ListRequiredStatusChecksContexts(ctx, "o", "r", test.branch) - if checks != nil { - t.Errorf("Repositories.GetRequiredStatusChecks returned non-nil status-checks data") - } + if contexts != nil { + t.Errorf("Repositories.ListRequiredStatusChecksContexts returned non-nil contexts data") + } - if err != ErrBranchNotProtected { - t.Errorf("Repositories.GetRequiredStatusChecks returned an invalid error: %v", err) + if err != ErrBranchNotProtected { + t.Errorf("Repositories.ListRequiredStatusChecksContexts returned an invalid error: %v", err) + } + }) } } -func TestRepositoriesService_UpdateRequiredStatusChecks_Contexts(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() +func TestRepositoriesService_GetPullRequestReviewEnforcement(t *testing.T) { + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b/protection/required_pull_request_reviews"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%/protection/required_pull_request_reviews"}, + } + + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + // TODO: remove custom Accept header when this API fully launches + testHeader(t, r, "Accept", mediaTypeRequiredApprovingReviewsPreview) + fmt.Fprintf(w, `{ + "dismissal_restrictions":{ + "users":[{"id":1,"login":"u"}], + "teams":[{"id":2,"slug":"t"}], + "apps":[{"id":3,"slug":"a"}] + }, + "dismiss_stale_reviews":true, + "require_code_owner_reviews":true, + "required_approving_review_count":1 + }`) + }) - input := &RequiredStatusChecksRequest{ - Strict: Bool(true), - Contexts: []string{"continuous-integration"}, - } + ctx := context.Background() + enforcement, _, err := client.Repositories.GetPullRequestReviewEnforcement(ctx, "o", "r", test.branch) + if err != nil { + t.Errorf("Repositories.GetPullRequestReviewEnforcement returned error: %v", err) + } - mux.HandleFunc("/repos/o/r/branches/b/protection/required_status_checks", func(w http.ResponseWriter, r *http.Request) { - v := new(RequiredStatusChecksRequest) - assertNilError(t, json.NewDecoder(r.Body).Decode(v)) + want := &PullRequestReviewsEnforcement{ + DismissStaleReviews: true, + DismissalRestrictions: &DismissalRestrictions{ + Users: []*User{ + {Login: String("u"), ID: Int64(1)}, + }, + Teams: []*Team{ + {Slug: String("t"), ID: Int64(2)}, + }, + Apps: []*App{ + {Slug: String("a"), ID: Int64(3)}, + }, + }, + RequireCodeOwnerReviews: true, + RequiredApprovingReviewCount: 1, + } - testMethod(t, r, "PATCH") - if !cmp.Equal(v, input) { - t.Errorf("Request body = %+v, want %+v", v, input) - } - testHeader(t, r, "Accept", mediaTypeV3) - fmt.Fprintf(w, `{ - "strict":true, - "contexts":["continuous-integration"], - "checks": [ - { - "context": "continuous-integration", - "app_id": null - } - ] - }`) - }) + if !cmp.Equal(enforcement, want) { + t.Errorf("Repositories.GetPullRequestReviewEnforcement returned %+v, want %+v", enforcement, want) + } - ctx := context.Background() - statusChecks, _, err := client.Repositories.UpdateRequiredStatusChecks(ctx, "o", "r", "b", input) - if err != nil { - t.Errorf("Repositories.UpdateRequiredStatusChecks returned error: %v", err) - } + const methodName = "GetPullRequestReviewEnforcement" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Repositories.GetPullRequestReviewEnforcement(ctx, "\n", "\n", "\n") + return err + }) - want := &RequiredStatusChecks{ - Strict: true, - Contexts: []string{"continuous-integration"}, - Checks: []*RequiredStatusCheck{ - { - Context: "continuous-integration", - }, - }, - } - if !cmp.Equal(statusChecks, want) { - t.Errorf("Repositories.UpdateRequiredStatusChecks returned %+v, want %+v", statusChecks, want) + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Repositories.GetPullRequestReviewEnforcement(ctx, "o", "r", test.branch) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) + }) } +} - const methodName = "UpdateRequiredStatusChecks" - testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Repositories.UpdateRequiredStatusChecks(ctx, "\n", "\n", "\n", input) - return err - }) +func TestRepositoriesService_UpdatePullRequestReviewEnforcement(t *testing.T) { + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b/protection/required_pull_request_reviews"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%/protection/required_pull_request_reviews"}, + } + + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + input := &PullRequestReviewsEnforcementUpdate{ + DismissalRestrictionsRequest: &DismissalRestrictionsRequest{ + Users: &[]string{"u"}, + Teams: &[]string{"t"}, + Apps: &[]string{"a"}, + }, + } - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Repositories.UpdateRequiredStatusChecks(ctx, "o", "r", "b", input) - if got != nil { - t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) - } - return resp, err - }) -} + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + v := new(PullRequestReviewsEnforcementUpdate) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) -func TestRepositoriesService_UpdateRequiredStatusChecks_Checks(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() - - appID := int64(123) - noAppID := int64(-1) - input := &RequiredStatusChecksRequest{ - Strict: Bool(true), - Checks: []*RequiredStatusCheck{ - { - Context: "continuous-integration", - }, - { - Context: "continuous-integration2", - AppID: &appID, - }, - { - Context: "continuous-integration3", - AppID: &noAppID, - }, - }, - } - - mux.HandleFunc("/repos/o/r/branches/b/protection/required_status_checks", func(w http.ResponseWriter, r *http.Request) { - v := new(RequiredStatusChecksRequest) - assertNilError(t, json.NewDecoder(r.Body).Decode(v)) - - testMethod(t, r, "PATCH") - if !cmp.Equal(v, input) { - t.Errorf("Request body = %+v, want %+v", v, input) - } - testHeader(t, r, "Accept", mediaTypeV3) - fmt.Fprintf(w, `{ - "strict":true, - "contexts":["continuous-integration"], - "checks": [ - { - "context": "continuous-integration", - "app_id": null - }, - { - "context": "continuous-integration2", - "app_id": 123 - }, - { - "context": "continuous-integration3", - "app_id": null + testMethod(t, r, "PATCH") + if !cmp.Equal(v, input) { + t.Errorf("Request body = %+v, want %+v", v, input) } - ] - }`) - }) - - ctx := context.Background() - statusChecks, _, err := client.Repositories.UpdateRequiredStatusChecks(ctx, "o", "r", "b", input) - if err != nil { - t.Errorf("Repositories.UpdateRequiredStatusChecks returned error: %v", err) - } - - want := &RequiredStatusChecks{ - Strict: true, - Contexts: []string{"continuous-integration"}, - Checks: []*RequiredStatusCheck{ - { - Context: "continuous-integration", - }, - { - Context: "continuous-integration2", - AppID: &appID, - }, - { - Context: "continuous-integration3", - }, - }, - } - if !cmp.Equal(statusChecks, want) { - t.Errorf("Repositories.UpdateRequiredStatusChecks returned %+v, want %+v", statusChecks, want) - } -} - -func TestRepositoriesService_RemoveRequiredStatusChecks(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() - - mux.HandleFunc("/repos/o/r/branches/b/protection/required_status_checks", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "DELETE") - testHeader(t, r, "Accept", mediaTypeV3) - w.WriteHeader(http.StatusNoContent) - }) - - ctx := context.Background() - _, err := client.Repositories.RemoveRequiredStatusChecks(ctx, "o", "r", "b") - if err != nil { - t.Errorf("Repositories.RemoveRequiredStatusChecks returned error: %v", err) - } - - const methodName = "RemoveRequiredStatusChecks" - testBadOptions(t, methodName, func() (err error) { - _, err = client.Repositories.RemoveRequiredStatusChecks(ctx, "\n", "\n", "\n") - return err - }) - - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - return client.Repositories.RemoveRequiredStatusChecks(ctx, "o", "r", "b") - }) -} - -func TestRepositoriesService_ListRequiredStatusChecksContexts(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() - - mux.HandleFunc("/repos/o/r/branches/b/protection/required_status_checks/contexts", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, `["x", "y", "z"]`) - }) - - ctx := context.Background() - contexts, _, err := client.Repositories.ListRequiredStatusChecksContexts(ctx, "o", "r", "b") - if err != nil { - t.Errorf("Repositories.ListRequiredStatusChecksContexts returned error: %v", err) - } - - want := []string{"x", "y", "z"} - if !cmp.Equal(contexts, want) { - t.Errorf("Repositories.ListRequiredStatusChecksContexts returned %+v, want %+v", contexts, want) - } - - const methodName = "ListRequiredStatusChecksContexts" - testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Repositories.ListRequiredStatusChecksContexts(ctx, "\n", "\n", "\n") - return err - }) - - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Repositories.ListRequiredStatusChecksContexts(ctx, "o", "r", "b") - if got != nil { - t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) - } - return resp, err - }) -} - -func TestRepositoriesService_ListRequiredStatusChecksContexts_branchNotProtected(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() - - mux.HandleFunc("/repos/o/r/branches/b/protection/required_status_checks/contexts", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - - w.WriteHeader(http.StatusBadRequest) - fmt.Fprintf(w, `{ - "message": %q, - "documentation_url": "https://docs.github.com/rest/repos#get-branch-protection" - }`, githubBranchNotProtected) - }) - - ctx := context.Background() - contexts, _, err := client.Repositories.ListRequiredStatusChecksContexts(ctx, "o", "r", "b") - - if contexts != nil { - t.Errorf("Repositories.ListRequiredStatusChecksContexts returned non-nil contexts data") - } - - if err != ErrBranchNotProtected { - t.Errorf("Repositories.ListRequiredStatusChecksContexts returned an invalid error: %v", err) - } -} - -func TestRepositoriesService_GetPullRequestReviewEnforcement(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() - - mux.HandleFunc("/repos/o/r/branches/b/protection/required_pull_request_reviews", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - // TODO: remove custom Accept header when this API fully launches - testHeader(t, r, "Accept", mediaTypeRequiredApprovingReviewsPreview) - fmt.Fprintf(w, `{ - "dismissal_restrictions":{ - "users":[{"id":1,"login":"u"}], - "teams":[{"id":2,"slug":"t"}], - "apps":[{"id":3,"slug":"a"}] - }, - "dismiss_stale_reviews":true, - "require_code_owner_reviews":true, - "required_approving_review_count":1 - }`) - }) - - ctx := context.Background() - enforcement, _, err := client.Repositories.GetPullRequestReviewEnforcement(ctx, "o", "r", "b") - if err != nil { - t.Errorf("Repositories.GetPullRequestReviewEnforcement returned error: %v", err) - } - - want := &PullRequestReviewsEnforcement{ - DismissStaleReviews: true, - DismissalRestrictions: &DismissalRestrictions{ - Users: []*User{ - {Login: String("u"), ID: Int64(1)}, - }, - Teams: []*Team{ - {Slug: String("t"), ID: Int64(2)}, - }, - Apps: []*App{ - {Slug: String("a"), ID: Int64(3)}, - }, - }, - RequireCodeOwnerReviews: true, - RequiredApprovingReviewCount: 1, - } - - if !cmp.Equal(enforcement, want) { - t.Errorf("Repositories.GetPullRequestReviewEnforcement returned %+v, want %+v", enforcement, want) - } - - const methodName = "GetPullRequestReviewEnforcement" - testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Repositories.GetPullRequestReviewEnforcement(ctx, "\n", "\n", "\n") - return err - }) - - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Repositories.GetPullRequestReviewEnforcement(ctx, "o", "r", "b") - if got != nil { - t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) - } - return resp, err - }) -} - -func TestRepositoriesService_UpdatePullRequestReviewEnforcement(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() - - input := &PullRequestReviewsEnforcementUpdate{ - DismissalRestrictionsRequest: &DismissalRestrictionsRequest{ - Users: &[]string{"u"}, - Teams: &[]string{"t"}, - Apps: &[]string{"a"}, - }, - } - - mux.HandleFunc("/repos/o/r/branches/b/protection/required_pull_request_reviews", func(w http.ResponseWriter, r *http.Request) { - v := new(PullRequestReviewsEnforcementUpdate) - assertNilError(t, json.NewDecoder(r.Body).Decode(v)) - - testMethod(t, r, "PATCH") - if !cmp.Equal(v, input) { - t.Errorf("Request body = %+v, want %+v", v, input) - } - // TODO: remove custom Accept header when this API fully launches - testHeader(t, r, "Accept", mediaTypeRequiredApprovingReviewsPreview) - fmt.Fprintf(w, `{ - "dismissal_restrictions":{ - "users":[{"id":1,"login":"u"}], - "teams":[{"id":2,"slug":"t"}], - "apps":[{"id":3,"slug":"a"}] - }, - "dismiss_stale_reviews":true, - "require_code_owner_reviews":true, - "required_approving_review_count":3 - }`) - }) - - ctx := context.Background() - enforcement, _, err := client.Repositories.UpdatePullRequestReviewEnforcement(ctx, "o", "r", "b", input) - if err != nil { - t.Errorf("Repositories.UpdatePullRequestReviewEnforcement returned error: %v", err) - } - - want := &PullRequestReviewsEnforcement{ - DismissStaleReviews: true, - DismissalRestrictions: &DismissalRestrictions{ - Users: []*User{ - {Login: String("u"), ID: Int64(1)}, - }, - Teams: []*Team{ - {Slug: String("t"), ID: Int64(2)}, - }, - Apps: []*App{ - {Slug: String("a"), ID: Int64(3)}, - }, - }, - RequireCodeOwnerReviews: true, - RequiredApprovingReviewCount: 3, - } - if !cmp.Equal(enforcement, want) { - t.Errorf("Repositories.UpdatePullRequestReviewEnforcement returned %+v, want %+v", enforcement, want) - } - - const methodName = "UpdatePullRequestReviewEnforcement" - testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Repositories.UpdatePullRequestReviewEnforcement(ctx, "\n", "\n", "\n", input) - return err - }) - - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Repositories.UpdatePullRequestReviewEnforcement(ctx, "o", "r", "b", input) - if got != nil { - t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) - } - return resp, err - }) -} - -func TestRepositoriesService_DisableDismissalRestrictions(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() - - mux.HandleFunc("/repos/o/r/branches/b/protection/required_pull_request_reviews", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "PATCH") - // TODO: remove custom Accept header when this API fully launches - testHeader(t, r, "Accept", mediaTypeRequiredApprovingReviewsPreview) - testBody(t, r, `{"dismissal_restrictions":{}}`+"\n") - fmt.Fprintf(w, `{"dismiss_stale_reviews":true,"require_code_owner_reviews":true,"required_approving_review_count":1}`) - }) - - ctx := context.Background() - enforcement, _, err := client.Repositories.DisableDismissalRestrictions(ctx, "o", "r", "b") - if err != nil { - t.Errorf("Repositories.DisableDismissalRestrictions returned error: %v", err) - } - - want := &PullRequestReviewsEnforcement{ - DismissStaleReviews: true, - DismissalRestrictions: nil, - RequireCodeOwnerReviews: true, - RequiredApprovingReviewCount: 1, - } - if !cmp.Equal(enforcement, want) { - t.Errorf("Repositories.DisableDismissalRestrictions returned %+v, want %+v", enforcement, want) - } - - const methodName = "DisableDismissalRestrictions" - testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Repositories.DisableDismissalRestrictions(ctx, "\n", "\n", "\n") - return err - }) - - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Repositories.DisableDismissalRestrictions(ctx, "o", "r", "b") - if got != nil { - t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) - } - return resp, err - }) -} - -func TestRepositoriesService_RemovePullRequestReviewEnforcement(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() - - mux.HandleFunc("/repos/o/r/branches/b/protection/required_pull_request_reviews", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "DELETE") - w.WriteHeader(http.StatusNoContent) - }) - - ctx := context.Background() - _, err := client.Repositories.RemovePullRequestReviewEnforcement(ctx, "o", "r", "b") - if err != nil { - t.Errorf("Repositories.RemovePullRequestReviewEnforcement returned error: %v", err) - } - - const methodName = "RemovePullRequestReviewEnforcement" - testBadOptions(t, methodName, func() (err error) { - _, err = client.Repositories.RemovePullRequestReviewEnforcement(ctx, "\n", "\n", "\n") - return err - }) - - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - return client.Repositories.RemovePullRequestReviewEnforcement(ctx, "o", "r", "b") - }) -} - -func TestRepositoriesService_GetAdminEnforcement(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() - - mux.HandleFunc("/repos/o/r/branches/b/protection/enforce_admins", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprintf(w, `{"url":"/repos/o/r/branches/b/protection/enforce_admins","enabled":true}`) - }) - - ctx := context.Background() - enforcement, _, err := client.Repositories.GetAdminEnforcement(ctx, "o", "r", "b") - if err != nil { - t.Errorf("Repositories.GetAdminEnforcement returned error: %v", err) - } - - want := &AdminEnforcement{ - URL: String("/repos/o/r/branches/b/protection/enforce_admins"), - Enabled: true, - } - - if !cmp.Equal(enforcement, want) { - t.Errorf("Repositories.GetAdminEnforcement returned %+v, want %+v", enforcement, want) - } - - const methodName = "GetAdminEnforcement" - testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Repositories.GetAdminEnforcement(ctx, "\n", "\n", "\n") - return err - }) - - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Repositories.GetAdminEnforcement(ctx, "o", "r", "b") - if got != nil { - t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) - } - return resp, err - }) -} - -func TestRepositoriesService_AddAdminEnforcement(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() - - mux.HandleFunc("/repos/o/r/branches/b/protection/enforce_admins", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "POST") - fmt.Fprintf(w, `{"url":"/repos/o/r/branches/b/protection/enforce_admins","enabled":true}`) - }) - - ctx := context.Background() - enforcement, _, err := client.Repositories.AddAdminEnforcement(ctx, "o", "r", "b") - if err != nil { - t.Errorf("Repositories.AddAdminEnforcement returned error: %v", err) - } - - want := &AdminEnforcement{ - URL: String("/repos/o/r/branches/b/protection/enforce_admins"), - Enabled: true, - } - if !cmp.Equal(enforcement, want) { - t.Errorf("Repositories.AddAdminEnforcement returned %+v, want %+v", enforcement, want) - } - - const methodName = "AddAdminEnforcement" - testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Repositories.AddAdminEnforcement(ctx, "\n", "\n", "\n") - return err - }) - - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Repositories.AddAdminEnforcement(ctx, "o", "r", "b") - if got != nil { - t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) - } - return resp, err - }) -} - -func TestRepositoriesService_RemoveAdminEnforcement(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() - - mux.HandleFunc("/repos/o/r/branches/b/protection/enforce_admins", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "DELETE") - w.WriteHeader(http.StatusNoContent) - }) - - ctx := context.Background() - _, err := client.Repositories.RemoveAdminEnforcement(ctx, "o", "r", "b") - if err != nil { - t.Errorf("Repositories.RemoveAdminEnforcement returned error: %v", err) - } - - const methodName = "RemoveAdminEnforcement" - testBadOptions(t, methodName, func() (err error) { - _, err = client.Repositories.RemoveAdminEnforcement(ctx, "\n", "\n", "\n") - return err - }) - - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - return client.Repositories.RemoveAdminEnforcement(ctx, "o", "r", "b") - }) -} - -func TestRepositoriesService_GetSignaturesProtectedBranch(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() - - mux.HandleFunc("/repos/o/r/branches/b/protection/required_signatures", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeSignaturePreview) - fmt.Fprintf(w, `{"url":"/repos/o/r/branches/b/protection/required_signatures","enabled":false}`) - }) - - ctx := context.Background() - signature, _, err := client.Repositories.GetSignaturesProtectedBranch(ctx, "o", "r", "b") - if err != nil { - t.Errorf("Repositories.GetSignaturesProtectedBranch returned error: %v", err) - } - - want := &SignaturesProtectedBranch{ - URL: String("/repos/o/r/branches/b/protection/required_signatures"), - Enabled: Bool(false), - } - - if !cmp.Equal(signature, want) { - t.Errorf("Repositories.GetSignaturesProtectedBranch returned %+v, want %+v", signature, want) - } - - const methodName = "GetSignaturesProtectedBranch" - testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Repositories.GetSignaturesProtectedBranch(ctx, "\n", "\n", "\n") - return err - }) - - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Repositories.GetSignaturesProtectedBranch(ctx, "o", "r", "b") - if got != nil { - t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) - } - return resp, err - }) -} - -func TestRepositoriesService_RequireSignaturesOnProtectedBranch(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() - - mux.HandleFunc("/repos/o/r/branches/b/protection/required_signatures", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "POST") - testHeader(t, r, "Accept", mediaTypeSignaturePreview) - fmt.Fprintf(w, `{"url":"/repos/o/r/branches/b/protection/required_signatures","enabled":true}`) - }) - - ctx := context.Background() - signature, _, err := client.Repositories.RequireSignaturesOnProtectedBranch(ctx, "o", "r", "b") - if err != nil { - t.Errorf("Repositories.RequireSignaturesOnProtectedBranch returned error: %v", err) - } - - want := &SignaturesProtectedBranch{ - URL: String("/repos/o/r/branches/b/protection/required_signatures"), - Enabled: Bool(true), - } - - if !cmp.Equal(signature, want) { - t.Errorf("Repositories.RequireSignaturesOnProtectedBranch returned %+v, want %+v", signature, want) - } - - const methodName = "RequireSignaturesOnProtectedBranch" - testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Repositories.RequireSignaturesOnProtectedBranch(ctx, "\n", "\n", "\n") - return err - }) - - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Repositories.RequireSignaturesOnProtectedBranch(ctx, "o", "r", "b") - if got != nil { - t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) - } - return resp, err - }) -} - -func TestRepositoriesService_OptionalSignaturesOnProtectedBranch(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() - - mux.HandleFunc("/repos/o/r/branches/b/protection/required_signatures", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "DELETE") - testHeader(t, r, "Accept", mediaTypeSignaturePreview) - w.WriteHeader(http.StatusNoContent) - }) - - ctx := context.Background() - _, err := client.Repositories.OptionalSignaturesOnProtectedBranch(ctx, "o", "r", "b") - if err != nil { - t.Errorf("Repositories.OptionalSignaturesOnProtectedBranch returned error: %v", err) - } - - const methodName = "OptionalSignaturesOnProtectedBranch" - testBadOptions(t, methodName, func() (err error) { - _, err = client.Repositories.OptionalSignaturesOnProtectedBranch(ctx, "\n", "\n", "\n") - return err - }) - - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - return client.Repositories.OptionalSignaturesOnProtectedBranch(ctx, "o", "r", "b") - }) -} - -func TestPullRequestReviewsEnforcementRequest_MarshalJSON_nilDismissalRestirctions(t *testing.T) { - req := PullRequestReviewsEnforcementRequest{} - - got, err := json.Marshal(req) - if err != nil { - t.Errorf("PullRequestReviewsEnforcementRequest.MarshalJSON returned error: %v", err) - } - - want := `{"dismiss_stale_reviews":false,"require_code_owner_reviews":false,"required_approving_review_count":0}` - if want != string(got) { - t.Errorf("PullRequestReviewsEnforcementRequest.MarshalJSON returned %+v, want %+v", string(got), want) - } - - req = PullRequestReviewsEnforcementRequest{ - DismissalRestrictionsRequest: &DismissalRestrictionsRequest{}, - } - - got, err = json.Marshal(req) - if err != nil { - t.Errorf("PullRequestReviewsEnforcementRequest.MarshalJSON returned error: %v", err) - } - - want = `{"dismissal_restrictions":{},"dismiss_stale_reviews":false,"require_code_owner_reviews":false,"required_approving_review_count":0}` - if want != string(got) { - t.Errorf("PullRequestReviewsEnforcementRequest.MarshalJSON returned %+v, want %+v", string(got), want) - } - - req = PullRequestReviewsEnforcementRequest{ - DismissalRestrictionsRequest: &DismissalRestrictionsRequest{ - Users: &[]string{}, - Teams: &[]string{}, - Apps: &[]string{}, - }, - RequireLastPushApproval: Bool(true), - } - - got, err = json.Marshal(req) - if err != nil { - t.Errorf("PullRequestReviewsEnforcementRequest.MarshalJSON returned error: %v", err) - } - - want = `{"dismissal_restrictions":{"users":[],"teams":[],"apps":[]},"dismiss_stale_reviews":false,"require_code_owner_reviews":false,"required_approving_review_count":0,"require_last_push_approval":true}` - if want != string(got) { - t.Errorf("PullRequestReviewsEnforcementRequest.MarshalJSON returned %+v, want %+v", string(got), want) - } -} - -func TestRepositoriesService_ListAllTopics(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() - - mux.HandleFunc("/repos/o/r/topics", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeTopicsPreview) - fmt.Fprint(w, `{"names":["go", "go-github", "github"]}`) - }) - - ctx := context.Background() - got, _, err := client.Repositories.ListAllTopics(ctx, "o", "r") - if err != nil { - t.Fatalf("Repositories.ListAllTopics returned error: %v", err) - } - - want := []string{"go", "go-github", "github"} - if !cmp.Equal(got, want) { - t.Errorf("Repositories.ListAllTopics returned %+v, want %+v", got, want) - } - - const methodName = "ListAllTopics" - testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Repositories.ListAllTopics(ctx, "\n", "\n") - return err - }) - - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Repositories.ListAllTopics(ctx, "o", "r") - if got != nil { - t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) - } - return resp, err - }) -} + // TODO: remove custom Accept header when this API fully launches + testHeader(t, r, "Accept", mediaTypeRequiredApprovingReviewsPreview) + fmt.Fprintf(w, `{ + "dismissal_restrictions":{ + "users":[{"id":1,"login":"u"}], + "teams":[{"id":2,"slug":"t"}], + "apps":[{"id":3,"slug":"a"}] + }, + "dismiss_stale_reviews":true, + "require_code_owner_reviews":true, + "required_approving_review_count":3 + }`) + }) -func TestRepositoriesService_ListAllTopics_emptyTopics(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() + ctx := context.Background() + enforcement, _, err := client.Repositories.UpdatePullRequestReviewEnforcement(ctx, "o", "r", test.branch, input) + if err != nil { + t.Errorf("Repositories.UpdatePullRequestReviewEnforcement returned error: %v", err) + } - mux.HandleFunc("/repos/o/r/topics", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeTopicsPreview) - fmt.Fprint(w, `{"names":[]}`) - }) + want := &PullRequestReviewsEnforcement{ + DismissStaleReviews: true, + DismissalRestrictions: &DismissalRestrictions{ + Users: []*User{ + {Login: String("u"), ID: Int64(1)}, + }, + Teams: []*Team{ + {Slug: String("t"), ID: Int64(2)}, + }, + Apps: []*App{ + {Slug: String("a"), ID: Int64(3)}, + }, + }, + RequireCodeOwnerReviews: true, + RequiredApprovingReviewCount: 3, + } + if !cmp.Equal(enforcement, want) { + t.Errorf("Repositories.UpdatePullRequestReviewEnforcement returned %+v, want %+v", enforcement, want) + } - ctx := context.Background() - got, _, err := client.Repositories.ListAllTopics(ctx, "o", "r") - if err != nil { - t.Fatalf("Repositories.ListAllTopics returned error: %v", err) - } + const methodName = "UpdatePullRequestReviewEnforcement" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Repositories.UpdatePullRequestReviewEnforcement(ctx, "\n", "\n", "\n", input) + return err + }) - want := []string{} - if !cmp.Equal(got, want) { - t.Errorf("Repositories.ListAllTopics returned %+v, want %+v", got, want) + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Repositories.UpdatePullRequestReviewEnforcement(ctx, "o", "r", test.branch, input) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) + }) } } -func TestRepositoriesService_ReplaceAllTopics(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() +func TestRepositoriesService_DisableDismissalRestrictions(t *testing.T) { + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b/protection/required_pull_request_reviews"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%/protection/required_pull_request_reviews"}, + } + + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "PATCH") + // TODO: remove custom Accept header when this API fully launches + testHeader(t, r, "Accept", mediaTypeRequiredApprovingReviewsPreview) + testBody(t, r, `{"dismissal_restrictions":{}}`+"\n") + fmt.Fprintf(w, `{"dismiss_stale_reviews":true,"require_code_owner_reviews":true,"required_approving_review_count":1}`) + }) + + ctx := context.Background() + enforcement, _, err := client.Repositories.DisableDismissalRestrictions(ctx, "o", "r", test.branch) + if err != nil { + t.Errorf("Repositories.DisableDismissalRestrictions returned error: %v", err) + } - mux.HandleFunc("/repos/o/r/topics", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "PUT") - testHeader(t, r, "Accept", mediaTypeTopicsPreview) - fmt.Fprint(w, `{"names":["go", "go-github", "github"]}`) - }) + want := &PullRequestReviewsEnforcement{ + DismissStaleReviews: true, + DismissalRestrictions: nil, + RequireCodeOwnerReviews: true, + RequiredApprovingReviewCount: 1, + } + if !cmp.Equal(enforcement, want) { + t.Errorf("Repositories.DisableDismissalRestrictions returned %+v, want %+v", enforcement, want) + } - ctx := context.Background() - got, _, err := client.Repositories.ReplaceAllTopics(ctx, "o", "r", []string{"go", "go-github", "github"}) - if err != nil { - t.Fatalf("Repositories.ReplaceAllTopics returned error: %v", err) - } + const methodName = "DisableDismissalRestrictions" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Repositories.DisableDismissalRestrictions(ctx, "\n", "\n", "\n") + return err + }) - want := []string{"go", "go-github", "github"} - if !cmp.Equal(got, want) { - t.Errorf("Repositories.ReplaceAllTopics returned %+v, want %+v", got, want) + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Repositories.DisableDismissalRestrictions(ctx, "o", "r", test.branch) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) + }) } +} - const methodName = "ReplaceAllTopics" - testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Repositories.ReplaceAllTopics(ctx, "\n", "\n", []string{"\n", "\n", "\n"}) - return err - }) +func TestRepositoriesService_RemovePullRequestReviewEnforcement(t *testing.T) { + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b/protection/required_pull_request_reviews"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%/protection/required_pull_request_reviews"}, + } + + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "DELETE") + w.WriteHeader(http.StatusNoContent) + }) + + ctx := context.Background() + _, err := client.Repositories.RemovePullRequestReviewEnforcement(ctx, "o", "r", test.branch) + if err != nil { + t.Errorf("Repositories.RemovePullRequestReviewEnforcement returned error: %v", err) + } - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Repositories.ReplaceAllTopics(ctx, "o", "r", []string{"go", "go-github", "github"}) - if got != nil { - t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) - } - return resp, err - }) + const methodName = "RemovePullRequestReviewEnforcement" + testBadOptions(t, methodName, func() (err error) { + _, err = client.Repositories.RemovePullRequestReviewEnforcement(ctx, "\n", "\n", "\n") + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + return client.Repositories.RemovePullRequestReviewEnforcement(ctx, "o", "r", test.branch) + }) + }) + } } -func TestRepositoriesService_ReplaceAllTopics_nilSlice(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() +func TestRepositoriesService_GetAdminEnforcement(t *testing.T) { + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b/protection/enforce_admins"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%/protection/enforce_admins"}, + } + + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + fmt.Fprintf(w, `{"url":"/repos/o/r/branches/b/protection/enforce_admins","enabled":true}`) + }) + + ctx := context.Background() + enforcement, _, err := client.Repositories.GetAdminEnforcement(ctx, "o", "r", test.branch) + if err != nil { + t.Errorf("Repositories.GetAdminEnforcement returned error: %v", err) + } - mux.HandleFunc("/repos/o/r/topics", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "PUT") - testHeader(t, r, "Accept", mediaTypeTopicsPreview) - testBody(t, r, `{"names":[]}`+"\n") - fmt.Fprint(w, `{"names":[]}`) - }) + want := &AdminEnforcement{ + URL: String("/repos/o/r/branches/b/protection/enforce_admins"), + Enabled: true, + } - ctx := context.Background() - got, _, err := client.Repositories.ReplaceAllTopics(ctx, "o", "r", nil) - if err != nil { - t.Fatalf("Repositories.ReplaceAllTopics returned error: %v", err) - } + if !cmp.Equal(enforcement, want) { + t.Errorf("Repositories.GetAdminEnforcement returned %+v, want %+v", enforcement, want) + } - want := []string{} - if !cmp.Equal(got, want) { - t.Errorf("Repositories.ReplaceAllTopics returned %+v, want %+v", got, want) + const methodName = "GetAdminEnforcement" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Repositories.GetAdminEnforcement(ctx, "\n", "\n", "\n") + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Repositories.GetAdminEnforcement(ctx, "o", "r", test.branch) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) + }) } } -func TestRepositoriesService_ReplaceAllTopics_emptySlice(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() +func TestRepositoriesService_AddAdminEnforcement(t *testing.T) { + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b/protection/enforce_admins"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%/protection/enforce_admins"}, + } + + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "POST") + fmt.Fprintf(w, `{"url":"/repos/o/r/branches/b/protection/enforce_admins","enabled":true}`) + }) + + ctx := context.Background() + enforcement, _, err := client.Repositories.AddAdminEnforcement(ctx, "o", "r", test.branch) + if err != nil { + t.Errorf("Repositories.AddAdminEnforcement returned error: %v", err) + } - mux.HandleFunc("/repos/o/r/topics", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "PUT") - testHeader(t, r, "Accept", mediaTypeTopicsPreview) - testBody(t, r, `{"names":[]}`+"\n") - fmt.Fprint(w, `{"names":[]}`) - }) + want := &AdminEnforcement{ + URL: String("/repos/o/r/branches/b/protection/enforce_admins"), + Enabled: true, + } + if !cmp.Equal(enforcement, want) { + t.Errorf("Repositories.AddAdminEnforcement returned %+v, want %+v", enforcement, want) + } - ctx := context.Background() - got, _, err := client.Repositories.ReplaceAllTopics(ctx, "o", "r", []string{}) - if err != nil { - t.Fatalf("Repositories.ReplaceAllTopics returned error: %v", err) - } + const methodName = "AddAdminEnforcement" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Repositories.AddAdminEnforcement(ctx, "\n", "\n", "\n") + return err + }) - want := []string{} - if !cmp.Equal(got, want) { - t.Errorf("Repositories.ReplaceAllTopics returned %+v, want %+v", got, want) + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Repositories.AddAdminEnforcement(ctx, "o", "r", test.branch) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) + }) } } -func TestRepositoriesService_ListAppRestrictions(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() +func TestRepositoriesService_RemoveAdminEnforcement(t *testing.T) { + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b/protection/enforce_admins"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%/protection/enforce_admins"}, + } + + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "DELETE") + w.WriteHeader(http.StatusNoContent) + }) + + ctx := context.Background() + _, err := client.Repositories.RemoveAdminEnforcement(ctx, "o", "r", test.branch) + if err != nil { + t.Errorf("Repositories.RemoveAdminEnforcement returned error: %v", err) + } - mux.HandleFunc("/repos/o/r/branches/b/protection/restrictions/apps", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - }) + const methodName = "RemoveAdminEnforcement" + testBadOptions(t, methodName, func() (err error) { + _, err = client.Repositories.RemoveAdminEnforcement(ctx, "\n", "\n", "\n") + return err + }) - ctx := context.Background() - _, _, err := client.Repositories.ListAppRestrictions(ctx, "o", "r", "b") - if err != nil { - t.Errorf("Repositories.ListAppRestrictions returned error: %v", err) + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + return client.Repositories.RemoveAdminEnforcement(ctx, "o", "r", test.branch) + }) + }) } +} - const methodName = "ListAppRestrictions" - testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Repositories.ListAppRestrictions(ctx, "\n", "\n", "\n") - return err - }) +func TestRepositoriesService_GetSignaturesProtectedBranch(t *testing.T) { + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b/protection/required_signatures"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%/protection/required_signatures"}, + } + + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + testHeader(t, r, "Accept", mediaTypeSignaturePreview) + fmt.Fprintf(w, `{"url":"/repos/o/r/branches/b/protection/required_signatures","enabled":false}`) + }) + + ctx := context.Background() + signature, _, err := client.Repositories.GetSignaturesProtectedBranch(ctx, "o", "r", test.branch) + if err != nil { + t.Errorf("Repositories.GetSignaturesProtectedBranch returned error: %v", err) + } - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Repositories.ListAppRestrictions(ctx, "o", "r", "b") - if got != nil { - t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) - } - return resp, err - }) -} + want := &SignaturesProtectedBranch{ + URL: String("/repos/o/r/branches/b/protection/required_signatures"), + Enabled: Bool(false), + } -func TestRepositoriesService_ReplaceAppRestrictions(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() + if !cmp.Equal(signature, want) { + t.Errorf("Repositories.GetSignaturesProtectedBranch returned %+v, want %+v", signature, want) + } - mux.HandleFunc("/repos/o/r/branches/b/protection/restrictions/apps", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "PUT") - fmt.Fprint(w, `[{ - "name": "octocat" - }]`) - }) - input := []string{"octocat"} - ctx := context.Background() - got, _, err := client.Repositories.ReplaceAppRestrictions(ctx, "o", "r", "b", input) - if err != nil { - t.Errorf("Repositories.ReplaceAppRestrictions returned error: %v", err) - } - want := []*App{ - {Name: String("octocat")}, - } - if !cmp.Equal(got, want) { - t.Errorf("Repositories.ReplaceAppRestrictions returned %+v, want %+v", got, want) + const methodName = "GetSignaturesProtectedBranch" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Repositories.GetSignaturesProtectedBranch(ctx, "\n", "\n", "\n") + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Repositories.GetSignaturesProtectedBranch(ctx, "o", "r", test.branch) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) + }) } +} - const methodName = "ReplaceAppRestrictions" - testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Repositories.ReplaceAppRestrictions(ctx, "\n", "\n", "\n", input) - return err - }) +func TestRepositoriesService_RequireSignaturesOnProtectedBranch(t *testing.T) { + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b/protection/required_signatures"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%/protection/required_signatures"}, + } + + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "POST") + testHeader(t, r, "Accept", mediaTypeSignaturePreview) + fmt.Fprintf(w, `{"url":"/repos/o/r/branches/b/protection/required_signatures","enabled":true}`) + }) + + ctx := context.Background() + signature, _, err := client.Repositories.RequireSignaturesOnProtectedBranch(ctx, "o", "r", test.branch) + if err != nil { + t.Errorf("Repositories.RequireSignaturesOnProtectedBranch returned error: %v", err) + } - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Repositories.ReplaceAppRestrictions(ctx, "o", "r", "b", input) - if got != nil { - t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) - } - return resp, err - }) -} + want := &SignaturesProtectedBranch{ + URL: String("/repos/o/r/branches/b/protection/required_signatures"), + Enabled: Bool(true), + } -func TestRepositoriesService_AddAppRestrictions(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() + if !cmp.Equal(signature, want) { + t.Errorf("Repositories.RequireSignaturesOnProtectedBranch returned %+v, want %+v", signature, want) + } - mux.HandleFunc("/repos/o/r/branches/b/protection/restrictions/apps", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "POST") - fmt.Fprint(w, `[{ - "name": "octocat" - }]`) - }) - input := []string{"octocat"} - ctx := context.Background() - got, _, err := client.Repositories.AddAppRestrictions(ctx, "o", "r", "b", input) - if err != nil { - t.Errorf("Repositories.AddAppRestrictions returned error: %v", err) - } - want := []*App{ - {Name: String("octocat")}, - } - if !cmp.Equal(got, want) { - t.Errorf("Repositories.AddAppRestrictions returned %+v, want %+v", got, want) + const methodName = "RequireSignaturesOnProtectedBranch" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Repositories.RequireSignaturesOnProtectedBranch(ctx, "\n", "\n", "\n") + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Repositories.RequireSignaturesOnProtectedBranch(ctx, "o", "r", test.branch) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) + }) } +} - const methodName = "AddAppRestrictions" - testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Repositories.AddAppRestrictions(ctx, "\n", "\n", "\n", input) - return err - }) +func TestRepositoriesService_OptionalSignaturesOnProtectedBranch(t *testing.T) { + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b/protection/required_signatures"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%/protection/required_signatures"}, + } + + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "DELETE") + testHeader(t, r, "Accept", mediaTypeSignaturePreview) + w.WriteHeader(http.StatusNoContent) + }) + + ctx := context.Background() + _, err := client.Repositories.OptionalSignaturesOnProtectedBranch(ctx, "o", "r", test.branch) + if err != nil { + t.Errorf("Repositories.OptionalSignaturesOnProtectedBranch returned error: %v", err) + } - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Repositories.AddAppRestrictions(ctx, "o", "r", "b", input) - if got != nil { - t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) - } - return resp, err - }) + const methodName = "OptionalSignaturesOnProtectedBranch" + testBadOptions(t, methodName, func() (err error) { + _, err = client.Repositories.OptionalSignaturesOnProtectedBranch(ctx, "\n", "\n", "\n") + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + return client.Repositories.OptionalSignaturesOnProtectedBranch(ctx, "o", "r", test.branch) + }) + }) + } } -func TestRepositoriesService_RemoveAppRestrictions(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() +func TestPullRequestReviewsEnforcementRequest_MarshalJSON_nilDismissalRestirctions(t *testing.T) { + req := PullRequestReviewsEnforcementRequest{} - mux.HandleFunc("/repos/o/r/branches/b/protection/restrictions/apps", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "DELETE") - fmt.Fprint(w, `[]`) - }) - input := []string{"octocat"} - ctx := context.Background() - got, _, err := client.Repositories.RemoveAppRestrictions(ctx, "o", "r", "b", input) + got, err := json.Marshal(req) if err != nil { - t.Errorf("Repositories.RemoveAppRestrictions returned error: %v", err) + t.Errorf("PullRequestReviewsEnforcementRequest.MarshalJSON returned error: %v", err) } - want := []*App{} - if !cmp.Equal(got, want) { - t.Errorf("Repositories.RemoveAppRestrictions returned %+v, want %+v", got, want) + + want := `{"dismiss_stale_reviews":false,"require_code_owner_reviews":false,"required_approving_review_count":0}` + if want != string(got) { + t.Errorf("PullRequestReviewsEnforcementRequest.MarshalJSON returned %+v, want %+v", string(got), want) } - const methodName = "RemoveAppRestrictions" - testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Repositories.RemoveAppRestrictions(ctx, "\n", "\n", "\n", input) - return err - }) + req = PullRequestReviewsEnforcementRequest{ + DismissalRestrictionsRequest: &DismissalRestrictionsRequest{}, + } - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Repositories.RemoveAppRestrictions(ctx, "o", "r", "b", input) - if got != nil { - t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) - } - return resp, err - }) -} + got, err = json.Marshal(req) + if err != nil { + t.Errorf("PullRequestReviewsEnforcementRequest.MarshalJSON returned error: %v", err) + } -func TestRepositoriesService_ListTeamRestrictions(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() + want = `{"dismissal_restrictions":{},"dismiss_stale_reviews":false,"require_code_owner_reviews":false,"required_approving_review_count":0}` + if want != string(got) { + t.Errorf("PullRequestReviewsEnforcementRequest.MarshalJSON returned %+v, want %+v", string(got), want) + } - mux.HandleFunc("/repos/o/r/branches/b/protection/restrictions/teams", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - }) + req = PullRequestReviewsEnforcementRequest{ + DismissalRestrictionsRequest: &DismissalRestrictionsRequest{ + Users: &[]string{}, + Teams: &[]string{}, + Apps: &[]string{}, + }, + RequireLastPushApproval: Bool(true), + } - ctx := context.Background() - _, _, err := client.Repositories.ListTeamRestrictions(ctx, "o", "r", "b") + got, err = json.Marshal(req) if err != nil { - t.Errorf("Repositories.ListTeamRestrictions returned error: %v", err) + t.Errorf("PullRequestReviewsEnforcementRequest.MarshalJSON returned error: %v", err) } - const methodName = "ListTeamRestrictions" - testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Repositories.ListTeamRestrictions(ctx, "\n", "\n", "\n") - return err - }) - - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Repositories.ListTeamRestrictions(ctx, "o", "r", "b") - if got != nil { - t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) - } - return resp, err - }) + want = `{"dismissal_restrictions":{"users":[],"teams":[],"apps":[]},"dismiss_stale_reviews":false,"require_code_owner_reviews":false,"required_approving_review_count":0,"require_last_push_approval":true}` + if want != string(got) { + t.Errorf("PullRequestReviewsEnforcementRequest.MarshalJSON returned %+v, want %+v", string(got), want) + } } -func TestRepositoriesService_ReplaceTeamRestrictions(t *testing.T) { +func TestRepositoriesService_ListAllTopics(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - - mux.HandleFunc("/repos/o/r/branches/b/protection/restrictions/teams", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "PUT") - fmt.Fprint(w, `[{ - "name": "octocat" - }]`) + + mux.HandleFunc("/repos/o/r/topics", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + testHeader(t, r, "Accept", mediaTypeTopicsPreview) + fmt.Fprint(w, `{"names":["go", "go-github", "github"]}`) }) - input := []string{"octocat"} + ctx := context.Background() - got, _, err := client.Repositories.ReplaceTeamRestrictions(ctx, "o", "r", "b", input) + got, _, err := client.Repositories.ListAllTopics(ctx, "o", "r") if err != nil { - t.Errorf("Repositories.ReplaceTeamRestrictions returned error: %v", err) - } - want := []*Team{ - {Name: String("octocat")}, + t.Fatalf("Repositories.ListAllTopics returned error: %v", err) } + + want := []string{"go", "go-github", "github"} if !cmp.Equal(got, want) { - t.Errorf("Repositories.ReplaceTeamRestrictions returned %+v, want %+v", got, want) + t.Errorf("Repositories.ListAllTopics returned %+v, want %+v", got, want) } - const methodName = "ReplaceTeamRestrictions" + const methodName = "ListAllTopics" testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Repositories.ReplaceTeamRestrictions(ctx, "\n", "\n", "\n", input) + _, _, err = client.Repositories.ListAllTopics(ctx, "\n", "\n") return err }) testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Repositories.ReplaceTeamRestrictions(ctx, "o", "r", "b", input) + got, resp, err := client.Repositories.ListAllTopics(ctx, "o", "r") if got != nil { t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) } @@ -3031,71 +3067,57 @@ func TestRepositoriesService_ReplaceTeamRestrictions(t *testing.T) { }) } -func TestRepositoriesService_AddTeamRestrictions(t *testing.T) { +func TestRepositoriesService_ListAllTopics_emptyTopics(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - mux.HandleFunc("/repos/o/r/branches/b/protection/restrictions/teams", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "POST") - fmt.Fprint(w, `[{ - "name": "octocat" - }]`) + mux.HandleFunc("/repos/o/r/topics", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + testHeader(t, r, "Accept", mediaTypeTopicsPreview) + fmt.Fprint(w, `{"names":[]}`) }) - input := []string{"octocat"} + ctx := context.Background() - got, _, err := client.Repositories.AddTeamRestrictions(ctx, "o", "r", "b", input) + got, _, err := client.Repositories.ListAllTopics(ctx, "o", "r") if err != nil { - t.Errorf("Repositories.AddTeamRestrictions returned error: %v", err) - } - want := []*Team{ - {Name: String("octocat")}, + t.Fatalf("Repositories.ListAllTopics returned error: %v", err) } + + want := []string{} if !cmp.Equal(got, want) { - t.Errorf("Repositories.AddTeamRestrictions returned %+v, want %+v", got, want) + t.Errorf("Repositories.ListAllTopics returned %+v, want %+v", got, want) } - - const methodName = "AddTeamRestrictions" - testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Repositories.AddTeamRestrictions(ctx, "\n", "\n", "\n", input) - return err - }) - - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Repositories.AddTeamRestrictions(ctx, "o", "r", "b", input) - if got != nil { - t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) - } - return resp, err - }) } -func TestRepositoriesService_RemoveTeamRestrictions(t *testing.T) { +func TestRepositoriesService_ReplaceAllTopics(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - mux.HandleFunc("/repos/o/r/branches/b/protection/restrictions/teams", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "DELETE") - fmt.Fprint(w, `[]`) + mux.HandleFunc("/repos/o/r/topics", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "PUT") + testHeader(t, r, "Accept", mediaTypeTopicsPreview) + fmt.Fprint(w, `{"names":["go", "go-github", "github"]}`) }) - input := []string{"octocat"} + ctx := context.Background() - got, _, err := client.Repositories.RemoveTeamRestrictions(ctx, "o", "r", "b", input) + got, _, err := client.Repositories.ReplaceAllTopics(ctx, "o", "r", []string{"go", "go-github", "github"}) if err != nil { - t.Errorf("Repositories.RemoveTeamRestrictions returned error: %v", err) + t.Fatalf("Repositories.ReplaceAllTopics returned error: %v", err) } - want := []*Team{} + + want := []string{"go", "go-github", "github"} if !cmp.Equal(got, want) { - t.Errorf("Repositories.RemoveTeamRestrictions returned %+v, want %+v", got, want) + t.Errorf("Repositories.ReplaceAllTopics returned %+v, want %+v", got, want) } - const methodName = "RemoveTeamRestrictions" + const methodName = "ReplaceAllTopics" testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Repositories.RemoveTeamRestrictions(ctx, "\n", "\n", "\n", input) + _, _, err = client.Repositories.ReplaceAllTopics(ctx, "\n", "\n", []string{"\n", "\n", "\n"}) return err }) testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Repositories.RemoveTeamRestrictions(ctx, "o", "r", "b", input) + got, resp, err := client.Repositories.ReplaceAllTopics(ctx, "o", "r", []string{"go", "go-github", "github"}) if got != nil { t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) } @@ -3103,143 +3125,611 @@ func TestRepositoriesService_RemoveTeamRestrictions(t *testing.T) { }) } -func TestRepositoriesService_ListUserRestrictions(t *testing.T) { +func TestRepositoriesService_ReplaceAllTopics_nilSlice(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - mux.HandleFunc("/repos/o/r/branches/b/protection/restrictions/users", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") + mux.HandleFunc("/repos/o/r/topics", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "PUT") + testHeader(t, r, "Accept", mediaTypeTopicsPreview) + testBody(t, r, `{"names":[]}`+"\n") + fmt.Fprint(w, `{"names":[]}`) }) ctx := context.Background() - _, _, err := client.Repositories.ListUserRestrictions(ctx, "o", "r", "b") + got, _, err := client.Repositories.ReplaceAllTopics(ctx, "o", "r", nil) if err != nil { - t.Errorf("Repositories.ListUserRestrictions returned error: %v", err) + t.Fatalf("Repositories.ReplaceAllTopics returned error: %v", err) } - const methodName = "ListUserRestrictions" - testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Repositories.ListUserRestrictions(ctx, "\n", "\n", "\n") - return err - }) - - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Repositories.ListUserRestrictions(ctx, "o", "r", "b") - if got != nil { - t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) - } - return resp, err - }) + want := []string{} + if !cmp.Equal(got, want) { + t.Errorf("Repositories.ReplaceAllTopics returned %+v, want %+v", got, want) + } } -func TestRepositoriesService_ReplaceUserRestrictions(t *testing.T) { +func TestRepositoriesService_ReplaceAllTopics_emptySlice(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - mux.HandleFunc("/repos/o/r/branches/b/protection/restrictions/users", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/o/r/topics", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PUT") - fmt.Fprint(w, `[{ - "name": "octocat" - }]`) + testHeader(t, r, "Accept", mediaTypeTopicsPreview) + testBody(t, r, `{"names":[]}`+"\n") + fmt.Fprint(w, `{"names":[]}`) }) - input := []string{"octocat"} + ctx := context.Background() - got, _, err := client.Repositories.ReplaceUserRestrictions(ctx, "o", "r", "b", input) + got, _, err := client.Repositories.ReplaceAllTopics(ctx, "o", "r", []string{}) if err != nil { - t.Errorf("Repositories.ReplaceUserRestrictions returned error: %v", err) - } - want := []*User{ - {Name: String("octocat")}, + t.Fatalf("Repositories.ReplaceAllTopics returned error: %v", err) } + + want := []string{} if !cmp.Equal(got, want) { - t.Errorf("Repositories.ReplaceUserRestrictions returned %+v, want %+v", got, want) + t.Errorf("Repositories.ReplaceAllTopics returned %+v, want %+v", got, want) } +} - const methodName = "ReplaceUserRestrictions" - testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Repositories.ReplaceUserRestrictions(ctx, "\n", "\n", "\n", input) - return err - }) +func TestRepositoriesService_ListAppRestrictions(t *testing.T) { + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b/protection/restrictions/apps"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%/protection/restrictions/apps"}, + } + + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + }) + + ctx := context.Background() + _, _, err := client.Repositories.ListAppRestrictions(ctx, "o", "r", test.branch) + if err != nil { + t.Errorf("Repositories.ListAppRestrictions returned error: %v", err) + } - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Repositories.ReplaceUserRestrictions(ctx, "o", "r", "b", input) - if got != nil { - t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) - } - return resp, err - }) + const methodName = "ListAppRestrictions" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Repositories.ListAppRestrictions(ctx, "\n", "\n", "\n") + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Repositories.ListAppRestrictions(ctx, "o", "r", test.branch) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) + }) + } } -func TestRepositoriesService_AddUserRestrictions(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() +func TestRepositoriesService_ReplaceAppRestrictions(t *testing.T) { + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b/protection/restrictions/apps"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%/protection/restrictions/apps"}, + } + + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "PUT") + fmt.Fprint(w, `[{ + "name": "octocat" + }]`) + }) + input := []string{"octocat"} + ctx := context.Background() + got, _, err := client.Repositories.ReplaceAppRestrictions(ctx, "o", "r", test.branch, input) + if err != nil { + t.Errorf("Repositories.ReplaceAppRestrictions returned error: %v", err) + } + want := []*App{ + {Name: String("octocat")}, + } + if !cmp.Equal(got, want) { + t.Errorf("Repositories.ReplaceAppRestrictions returned %+v, want %+v", got, want) + } - mux.HandleFunc("/repos/o/r/branches/b/protection/restrictions/users", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "POST") - fmt.Fprint(w, `[{ + const methodName = "ReplaceAppRestrictions" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Repositories.ReplaceAppRestrictions(ctx, "\n", "\n", "\n", input) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Repositories.ReplaceAppRestrictions(ctx, "o", "r", test.branch, input) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) + }) + } +} + +func TestRepositoriesService_AddAppRestrictions(t *testing.T) { + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b/protection/restrictions/apps"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%/protection/restrictions/apps"}, + } + + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "POST") + fmt.Fprint(w, `[{ "name": "octocat" }]`) - }) - input := []string{"octocat"} - ctx := context.Background() - got, _, err := client.Repositories.AddUserRestrictions(ctx, "o", "r", "b", input) - if err != nil { - t.Errorf("Repositories.AddUserRestrictions returned error: %v", err) + }) + input := []string{"octocat"} + ctx := context.Background() + got, _, err := client.Repositories.AddAppRestrictions(ctx, "o", "r", test.branch, input) + if err != nil { + t.Errorf("Repositories.AddAppRestrictions returned error: %v", err) + } + want := []*App{ + {Name: String("octocat")}, + } + if !cmp.Equal(got, want) { + t.Errorf("Repositories.AddAppRestrictions returned %+v, want %+v", got, want) + } + + const methodName = "AddAppRestrictions" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Repositories.AddAppRestrictions(ctx, "\n", "\n", "\n", input) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Repositories.AddAppRestrictions(ctx, "o", "r", test.branch, input) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) + }) } - want := []*User{ - {Name: String("octocat")}, +} + +func TestRepositoriesService_RemoveAppRestrictions(t *testing.T) { + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b/protection/restrictions/apps"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%/protection/restrictions/apps"}, + } + + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "DELETE") + fmt.Fprint(w, `[]`) + }) + input := []string{"octocat"} + ctx := context.Background() + got, _, err := client.Repositories.RemoveAppRestrictions(ctx, "o", "r", test.branch, input) + if err != nil { + t.Errorf("Repositories.RemoveAppRestrictions returned error: %v", err) + } + want := []*App{} + if !cmp.Equal(got, want) { + t.Errorf("Repositories.RemoveAppRestrictions returned %+v, want %+v", got, want) + } + + const methodName = "RemoveAppRestrictions" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Repositories.RemoveAppRestrictions(ctx, "\n", "\n", "\n", input) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Repositories.RemoveAppRestrictions(ctx, "o", "r", test.branch, input) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) + }) } - if !cmp.Equal(got, want) { - t.Errorf("Repositories.AddUserRestrictions returned %+v, want %+v", got, want) +} + +func TestRepositoriesService_ListTeamRestrictions(t *testing.T) { + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b/protection/restrictions/teams"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%/protection/restrictions/teams"}, + } + + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + }) + + ctx := context.Background() + _, _, err := client.Repositories.ListTeamRestrictions(ctx, "o", "r", test.branch) + if err != nil { + t.Errorf("Repositories.ListTeamRestrictions returned error: %v", err) + } + + const methodName = "ListTeamRestrictions" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Repositories.ListTeamRestrictions(ctx, "\n", "\n", "\n") + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Repositories.ListTeamRestrictions(ctx, "o", "r", test.branch) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) + }) } +} - const methodName = "AddUserRestrictions" - testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Repositories.AddUserRestrictions(ctx, "\n", "\n", "\n", input) - return err - }) +func TestRepositoriesService_ReplaceTeamRestrictions(t *testing.T) { + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b/protection/restrictions/teams"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%/protection/restrictions/teams"}, + } + + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "PUT") + fmt.Fprint(w, `[{ + "name": "octocat" + }]`) + }) + input := []string{"octocat"} + ctx := context.Background() + got, _, err := client.Repositories.ReplaceTeamRestrictions(ctx, "o", "r", test.branch, input) + if err != nil { + t.Errorf("Repositories.ReplaceTeamRestrictions returned error: %v", err) + } + want := []*Team{ + {Name: String("octocat")}, + } + if !cmp.Equal(got, want) { + t.Errorf("Repositories.ReplaceTeamRestrictions returned %+v, want %+v", got, want) + } - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Repositories.AddUserRestrictions(ctx, "o", "r", "b", input) - if got != nil { - t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) - } - return resp, err - }) + const methodName = "ReplaceTeamRestrictions" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Repositories.ReplaceTeamRestrictions(ctx, "\n", "\n", "\n", input) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Repositories.ReplaceTeamRestrictions(ctx, "o", "r", test.branch, input) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) + }) + } } -func TestRepositoriesService_RemoveUserRestrictions(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() +func TestRepositoriesService_AddTeamRestrictions(t *testing.T) { + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b/protection/restrictions/teams"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%/protection/restrictions/teams"}, + } + + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "POST") + fmt.Fprint(w, `[{ + "name": "octocat" + }]`) + }) + input := []string{"octocat"} + ctx := context.Background() + got, _, err := client.Repositories.AddTeamRestrictions(ctx, "o", "r", test.branch, input) + if err != nil { + t.Errorf("Repositories.AddTeamRestrictions returned error: %v", err) + } + want := []*Team{ + {Name: String("octocat")}, + } + if !cmp.Equal(got, want) { + t.Errorf("Repositories.AddTeamRestrictions returned %+v, want %+v", got, want) + } - mux.HandleFunc("/repos/o/r/branches/b/protection/restrictions/users", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "DELETE") - fmt.Fprint(w, `[]`) - }) - input := []string{"octocat"} - ctx := context.Background() - got, _, err := client.Repositories.RemoveUserRestrictions(ctx, "o", "r", "b", input) - if err != nil { - t.Errorf("Repositories.RemoveUserRestrictions returned error: %v", err) + const methodName = "AddTeamRestrictions" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Repositories.AddTeamRestrictions(ctx, "\n", "\n", "\n", input) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Repositories.AddTeamRestrictions(ctx, "o", "r", test.branch, input) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) + }) } - want := []*User{} - if !cmp.Equal(got, want) { - t.Errorf("Repositories.RemoveUserRestrictions returned %+v, want %+v", got, want) +} + +func TestRepositoriesService_RemoveTeamRestrictions(t *testing.T) { + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b/protection/restrictions/teams"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%/protection/restrictions/teams"}, + } + + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "DELETE") + fmt.Fprint(w, `[]`) + }) + input := []string{"octocat"} + ctx := context.Background() + got, _, err := client.Repositories.RemoveTeamRestrictions(ctx, "o", "r", test.branch, input) + if err != nil { + t.Errorf("Repositories.RemoveTeamRestrictions returned error: %v", err) + } + want := []*Team{} + if !cmp.Equal(got, want) { + t.Errorf("Repositories.RemoveTeamRestrictions returned %+v, want %+v", got, want) + } + + const methodName = "RemoveTeamRestrictions" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Repositories.RemoveTeamRestrictions(ctx, "\n", "\n", "\n", input) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Repositories.RemoveTeamRestrictions(ctx, "o", "r", test.branch, input) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) + }) } +} - const methodName = "RemoveUserRestrictions" - testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Repositories.RemoveUserRestrictions(ctx, "\n", "\n", "\n", input) - return err - }) +func TestRepositoriesService_ListUserRestrictions(t *testing.T) { + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b/protection/restrictions/users"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%/protection/restrictions/users"}, + } + + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + }) + + ctx := context.Background() + _, _, err := client.Repositories.ListUserRestrictions(ctx, "o", "r", test.branch) + if err != nil { + t.Errorf("Repositories.ListUserRestrictions returned error: %v", err) + } - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Repositories.RemoveUserRestrictions(ctx, "o", "r", "b", input) - if got != nil { - t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) - } - return resp, err - }) + const methodName = "ListUserRestrictions" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Repositories.ListUserRestrictions(ctx, "\n", "\n", "\n") + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Repositories.ListUserRestrictions(ctx, "o", "r", test.branch) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) + }) + } +} + +func TestRepositoriesService_ReplaceUserRestrictions(t *testing.T) { + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b/protection/restrictions/users"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%/protection/restrictions/users"}, + } + + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "PUT") + fmt.Fprint(w, `[{ + "name": "octocat" + }]`) + }) + input := []string{"octocat"} + ctx := context.Background() + got, _, err := client.Repositories.ReplaceUserRestrictions(ctx, "o", "r", test.branch, input) + if err != nil { + t.Errorf("Repositories.ReplaceUserRestrictions returned error: %v", err) + } + want := []*User{ + {Name: String("octocat")}, + } + if !cmp.Equal(got, want) { + t.Errorf("Repositories.ReplaceUserRestrictions returned %+v, want %+v", got, want) + } + + const methodName = "ReplaceUserRestrictions" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Repositories.ReplaceUserRestrictions(ctx, "\n", "\n", "\n", input) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Repositories.ReplaceUserRestrictions(ctx, "o", "r", test.branch, input) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) + }) + } +} + +func TestRepositoriesService_AddUserRestrictions(t *testing.T) { + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b/protection/restrictions/users"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%/protection/restrictions/users"}, + } + + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "POST") + fmt.Fprint(w, `[{ + "name": "octocat" + }]`) + }) + input := []string{"octocat"} + ctx := context.Background() + got, _, err := client.Repositories.AddUserRestrictions(ctx, "o", "r", test.branch, input) + if err != nil { + t.Errorf("Repositories.AddUserRestrictions returned error: %v", err) + } + want := []*User{ + {Name: String("octocat")}, + } + if !cmp.Equal(got, want) { + t.Errorf("Repositories.AddUserRestrictions returned %+v, want %+v", got, want) + } + + const methodName = "AddUserRestrictions" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Repositories.AddUserRestrictions(ctx, "\n", "\n", "\n", input) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Repositories.AddUserRestrictions(ctx, "o", "r", test.branch, input) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) + }) + } +} + +func TestRepositoriesService_RemoveUserRestrictions(t *testing.T) { + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b/protection/restrictions/users"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%/protection/restrictions/users"}, + } + + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "DELETE") + fmt.Fprint(w, `[]`) + }) + input := []string{"octocat"} + ctx := context.Background() + got, _, err := client.Repositories.RemoveUserRestrictions(ctx, "o", "r", test.branch, input) + if err != nil { + t.Errorf("Repositories.RemoveUserRestrictions returned error: %v", err) + } + want := []*User{} + if !cmp.Equal(got, want) { + t.Errorf("Repositories.RemoveUserRestrictions returned %+v, want %+v", got, want) + } + + const methodName = "RemoveUserRestrictions" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Repositories.RemoveUserRestrictions(ctx, "\n", "\n", "\n", input) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Repositories.RemoveUserRestrictions(ctx, "o", "r", test.branch, input) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) + }) + } } func TestRepositoriesService_Transfer(t *testing.T) { From 74db58f49eff5459db2d512abdb2aa3075d93300 Mon Sep 17 00:00:00 2001 From: Anish Rajan Date: Thu, 5 Oct 2023 17:23:45 +0530 Subject: [PATCH 035/145] Add Repository Security Advisories APIs (#2902) Fixes: #2866. --- github/event_types.go | 45 +++-- github/github-accessors.go | 136 +++++++++++++++ github/github-accessors_test.go | 155 +++++++++++++++++ github/security_advisories.go | 83 +++++++++ github/security_advisories_test.go | 265 +++++++++++++++++++++++++++++ 5 files changed, 672 insertions(+), 12 deletions(-) diff --git a/github/event_types.go b/github/event_types.go index b3e58b3318f..e91d22686ff 100644 --- a/github/event_types.go +++ b/github/event_types.go @@ -1692,18 +1692,33 @@ type WorkflowRunEvent struct { // // GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#security_advisory type SecurityAdvisory struct { - CVSS *AdvisoryCVSS `json:"cvss,omitempty"` - CWEs []*AdvisoryCWEs `json:"cwes,omitempty"` - GHSAID *string `json:"ghsa_id,omitempty"` - Summary *string `json:"summary,omitempty"` - Description *string `json:"description,omitempty"` - Severity *string `json:"severity,omitempty"` - Identifiers []*AdvisoryIdentifier `json:"identifiers,omitempty"` - References []*AdvisoryReference `json:"references,omitempty"` - PublishedAt *Timestamp `json:"published_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - WithdrawnAt *Timestamp `json:"withdrawn_at,omitempty"` - Vulnerabilities []*AdvisoryVulnerability `json:"vulnerabilities,omitempty"` + CVSS *AdvisoryCVSS `json:"cvss,omitempty"` + CWEs []*AdvisoryCWEs `json:"cwes,omitempty"` + GHSAID *string `json:"ghsa_id,omitempty"` + Summary *string `json:"summary,omitempty"` + Description *string `json:"description,omitempty"` + Severity *string `json:"severity,omitempty"` + Identifiers []*AdvisoryIdentifier `json:"identifiers,omitempty"` + References []*AdvisoryReference `json:"references,omitempty"` + PublishedAt *Timestamp `json:"published_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + WithdrawnAt *Timestamp `json:"withdrawn_at,omitempty"` + Vulnerabilities []*AdvisoryVulnerability `json:"vulnerabilities,omitempty"` + CVEID *string `json:"cve_id,omitempty"` + URL *string `json:"url,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + Author *User `json:"author,omitempty"` + Publisher *User `json:"publisher,omitempty"` + State *string `json:"state,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + ClosedAt *Timestamp `json:"closed_at,omitempty"` + Submission *SecurityAdvisorySubmission `json:"submission,omitempty"` + CWEIDs []string `json:"cwe_ids,omitempty"` + Credits []*RepoAdvisoryCredit `json:"credits,omitempty"` + CreditsDetailed []*RepoAdvisoryCreditDetailed `json:"credits_detailed,omitempty"` + CollaboratingUsers []*User `json:"collaborating_users,omitempty"` + CollaboratingTeams []*Team `json:"collaborating_teams,omitempty"` + PrivateFork *Repository `json:"private_fork,omitempty"` } // AdvisoryIdentifier represents the identifier for a Security Advisory. @@ -1723,6 +1738,12 @@ type AdvisoryVulnerability struct { Severity *string `json:"severity,omitempty"` VulnerableVersionRange *string `json:"vulnerable_version_range,omitempty"` FirstPatchedVersion *FirstPatchedVersion `json:"first_patched_version,omitempty"` + + // PatchedVersions and VulnerableFunctions are used in the following APIs: + // - https://docs.github.com/en/rest/security-advisories/repository-advisories?apiVersion=2022-11-28#list-repository-security-advisories-for-an-organization + // - https://docs.github.com/en/rest/security-advisories/repository-advisories?apiVersion=2022-11-28#list-repository-security-advisories + PatchedVersions *string `json:"patched_versions,omitempty"` + VulnerableFunctions []string `json:"vulnerable_functions,omitempty"` } // VulnerabilityPackage represents the package object for an Advisory Vulnerability. diff --git a/github/github-accessors.go b/github/github-accessors.go index 8519de2de9d..a0e7a74366e 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -438,6 +438,14 @@ func (a *AdvisoryVulnerability) GetPackage() *VulnerabilityPackage { return a.Package } +// GetPatchedVersions returns the PatchedVersions field if it's non-nil, zero value otherwise. +func (a *AdvisoryVulnerability) GetPatchedVersions() string { + if a == nil || a.PatchedVersions == nil { + return "" + } + return *a.PatchedVersions +} + // GetSeverity returns the Severity field if it's non-nil, zero value otherwise. func (a *AdvisoryVulnerability) GetSeverity() string { if a == nil || a.Severity == nil { @@ -17886,6 +17894,46 @@ func (r *RenameOrgResponse) GetURL() string { return *r.URL } +// GetLogin returns the Login field if it's non-nil, zero value otherwise. +func (r *RepoAdvisoryCredit) GetLogin() string { + if r == nil || r.Login == nil { + return "" + } + return *r.Login +} + +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (r *RepoAdvisoryCredit) GetType() string { + if r == nil || r.Type == nil { + return "" + } + return *r.Type +} + +// GetState returns the State field if it's non-nil, zero value otherwise. +func (r *RepoAdvisoryCreditDetailed) GetState() string { + if r == nil || r.State == nil { + return "" + } + return *r.State +} + +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (r *RepoAdvisoryCreditDetailed) GetType() string { + if r == nil || r.Type == nil { + return "" + } + return *r.Type +} + +// GetUser returns the User field. +func (r *RepoAdvisoryCreditDetailed) GetUser() *User { + if r == nil { + return nil + } + return r.User +} + // GetDownloadLocation returns the DownloadLocation field if it's non-nil, zero value otherwise. func (r *RepoDependencies) GetDownloadLocation() string { if r == nil || r.DownloadLocation == nil { @@ -21214,6 +21262,38 @@ func (s *SecretScanningPushProtection) GetStatus() string { return *s.Status } +// GetAuthor returns the Author field. +func (s *SecurityAdvisory) GetAuthor() *User { + if s == nil { + return nil + } + return s.Author +} + +// GetClosedAt returns the ClosedAt field if it's non-nil, zero value otherwise. +func (s *SecurityAdvisory) GetClosedAt() Timestamp { + if s == nil || s.ClosedAt == nil { + return Timestamp{} + } + return *s.ClosedAt +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (s *SecurityAdvisory) GetCreatedAt() Timestamp { + if s == nil || s.CreatedAt == nil { + return Timestamp{} + } + return *s.CreatedAt +} + +// GetCVEID returns the CVEID field if it's non-nil, zero value otherwise. +func (s *SecurityAdvisory) GetCVEID() string { + if s == nil || s.CVEID == nil { + return "" + } + return *s.CVEID +} + // GetCVSS returns the CVSS field. func (s *SecurityAdvisory) GetCVSS() *AdvisoryCVSS { if s == nil { @@ -21238,6 +21318,22 @@ func (s *SecurityAdvisory) GetGHSAID() string { return *s.GHSAID } +// GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. +func (s *SecurityAdvisory) GetHTMLURL() string { + if s == nil || s.HTMLURL == nil { + return "" + } + return *s.HTMLURL +} + +// GetPrivateFork returns the PrivateFork field. +func (s *SecurityAdvisory) GetPrivateFork() *Repository { + if s == nil { + return nil + } + return s.PrivateFork +} + // GetPublishedAt returns the PublishedAt field if it's non-nil, zero value otherwise. func (s *SecurityAdvisory) GetPublishedAt() Timestamp { if s == nil || s.PublishedAt == nil { @@ -21246,6 +21342,14 @@ func (s *SecurityAdvisory) GetPublishedAt() Timestamp { return *s.PublishedAt } +// GetPublisher returns the Publisher field. +func (s *SecurityAdvisory) GetPublisher() *User { + if s == nil { + return nil + } + return s.Publisher +} + // GetSeverity returns the Severity field if it's non-nil, zero value otherwise. func (s *SecurityAdvisory) GetSeverity() string { if s == nil || s.Severity == nil { @@ -21254,6 +21358,22 @@ func (s *SecurityAdvisory) GetSeverity() string { return *s.Severity } +// GetState returns the State field if it's non-nil, zero value otherwise. +func (s *SecurityAdvisory) GetState() string { + if s == nil || s.State == nil { + return "" + } + return *s.State +} + +// GetSubmission returns the Submission field. +func (s *SecurityAdvisory) GetSubmission() *SecurityAdvisorySubmission { + if s == nil { + return nil + } + return s.Submission +} + // GetSummary returns the Summary field if it's non-nil, zero value otherwise. func (s *SecurityAdvisory) GetSummary() string { if s == nil || s.Summary == nil { @@ -21270,6 +21390,14 @@ func (s *SecurityAdvisory) GetUpdatedAt() Timestamp { return *s.UpdatedAt } +// GetURL returns the URL field if it's non-nil, zero value otherwise. +func (s *SecurityAdvisory) GetURL() string { + if s == nil || s.URL == nil { + return "" + } + return *s.URL +} + // GetWithdrawnAt returns the WithdrawnAt field if it's non-nil, zero value otherwise. func (s *SecurityAdvisory) GetWithdrawnAt() Timestamp { if s == nil || s.WithdrawnAt == nil { @@ -21334,6 +21462,14 @@ func (s *SecurityAdvisoryEvent) GetSender() *User { return s.Sender } +// GetAccepted returns the Accepted field if it's non-nil, zero value otherwise. +func (s *SecurityAdvisorySubmission) GetAccepted() bool { + if s == nil || s.Accepted == nil { + return false + } + return *s.Accepted +} + // GetAdvancedSecurity returns the AdvancedSecurity field. func (s *SecurityAndAnalysis) GetAdvancedSecurity() *AdvancedSecurity { if s == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index c3e02988ae7..9b3c36fd9bc 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -503,6 +503,16 @@ func TestAdvisoryVulnerability_GetPackage(tt *testing.T) { a.GetPackage() } +func TestAdvisoryVulnerability_GetPatchedVersions(tt *testing.T) { + var zeroValue string + a := &AdvisoryVulnerability{PatchedVersions: &zeroValue} + a.GetPatchedVersions() + a = &AdvisoryVulnerability{} + a.GetPatchedVersions() + a = nil + a.GetPatchedVersions() +} + func TestAdvisoryVulnerability_GetSeverity(tt *testing.T) { var zeroValue string a := &AdvisoryVulnerability{Severity: &zeroValue} @@ -20723,6 +20733,53 @@ func TestRenameOrgResponse_GetURL(tt *testing.T) { r.GetURL() } +func TestRepoAdvisoryCredit_GetLogin(tt *testing.T) { + var zeroValue string + r := &RepoAdvisoryCredit{Login: &zeroValue} + r.GetLogin() + r = &RepoAdvisoryCredit{} + r.GetLogin() + r = nil + r.GetLogin() +} + +func TestRepoAdvisoryCredit_GetType(tt *testing.T) { + var zeroValue string + r := &RepoAdvisoryCredit{Type: &zeroValue} + r.GetType() + r = &RepoAdvisoryCredit{} + r.GetType() + r = nil + r.GetType() +} + +func TestRepoAdvisoryCreditDetailed_GetState(tt *testing.T) { + var zeroValue string + r := &RepoAdvisoryCreditDetailed{State: &zeroValue} + r.GetState() + r = &RepoAdvisoryCreditDetailed{} + r.GetState() + r = nil + r.GetState() +} + +func TestRepoAdvisoryCreditDetailed_GetType(tt *testing.T) { + var zeroValue string + r := &RepoAdvisoryCreditDetailed{Type: &zeroValue} + r.GetType() + r = &RepoAdvisoryCreditDetailed{} + r.GetType() + r = nil + r.GetType() +} + +func TestRepoAdvisoryCreditDetailed_GetUser(tt *testing.T) { + r := &RepoAdvisoryCreditDetailed{} + r.GetUser() + r = nil + r.GetUser() +} + func TestRepoDependencies_GetDownloadLocation(tt *testing.T) { var zeroValue string r := &RepoDependencies{DownloadLocation: &zeroValue} @@ -24691,6 +24748,43 @@ func TestSecretScanningPushProtection_GetStatus(tt *testing.T) { s.GetStatus() } +func TestSecurityAdvisory_GetAuthor(tt *testing.T) { + s := &SecurityAdvisory{} + s.GetAuthor() + s = nil + s.GetAuthor() +} + +func TestSecurityAdvisory_GetClosedAt(tt *testing.T) { + var zeroValue Timestamp + s := &SecurityAdvisory{ClosedAt: &zeroValue} + s.GetClosedAt() + s = &SecurityAdvisory{} + s.GetClosedAt() + s = nil + s.GetClosedAt() +} + +func TestSecurityAdvisory_GetCreatedAt(tt *testing.T) { + var zeroValue Timestamp + s := &SecurityAdvisory{CreatedAt: &zeroValue} + s.GetCreatedAt() + s = &SecurityAdvisory{} + s.GetCreatedAt() + s = nil + s.GetCreatedAt() +} + +func TestSecurityAdvisory_GetCVEID(tt *testing.T) { + var zeroValue string + s := &SecurityAdvisory{CVEID: &zeroValue} + s.GetCVEID() + s = &SecurityAdvisory{} + s.GetCVEID() + s = nil + s.GetCVEID() +} + func TestSecurityAdvisory_GetCVSS(tt *testing.T) { s := &SecurityAdvisory{} s.GetCVSS() @@ -24718,6 +24812,23 @@ func TestSecurityAdvisory_GetGHSAID(tt *testing.T) { s.GetGHSAID() } +func TestSecurityAdvisory_GetHTMLURL(tt *testing.T) { + var zeroValue string + s := &SecurityAdvisory{HTMLURL: &zeroValue} + s.GetHTMLURL() + s = &SecurityAdvisory{} + s.GetHTMLURL() + s = nil + s.GetHTMLURL() +} + +func TestSecurityAdvisory_GetPrivateFork(tt *testing.T) { + s := &SecurityAdvisory{} + s.GetPrivateFork() + s = nil + s.GetPrivateFork() +} + func TestSecurityAdvisory_GetPublishedAt(tt *testing.T) { var zeroValue Timestamp s := &SecurityAdvisory{PublishedAt: &zeroValue} @@ -24728,6 +24839,13 @@ func TestSecurityAdvisory_GetPublishedAt(tt *testing.T) { s.GetPublishedAt() } +func TestSecurityAdvisory_GetPublisher(tt *testing.T) { + s := &SecurityAdvisory{} + s.GetPublisher() + s = nil + s.GetPublisher() +} + func TestSecurityAdvisory_GetSeverity(tt *testing.T) { var zeroValue string s := &SecurityAdvisory{Severity: &zeroValue} @@ -24738,6 +24856,23 @@ func TestSecurityAdvisory_GetSeverity(tt *testing.T) { s.GetSeverity() } +func TestSecurityAdvisory_GetState(tt *testing.T) { + var zeroValue string + s := &SecurityAdvisory{State: &zeroValue} + s.GetState() + s = &SecurityAdvisory{} + s.GetState() + s = nil + s.GetState() +} + +func TestSecurityAdvisory_GetSubmission(tt *testing.T) { + s := &SecurityAdvisory{} + s.GetSubmission() + s = nil + s.GetSubmission() +} + func TestSecurityAdvisory_GetSummary(tt *testing.T) { var zeroValue string s := &SecurityAdvisory{Summary: &zeroValue} @@ -24758,6 +24893,16 @@ func TestSecurityAdvisory_GetUpdatedAt(tt *testing.T) { s.GetUpdatedAt() } +func TestSecurityAdvisory_GetURL(tt *testing.T) { + var zeroValue string + s := &SecurityAdvisory{URL: &zeroValue} + s.GetURL() + s = &SecurityAdvisory{} + s.GetURL() + s = nil + s.GetURL() +} + func TestSecurityAdvisory_GetWithdrawnAt(tt *testing.T) { var zeroValue Timestamp s := &SecurityAdvisory{WithdrawnAt: &zeroValue} @@ -24820,6 +24965,16 @@ func TestSecurityAdvisoryEvent_GetSender(tt *testing.T) { s.GetSender() } +func TestSecurityAdvisorySubmission_GetAccepted(tt *testing.T) { + var zeroValue bool + s := &SecurityAdvisorySubmission{Accepted: &zeroValue} + s.GetAccepted() + s = &SecurityAdvisorySubmission{} + s.GetAccepted() + s = nil + s.GetAccepted() +} + func TestSecurityAndAnalysis_GetAdvancedSecurity(tt *testing.T) { s := &SecurityAndAnalysis{} s.GetAdvancedSecurity() diff --git a/github/security_advisories.go b/github/security_advisories.go index a75fce54d95..681d0cd4bd5 100644 --- a/github/security_advisories.go +++ b/github/security_advisories.go @@ -12,6 +12,41 @@ import ( type SecurityAdvisoriesService service +// SecurityAdvisorySubmission represents the Security Advisory Submission. +type SecurityAdvisorySubmission struct { + // Accepted represents whether a private vulnerability report was accepted by the repository's administrators. + Accepted *bool `json:"accepted,omitempty"` +} + +// RepoAdvisoryCredit represents the credit object for a repository Security Advisory. +type RepoAdvisoryCredit struct { + Login *string `json:"login,omitempty"` + Type *string `json:"type,omitempty"` +} + +// RepoAdvisoryCreditDetailed represents a credit given to a user for a repository Security Advisory. +type RepoAdvisoryCreditDetailed struct { + User *User `json:"user,omitempty"` + Type *string `json:"type,omitempty"` + State *string `json:"state,omitempty"` +} + +// ListRepositorySecurityAdvisoriesOptions specifies the optional parameters to list the repository security advisories. +type ListRepositorySecurityAdvisoriesOptions struct { + ListCursorOptions + + // Direction in which to sort advisories. Possible values are: asc, desc. + // Default is "asc". + Direction string `url:"direction,omitempty"` + + // Sort specifies how to sort advisories. Possible values are: created, updated, + // and published. Default value is "created". + Sort string `url:"sort,omitempty"` + + // State filters advisories based on their state. Possible values are: triage, draft, published, closed. + State string `url:"state,omitempty"` +} + // RequestCVE requests a Common Vulnerabilities and Exposures (CVE) for a repository security advisory. // The ghsaID is the GitHub Security Advisory identifier of the advisory. // @@ -35,3 +70,51 @@ func (s *SecurityAdvisoriesService) RequestCVE(ctx context.Context, owner, repo, return resp, nil } + +// ListRepositorySecurityAdvisoriesForOrg lists the repository security advisories for an organization. +// +// GitHub API docs: https://docs.github.com/en/rest/security-advisories/repository-advisories?apiVersion=2022-11-28#list-repository-security-advisories-for-an-organization +func (s *SecurityAdvisoriesService) ListRepositorySecurityAdvisoriesForOrg(ctx context.Context, org string, opt *ListRepositorySecurityAdvisoriesOptions) ([]*SecurityAdvisory, *Response, error) { + url := fmt.Sprintf("orgs/%v/security-advisories", org) + url, err := addOptions(url, opt) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", url, nil) + if err != nil { + return nil, nil, err + } + + var advisories []*SecurityAdvisory + resp, err := s.client.Do(ctx, req, &advisories) + if err != nil { + return nil, resp, err + } + + return advisories, resp, nil +} + +// ListRepositorySecurityAdvisories lists the security advisories in a repository. +// +// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/security-advisories/repository-advisories?apiVersion=2022-11-28#list-repository-security-advisories +func (s *SecurityAdvisoriesService) ListRepositorySecurityAdvisories(ctx context.Context, owner, repo string, opt *ListRepositorySecurityAdvisoriesOptions) ([]*SecurityAdvisory, *Response, error) { + url := fmt.Sprintf("repos/%v/%v/security-advisories", owner, repo) + url, err := addOptions(url, opt) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", url, nil) + if err != nil { + return nil, nil, err + } + + var advisories []*SecurityAdvisory + resp, err := s.client.Do(ctx, req, &advisories) + if err != nil { + return nil, resp, err + } + + return advisories, resp, nil +} diff --git a/github/security_advisories_test.go b/github/security_advisories_test.go index e4a6fbd7c14..5476ef6138f 100644 --- a/github/security_advisories_test.go +++ b/github/security_advisories_test.go @@ -8,7 +8,10 @@ package github import ( "context" "net/http" + "strings" "testing" + + "github.com/google/go-cmp/cmp" ) func TestSecurityAdvisoriesService_RequestCVE(t *testing.T) { @@ -50,3 +53,265 @@ func TestSecurityAdvisoriesService_RequestCVE(t *testing.T) { return resp, err }) } + +func TestSecurityAdvisoriesService_ListRepositorySecurityAdvisoriesForOrg_BadRequest(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/orgs/o/security-advisories", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + + http.Error(w, "Bad Request", 400) + }) + + ctx := context.Background() + advisories, resp, err := client.SecurityAdvisories.ListRepositorySecurityAdvisoriesForOrg(ctx, "o", nil) + if err == nil { + t.Errorf("Expected HTTP 400 response") + } + if got, want := resp.Response.StatusCode, http.StatusBadRequest; got != want { + t.Errorf("ListRepositorySecurityAdvisoriesForOrg return status %d, want %d", got, want) + } + if advisories != nil { + t.Errorf("ListRepositorySecurityAdvisoriesForOrg return %+v, want nil", advisories) + } +} + +func TestSecurityAdvisoriesService_ListRepositorySecurityAdvisoriesForOrg_NotFound(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/orgs/o/security-advisories", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + + query := r.URL.Query() + if query.Get("state") != "draft" { + t.Errorf("ListRepositorySecurityAdvisoriesForOrg returned %+v, want %+v", query.Get("state"), "draft") + } + + http.NotFound(w, r) + }) + + ctx := context.Background() + advisories, resp, err := client.SecurityAdvisories.ListRepositorySecurityAdvisoriesForOrg(ctx, "o", &ListRepositorySecurityAdvisoriesOptions{ + State: "draft", + }) + if err == nil { + t.Errorf("Expected HTTP 404 response") + } + if got, want := resp.Response.StatusCode, http.StatusNotFound; got != want { + t.Errorf("ListRepositorySecurityAdvisoriesForOrg return status %d, want %d", got, want) + } + if advisories != nil { + t.Errorf("ListRepositorySecurityAdvisoriesForOrg return %+v, want nil", advisories) + } +} + +func TestSecurityAdvisoriesService_ListRepositorySecurityAdvisoriesForOrg_UnmarshalError(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/orgs/o/security-advisories", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + + w.WriteHeader(http.StatusOK) + assertWrite(t, w, []byte(`[{"ghsa_id": 12334354}]`)) + }) + + ctx := context.Background() + advisories, resp, err := client.SecurityAdvisories.ListRepositorySecurityAdvisoriesForOrg(ctx, "o", nil) + if err == nil { + t.Errorf("Expected unmarshal error") + } else if !strings.Contains(err.Error(), "json: cannot unmarshal number into Go struct field SecurityAdvisory.ghsa_id of type string") { + t.Errorf("ListRepositorySecurityAdvisoriesForOrg returned unexpected error: %v", err) + } + if got, want := resp.Response.StatusCode, http.StatusOK; got != want { + t.Errorf("ListRepositorySecurityAdvisoriesForOrg return status %d, want %d", got, want) + } + if advisories != nil { + t.Errorf("ListRepositorySecurityAdvisoriesForOrg return %+v, want nil", advisories) + } +} + +func TestSecurityAdvisoriesService_ListRepositorySecurityAdvisoriesForOrg(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/orgs/o/security-advisories", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + + w.WriteHeader(http.StatusOK) + assertWrite(t, w, []byte(`[ + { + "ghsa_id": "GHSA-abcd-1234-efgh", + "cve_id": "CVE-2050-00000" + } + ]`)) + }) + + ctx := context.Background() + advisories, resp, err := client.SecurityAdvisories.ListRepositorySecurityAdvisoriesForOrg(ctx, "o", nil) + if err != nil { + t.Errorf("ListRepositorySecurityAdvisoriesForOrg returned error: %v, want nil", err) + } + if got, want := resp.Response.StatusCode, http.StatusOK; got != want { + t.Errorf("ListRepositorySecurityAdvisoriesForOrg return status %d, want %d", got, want) + } + + want := []*SecurityAdvisory{ + { + GHSAID: String("GHSA-abcd-1234-efgh"), + CVEID: String("CVE-2050-00000"), + }, + } + if !cmp.Equal(advisories, want) { + t.Errorf("ListRepositorySecurityAdvisoriesForOrg returned %+v, want %+v", advisories, want) + } + + methodName := "ListRepositorySecurityAdvisoriesForOrg" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.SecurityAdvisories.ListRepositorySecurityAdvisoriesForOrg(ctx, "\n", &ListRepositorySecurityAdvisoriesOptions{ + Sort: "\n", + }) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.SecurityAdvisories.ListRepositorySecurityAdvisoriesForOrg(ctx, "o", nil) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestSecurityAdvisoriesService_ListRepositorySecurityAdvisories_BadRequest(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/repos/o/r/security-advisories", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + + http.Error(w, "Bad Request", 400) + }) + + ctx := context.Background() + advisories, resp, err := client.SecurityAdvisories.ListRepositorySecurityAdvisories(ctx, "o", "r", nil) + if err == nil { + t.Errorf("Expected HTTP 400 response") + } + if got, want := resp.Response.StatusCode, http.StatusBadRequest; got != want { + t.Errorf("ListRepositorySecurityAdvisories return status %d, want %d", got, want) + } + if advisories != nil { + t.Errorf("ListRepositorySecurityAdvisories return %+v, want nil", advisories) + } +} + +func TestSecurityAdvisoriesService_ListRepositorySecurityAdvisories_NotFound(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/repos/o/r/security-advisories", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + + query := r.URL.Query() + if query.Get("state") != "draft" { + t.Errorf("ListRepositorySecurityAdvisories returned %+v, want %+v", query.Get("state"), "draft") + } + + http.NotFound(w, r) + }) + + ctx := context.Background() + advisories, resp, err := client.SecurityAdvisories.ListRepositorySecurityAdvisories(ctx, "o", "r", &ListRepositorySecurityAdvisoriesOptions{ + State: "draft", + }) + if err == nil { + t.Errorf("Expected HTTP 404 response") + } + if got, want := resp.Response.StatusCode, http.StatusNotFound; got != want { + t.Errorf("ListRepositorySecurityAdvisories return status %d, want %d", got, want) + } + if advisories != nil { + t.Errorf("ListRepositorySecurityAdvisories return %+v, want nil", advisories) + } +} + +func TestSecurityAdvisoriesService_ListRepositorySecurityAdvisories_UnmarshalError(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/repos/o/r/security-advisories", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + + w.WriteHeader(http.StatusOK) + assertWrite(t, w, []byte(`[{"ghsa_id": 12334354}]`)) + }) + + ctx := context.Background() + advisories, resp, err := client.SecurityAdvisories.ListRepositorySecurityAdvisories(ctx, "o", "r", nil) + if err == nil { + t.Errorf("Expected unmarshal error") + } else if !strings.Contains(err.Error(), "json: cannot unmarshal number into Go struct field SecurityAdvisory.ghsa_id of type string") { + t.Errorf("ListRepositorySecurityAdvisories returned unexpected error: %v", err) + } + if got, want := resp.Response.StatusCode, http.StatusOK; got != want { + t.Errorf("ListRepositorySecurityAdvisories return status %d, want %d", got, want) + } + if advisories != nil { + t.Errorf("ListRepositorySecurityAdvisories return %+v, want nil", advisories) + } +} + +func TestSecurityAdvisoriesService_ListRepositorySecurityAdvisories(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/repos/o/r/security-advisories", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + + w.WriteHeader(http.StatusOK) + assertWrite(t, w, []byte(`[ + { + "ghsa_id": "GHSA-abcd-1234-efgh", + "cve_id": "CVE-2050-00000" + } + ]`)) + }) + + ctx := context.Background() + advisories, resp, err := client.SecurityAdvisories.ListRepositorySecurityAdvisories(ctx, "o", "r", nil) + if err != nil { + t.Errorf("ListRepositorySecurityAdvisories returned error: %v, want nil", err) + } + if got, want := resp.Response.StatusCode, http.StatusOK; got != want { + t.Errorf("ListRepositorySecurityAdvisories return status %d, want %d", got, want) + } + + want := []*SecurityAdvisory{ + { + GHSAID: String("GHSA-abcd-1234-efgh"), + CVEID: String("CVE-2050-00000"), + }, + } + if !cmp.Equal(advisories, want) { + t.Errorf("ListRepositorySecurityAdvisories returned %+v, want %+v", advisories, want) + } + + methodName := "ListRepositorySecurityAdvisories" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.SecurityAdvisories.ListRepositorySecurityAdvisories(ctx, "\n", "\n", &ListRepositorySecurityAdvisoriesOptions{ + Sort: "\n", + }) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.SecurityAdvisories.ListRepositorySecurityAdvisories(ctx, "o", "r", nil) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} From f8c16b85c03b20c979787e1d01336517dbd1b6e1 Mon Sep 17 00:00:00 2001 From: WillAbides <233500+WillAbides@users.noreply.github.com> Date: Mon, 9 Oct 2023 06:56:57 -0500 Subject: [PATCH 036/145] Create MarkdownService, EmojisService, CodesOfConductService and MetaService (#2937) Fixes: #2936. --- github/codesofconduct.go | 81 ++++++++ github/codesofconduct_test.go | 117 +++++++++++ github/emojis.go | 37 ++++ github/emojis_test.go | 45 +++++ github/examples_test.go | 4 +- github/github.go | 8 + github/markdown.go | 67 +++++++ github/markdown_test.go | 80 ++++++++ github/meta.go | 146 ++++++++++++++ github/meta_test.go | 155 +++++++++++++++ github/misc.go | 247 ----------------------- github/misc_test.go | 356 ---------------------------------- test/integration/misc_test.go | 16 +- 13 files changed, 746 insertions(+), 613 deletions(-) create mode 100644 github/codesofconduct.go create mode 100644 github/codesofconduct_test.go create mode 100644 github/emojis.go create mode 100644 github/emojis_test.go create mode 100644 github/markdown.go create mode 100644 github/markdown_test.go create mode 100644 github/meta.go create mode 100644 github/meta_test.go delete mode 100644 github/misc.go delete mode 100644 github/misc_test.go diff --git a/github/codesofconduct.go b/github/codesofconduct.go new file mode 100644 index 00000000000..4318ba56d2c --- /dev/null +++ b/github/codesofconduct.go @@ -0,0 +1,81 @@ +// Copyright 2023 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// CodesOfConductService provides access to code-of-conduct-related functions in the GitHub API. +type CodesOfConductService service + +// CodeOfConduct represents a code of conduct. +type CodeOfConduct struct { + Name *string `json:"name,omitempty"` + Key *string `json:"key,omitempty"` + URL *string `json:"url,omitempty"` + Body *string `json:"body,omitempty"` +} + +func (c *CodeOfConduct) String() string { + return Stringify(c) +} + +// List returns all codes of conduct. +// +// GitHub API docs: https://docs.github.com/rest/codes-of-conduct/codes-of-conduct#get-all-codes-of-conduct +func (s *CodesOfConductService) List(ctx context.Context) ([]*CodeOfConduct, *Response, error) { + req, err := s.client.NewRequest("GET", "codes_of_conduct", nil) + if err != nil { + return nil, nil, err + } + + // TODO: remove custom Accept header when this API fully launches. + req.Header.Set("Accept", mediaTypeCodesOfConductPreview) + + var cs []*CodeOfConduct + resp, err := s.client.Do(ctx, req, &cs) + if err != nil { + return nil, resp, err + } + + return cs, resp, nil +} + +// ListCodesOfConduct +// Deprecated: Use CodesOfConductService.List instead +func (c *Client) ListCodesOfConduct(ctx context.Context) ([]*CodeOfConduct, *Response, error) { + return c.CodesOfConduct.List(ctx) +} + +// Get returns an individual code of conduct. +// +// GitHub API docs: https://docs.github.com/rest/codes-of-conduct/codes-of-conduct#get-a-code-of-conduct +func (s *CodesOfConductService) Get(ctx context.Context, key string) (*CodeOfConduct, *Response, error) { + u := fmt.Sprintf("codes_of_conduct/%s", key) + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + // TODO: remove custom Accept header when this API fully launches. + req.Header.Set("Accept", mediaTypeCodesOfConductPreview) + + coc := new(CodeOfConduct) + resp, err := s.client.Do(ctx, req, coc) + if err != nil { + return nil, resp, err + } + + return coc, resp, nil +} + +// GetCodeOfConduct +// Deprecated: Use CodesOfConductService.Get instead +func (c *Client) GetCodeOfConduct(ctx context.Context, key string) (*CodeOfConduct, *Response, error) { + return c.CodesOfConduct.Get(ctx, key) +} diff --git a/github/codesofconduct_test.go b/github/codesofconduct_test.go new file mode 100644 index 00000000000..71ef31f7afd --- /dev/null +++ b/github/codesofconduct_test.go @@ -0,0 +1,117 @@ +// Copyright 2023 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" + "net/http" + "testing" + + "github.com/google/go-cmp/cmp" +) + +func TestCodesOfConductService_List(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/codes_of_conduct", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + testHeader(t, r, "Accept", mediaTypeCodesOfConductPreview) + fmt.Fprint(w, `[{ + "key": "key", + "name": "name", + "url": "url"} + ]`) + }) + + ctx := context.Background() + cs, _, err := client.ListCodesOfConduct(ctx) + assertNilError(t, err) + + want := []*CodeOfConduct{ + { + Key: String("key"), + Name: String("name"), + URL: String("url"), + }} + if !cmp.Equal(want, cs) { + t.Errorf("returned %+v, want %+v", cs, want) + } + + const methodName = "List" + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.CodesOfConduct.List(ctx) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestCodesOfConductService_Get(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/codes_of_conduct/k", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + testHeader(t, r, "Accept", mediaTypeCodesOfConductPreview) + fmt.Fprint(w, `{ + "key": "key", + "name": "name", + "url": "url", + "body": "body"}`, + ) + }) + + ctx := context.Background() + coc, _, err := client.GetCodeOfConduct(ctx, "k") + assertNilError(t, err) + + want := &CodeOfConduct{ + Key: String("key"), + Name: String("name"), + URL: String("url"), + Body: String("body"), + } + if !cmp.Equal(want, coc) { + t.Errorf("returned %+v, want %+v", coc, want) + } + + const methodName = "Get" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.CodesOfConduct.Get(ctx, "\n") + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.CodesOfConduct.Get(ctx, "k") + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestCodeOfConduct_Marshal(t *testing.T) { + testJSONMarshal(t, &CodeOfConduct{}, "{}") + + a := &CodeOfConduct{ + Name: String("name"), + Key: String("key"), + URL: String("url"), + Body: String("body"), + } + + want := `{ + "name": "name", + "key": "key", + "url": "url", + "body": "body" + }` + + testJSONMarshal(t, a, want) +} diff --git a/github/emojis.go b/github/emojis.go new file mode 100644 index 00000000000..15b57130b3b --- /dev/null +++ b/github/emojis.go @@ -0,0 +1,37 @@ +// Copyright 2023 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" +) + +// EmojisService provides access to emoji-related functions in the GitHub API. +type EmojisService service + +// List returns the emojis available to use on GitHub. +// +// GitHub API docs: https://docs.github.com/rest/emojis/emojis#get-emojis +func (s *EmojisService) List(ctx context.Context) (map[string]string, *Response, error) { + req, err := s.client.NewRequest("GET", "emojis", nil) + if err != nil { + return nil, nil, err + } + + var emoji map[string]string + resp, err := s.client.Do(ctx, req, &emoji) + if err != nil { + return nil, resp, err + } + + return emoji, resp, nil +} + +// ListEmojis +// Deprecated: Use EmojisService.List instead +func (c *Client) ListEmojis(ctx context.Context) (map[string]string, *Response, error) { + return c.Emojis.List(ctx) +} diff --git a/github/emojis_test.go b/github/emojis_test.go new file mode 100644 index 00000000000..79c890e36d1 --- /dev/null +++ b/github/emojis_test.go @@ -0,0 +1,45 @@ +// Copyright 2023 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" + "net/http" + "testing" + + "github.com/google/go-cmp/cmp" +) + +func TestEmojisService_List(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/emojis", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + fmt.Fprint(w, `{"+1": "+1.png"}`) + }) + + ctx := context.Background() + emoji, _, err := client.ListEmojis(ctx) + if err != nil { + t.Errorf("List returned error: %v", err) + } + + want := map[string]string{"+1": "+1.png"} + if !cmp.Equal(want, emoji) { + t.Errorf("List returned %+v, want %+v", emoji, want) + } + + const methodName = "List" + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Emojis.List(ctx) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} diff --git a/github/examples_test.go b/github/examples_test.go index a2147bf417f..4aca86218fa 100644 --- a/github/examples_test.go +++ b/github/examples_test.go @@ -15,14 +15,14 @@ import ( "github.com/google/go-github/v55/github" ) -func ExampleClient_Markdown() { +func ExampleMarkdownService_Render() { client := github.NewClient(nil) input := "# heading #\n\nLink to issue #1" opt := &github.MarkdownOptions{Mode: "gfm", Context: "google/go-github"} ctx := context.Background() - output, _, err := client.Markdown(ctx, input, opt) + output, _, err := client.Markdown.Render(ctx, input, opt) if err != nil { fmt.Println(err) } diff --git a/github/github.go b/github/github.go index dace1184719..519f3f31a37 100644 --- a/github/github.go +++ b/github/github.go @@ -183,9 +183,11 @@ type Client struct { Billing *BillingService Checks *ChecksService CodeScanning *CodeScanningService + CodesOfConduct *CodesOfConductService Codespaces *CodespacesService Dependabot *DependabotService DependencyGraph *DependencyGraphService + Emojis *EmojisService Enterprise *EnterpriseService Gists *GistsService Git *GitService @@ -194,7 +196,9 @@ type Client struct { IssueImport *IssueImportService Issues *IssuesService Licenses *LicensesService + Markdown *MarkdownService Marketplace *MarketplaceService + Meta *MetaService Migrations *MigrationService Organizations *OrganizationsService Projects *ProjectsService @@ -401,8 +405,10 @@ func (c *Client) initialize() { c.Checks = (*ChecksService)(&c.common) c.CodeScanning = (*CodeScanningService)(&c.common) c.Codespaces = (*CodespacesService)(&c.common) + c.CodesOfConduct = (*CodesOfConductService)(&c.common) c.Dependabot = (*DependabotService)(&c.common) c.DependencyGraph = (*DependencyGraphService)(&c.common) + c.Emojis = (*EmojisService)(&c.common) c.Enterprise = (*EnterpriseService)(&c.common) c.Gists = (*GistsService)(&c.common) c.Git = (*GitService)(&c.common) @@ -411,7 +417,9 @@ func (c *Client) initialize() { c.IssueImport = (*IssueImportService)(&c.common) c.Issues = (*IssuesService)(&c.common) c.Licenses = (*LicensesService)(&c.common) + c.Markdown = (*MarkdownService)(&c.common) c.Marketplace = &MarketplaceService{client: c} + c.Meta = (*MetaService)(&c.common) c.Migrations = (*MigrationService)(&c.common) c.Organizations = (*OrganizationsService)(&c.common) c.Projects = (*ProjectsService)(&c.common) diff --git a/github/markdown.go b/github/markdown.go new file mode 100644 index 00000000000..48b445b3d85 --- /dev/null +++ b/github/markdown.go @@ -0,0 +1,67 @@ +// Copyright 2023 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "bytes" + "context" +) + +// MarkdownService provides access to markdown-related functions in the GitHub API. +type MarkdownService service + +// MarkdownOptions specifies optional parameters to the Render method. +type MarkdownOptions struct { + // Mode identifies the rendering mode. Possible values are: + // markdown - render a document as plain Render, just like + // README files are rendered. + // + // gfm - to render a document as user-content, e.g. like user + // comments or issues are rendered. In GFM mode, hard line breaks are + // always taken into account, and issue and user mentions are linked + // accordingly. + // + // Default is "markdown". + Mode string + + // Context identifies the repository context. Only taken into account + // when rendering as "gfm". + Context string +} + +type markdownRenderRequest struct { + Text *string `json:"text,omitempty"` + Mode *string `json:"mode,omitempty"` + Context *string `json:"context,omitempty"` +} + +// Render renders an arbitrary Render document. +// +// GitHub API docs: https://docs.github.com/rest/markdown/markdown#render-a-markdown-document +func (s *MarkdownService) Render(ctx context.Context, text string, opts *MarkdownOptions) (string, *Response, error) { + request := &markdownRenderRequest{Text: String(text)} + if opts != nil { + if opts.Mode != "" { + request.Mode = String(opts.Mode) + } + if opts.Context != "" { + request.Context = String(opts.Context) + } + } + + req, err := s.client.NewRequest("POST", "markdown", request) + if err != nil { + return "", nil, err + } + + buf := new(bytes.Buffer) + resp, err := s.client.Do(ctx, req, buf) + if err != nil { + return "", resp, err + } + + return buf.String(), resp, nil +} diff --git a/github/markdown_test.go b/github/markdown_test.go new file mode 100644 index 00000000000..2b6e7eee48e --- /dev/null +++ b/github/markdown_test.go @@ -0,0 +1,80 @@ +// Copyright 2023 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + "testing" + + "github.com/google/go-cmp/cmp" +) + +func TestMarkdownService_Markdown(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + input := &markdownRenderRequest{ + Text: String("# text #"), + Mode: String("gfm"), + Context: String("google/go-github"), + } + mux.HandleFunc("/markdown", func(w http.ResponseWriter, r *http.Request) { + v := new(markdownRenderRequest) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) + + testMethod(t, r, "POST") + if !cmp.Equal(v, input) { + t.Errorf("Request body = %+v, want %+v", v, input) + } + fmt.Fprint(w, `

text

`) + }) + + ctx := context.Background() + md, _, err := client.Markdown.Render(ctx, "# text #", &MarkdownOptions{ + Mode: "gfm", + Context: "google/go-github", + }) + if err != nil { + t.Errorf("Render returned error: %v", err) + } + + if want := "

text

"; want != md { + t.Errorf("Render returned %+v, want %+v", md, want) + } + + const methodName = "Render" + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Markdown.Render(ctx, "# text #", &MarkdownOptions{ + Mode: "gfm", + Context: "google/go-github", + }) + if got != "" { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestMarkdownRenderRequest_Marshal(t *testing.T) { + testJSONMarshal(t, &markdownRenderRequest{}, "{}") + + a := &markdownRenderRequest{ + Text: String("txt"), + Mode: String("mode"), + Context: String("ctx"), + } + + want := `{ + "text": "txt", + "mode": "mode", + "context": "ctx" + }` + + testJSONMarshal(t, a, want) +} diff --git a/github/meta.go b/github/meta.go new file mode 100644 index 00000000000..a4d9bac77b4 --- /dev/null +++ b/github/meta.go @@ -0,0 +1,146 @@ +// Copyright 2014 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "bytes" + "context" + "fmt" + "net/url" +) + +// MetaService provides access to functions in the GitHub API that GitHub categorizes as "meta". +type MetaService service + +// APIMeta represents metadata about the GitHub API. +type APIMeta struct { + // An Array of IP addresses in CIDR format specifying the addresses + // that incoming service hooks will originate from on GitHub.com. + Hooks []string `json:"hooks,omitempty"` + + // An Array of IP addresses in CIDR format specifying the Git servers + // for GitHub.com. + Git []string `json:"git,omitempty"` + + // Whether authentication with username and password is supported. + // (GitHub Enterprise instances using CAS or OAuth for authentication + // will return false. Features like Basic Authentication with a + // username and password, sudo mode, and two-factor authentication are + // not supported on these servers.) + VerifiablePasswordAuthentication *bool `json:"verifiable_password_authentication,omitempty"` + + // An array of IP addresses in CIDR format specifying the addresses + // which serve GitHub Pages websites. + Pages []string `json:"pages,omitempty"` + + // An Array of IP addresses specifying the addresses that source imports + // will originate from on GitHub.com. + Importer []string `json:"importer,omitempty"` + + // An array of IP addresses in CIDR format specifying the IP addresses + // GitHub Actions will originate from. + Actions []string `json:"actions,omitempty"` + + // An array of IP addresses in CIDR format specifying the IP addresses + // Dependabot will originate from. + Dependabot []string `json:"dependabot,omitempty"` + + // A map of algorithms to SSH key fingerprints. + SSHKeyFingerprints map[string]string `json:"ssh_key_fingerprints,omitempty"` + + // An array of SSH keys. + SSHKeys []string `json:"ssh_keys,omitempty"` + + // An array of IP addresses in CIDR format specifying the addresses + // which serve GitHub websites. + Web []string `json:"web,omitempty"` + + // An array of IP addresses in CIDR format specifying the addresses + // which serve GitHub APIs. + API []string `json:"api,omitempty"` +} + +// Get returns information about GitHub.com, the service. Or, if you access +// this endpoint on your organization’s GitHub Enterprise installation, this +// endpoint provides information about that installation. +// +// GitHub API docs: https://docs.github.com/rest/meta/meta#get-github-meta-information +func (s *MetaService) Get(ctx context.Context) (*APIMeta, *Response, error) { + req, err := s.client.NewRequest("GET", "meta", nil) + if err != nil { + return nil, nil, err + } + + meta := new(APIMeta) + resp, err := s.client.Do(ctx, req, meta) + if err != nil { + return nil, resp, err + } + + return meta, resp, nil +} + +// APIMeta +// Deprecated: Use MetaService.Get instead. +func (c *Client) APIMeta(ctx context.Context) (*APIMeta, *Response, error) { + return c.Meta.Get(ctx) +} + +// Octocat returns an ASCII art octocat with the specified message in a speech +// bubble. If message is empty, a random zen phrase is used. +// +// GitHub API docs: https://docs.github.com/rest/meta/meta#get-octocat +func (s *MetaService) Octocat(ctx context.Context, message string) (string, *Response, error) { + u := "octocat" + if message != "" { + u = fmt.Sprintf("%s?s=%s", u, url.QueryEscape(message)) + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return "", nil, err + } + + buf := new(bytes.Buffer) + resp, err := s.client.Do(ctx, req, buf) + if err != nil { + return "", resp, err + } + + return buf.String(), resp, nil +} + +// Octocat +// Deprecated: Use MetaService.Octocat instead. +func (c *Client) Octocat(ctx context.Context, message string) (string, *Response, error) { + return c.Meta.Octocat(ctx, message) +} + +// Zen returns a random line from The Zen of GitHub. +// +// See also: http://warpspire.com/posts/taste/ +// +// GitHub API docs: https://docs.github.com/rest/meta/meta#get-the-zen-of-github +func (s *MetaService) Zen(ctx context.Context) (string, *Response, error) { + req, err := s.client.NewRequest("GET", "zen", nil) + if err != nil { + return "", nil, err + } + + buf := new(bytes.Buffer) + resp, err := s.client.Do(ctx, req, buf) + if err != nil { + return "", resp, err + } + + return buf.String(), resp, nil +} + +// Zen +// Deprecated: Use MetaService.Zen instead. +func (c *Client) Zen(ctx context.Context) (string, *Response, error) { + return c.Meta.Zen(ctx) +} diff --git a/github/meta_test.go b/github/meta_test.go new file mode 100644 index 00000000000..c7b01e298ed --- /dev/null +++ b/github/meta_test.go @@ -0,0 +1,155 @@ +// Copyright 2014 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" + "net/http" + "testing" + + "github.com/google/go-cmp/cmp" +) + +func TestAPIMeta_Marshal(t *testing.T) { + testJSONMarshal(t, &APIMeta{}, "{}") + + a := &APIMeta{ + Hooks: []string{"h"}, + Git: []string{"g"}, + VerifiablePasswordAuthentication: Bool(true), + Pages: []string{"p"}, + Importer: []string{"i"}, + Actions: []string{"a"}, + Dependabot: []string{"d"}, + SSHKeyFingerprints: map[string]string{"a": "f"}, + SSHKeys: []string{"k"}, + API: []string{"a"}, + Web: []string{"w"}, + } + want := `{ + "hooks":["h"], + "git":["g"], + "verifiable_password_authentication":true, + "pages":["p"], + "importer":["i"], + "actions":["a"], + "dependabot":["d"], + "ssh_key_fingerprints":{"a":"f"}, + "ssh_keys":["k"], + "api":["a"], + "web":["w"] + }` + + testJSONMarshal(t, a, want) +} + +func TestMetaService_Get(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/meta", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + fmt.Fprint(w, `{"web":["w"],"api":["a"],"hooks":["h"], "git":["g"], "pages":["p"], "importer":["i"], "actions":["a"], "dependabot":["d"], "verifiable_password_authentication": true}`) + }) + + ctx := context.Background() + meta, _, err := client.Meta.Get(ctx) + if err != nil { + t.Errorf("Get returned error: %v", err) + } + + want := &APIMeta{ + Hooks: []string{"h"}, + Git: []string{"g"}, + Pages: []string{"p"}, + Importer: []string{"i"}, + Actions: []string{"a"}, + Dependabot: []string{"d"}, + API: []string{"a"}, + Web: []string{"w"}, + + VerifiablePasswordAuthentication: Bool(true), + } + if !cmp.Equal(want, meta) { + t.Errorf("Get returned %+v, want %+v", meta, want) + } + + const methodName = "Get" + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Meta.Get(ctx) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestMetaService_Octocat(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + input := "input" + output := "sample text" + + mux.HandleFunc("/octocat", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + testFormValues(t, r, values{"s": input}) + w.Header().Set("Content-Type", "application/octocat-stream") + fmt.Fprint(w, output) + }) + + ctx := context.Background() + got, _, err := client.Meta.Octocat(ctx, input) + if err != nil { + t.Errorf("Octocat returned error: %v", err) + } + + if want := output; got != want { + t.Errorf("Octocat returned %+v, want %+v", got, want) + } + + const methodName = "Octocat" + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Meta.Octocat(ctx, input) + if got != "" { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestMetaService_Zen(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + output := "sample text" + + mux.HandleFunc("/zen", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + w.Header().Set("Content-Type", "text/plain;charset=utf-8") + fmt.Fprint(w, output) + }) + + ctx := context.Background() + got, _, err := client.Meta.Zen(ctx) + if err != nil { + t.Errorf("Zen returned error: %v", err) + } + + if want := output; got != want { + t.Errorf("Zen returned %+v, want %+v", got, want) + } + + const methodName = "Zen" + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Meta.Zen(ctx) + if got != "" { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} diff --git a/github/misc.go b/github/misc.go deleted file mode 100644 index a01b716fa23..00000000000 --- a/github/misc.go +++ /dev/null @@ -1,247 +0,0 @@ -// Copyright 2014 The go-github AUTHORS. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package github - -import ( - "bytes" - "context" - "fmt" - "net/url" -) - -// MarkdownOptions specifies optional parameters to the Markdown method. -type MarkdownOptions struct { - // Mode identifies the rendering mode. Possible values are: - // markdown - render a document as plain Markdown, just like - // README files are rendered. - // - // gfm - to render a document as user-content, e.g. like user - // comments or issues are rendered. In GFM mode, hard line breaks are - // always taken into account, and issue and user mentions are linked - // accordingly. - // - // Default is "markdown". - Mode string - - // Context identifies the repository context. Only taken into account - // when rendering as "gfm". - Context string -} - -type markdownRequest struct { - Text *string `json:"text,omitempty"` - Mode *string `json:"mode,omitempty"` - Context *string `json:"context,omitempty"` -} - -// Markdown renders an arbitrary Markdown document. -// -// GitHub API docs: https://docs.github.com/en/rest/markdown/ -func (c *Client) Markdown(ctx context.Context, text string, opts *MarkdownOptions) (string, *Response, error) { - request := &markdownRequest{Text: String(text)} - if opts != nil { - if opts.Mode != "" { - request.Mode = String(opts.Mode) - } - if opts.Context != "" { - request.Context = String(opts.Context) - } - } - - req, err := c.NewRequest("POST", "markdown", request) - if err != nil { - return "", nil, err - } - - buf := new(bytes.Buffer) - resp, err := c.Do(ctx, req, buf) - if err != nil { - return "", resp, err - } - - return buf.String(), resp, nil -} - -// ListEmojis returns the emojis available to use on GitHub. -// -// GitHub API docs: https://docs.github.com/en/rest/emojis/ -func (c *Client) ListEmojis(ctx context.Context) (map[string]string, *Response, error) { - req, err := c.NewRequest("GET", "emojis", nil) - if err != nil { - return nil, nil, err - } - - var emoji map[string]string - resp, err := c.Do(ctx, req, &emoji) - if err != nil { - return nil, resp, err - } - - return emoji, resp, nil -} - -// CodeOfConduct represents a code of conduct. -type CodeOfConduct struct { - Name *string `json:"name,omitempty"` - Key *string `json:"key,omitempty"` - URL *string `json:"url,omitempty"` - Body *string `json:"body,omitempty"` -} - -func (c *CodeOfConduct) String() string { - return Stringify(c) -} - -// ListCodesOfConduct returns all codes of conduct. -// -// GitHub API docs: https://docs.github.com/en/rest/codes_of_conduct/#list-all-codes-of-conduct -func (c *Client) ListCodesOfConduct(ctx context.Context) ([]*CodeOfConduct, *Response, error) { - req, err := c.NewRequest("GET", "codes_of_conduct", nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeCodesOfConductPreview) - - var cs []*CodeOfConduct - resp, err := c.Do(ctx, req, &cs) - if err != nil { - return nil, resp, err - } - - return cs, resp, nil -} - -// GetCodeOfConduct returns an individual code of conduct. -// -// https://docs.github.com/en/rest/codes_of_conduct/#get-an-individual-code-of-conduct -func (c *Client) GetCodeOfConduct(ctx context.Context, key string) (*CodeOfConduct, *Response, error) { - u := fmt.Sprintf("codes_of_conduct/%s", key) - req, err := c.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept header when this API fully launches. - req.Header.Set("Accept", mediaTypeCodesOfConductPreview) - - coc := new(CodeOfConduct) - resp, err := c.Do(ctx, req, coc) - if err != nil { - return nil, resp, err - } - - return coc, resp, nil -} - -// APIMeta represents metadata about the GitHub API. -type APIMeta struct { - // An Array of IP addresses in CIDR format specifying the addresses - // that incoming service hooks will originate from on GitHub.com. - Hooks []string `json:"hooks,omitempty"` - - // An Array of IP addresses in CIDR format specifying the Git servers - // for GitHub.com. - Git []string `json:"git,omitempty"` - - // Whether authentication with username and password is supported. - // (GitHub Enterprise instances using CAS or OAuth for authentication - // will return false. Features like Basic Authentication with a - // username and password, sudo mode, and two-factor authentication are - // not supported on these servers.) - VerifiablePasswordAuthentication *bool `json:"verifiable_password_authentication,omitempty"` - - // An array of IP addresses in CIDR format specifying the addresses - // which serve GitHub Pages websites. - Pages []string `json:"pages,omitempty"` - - // An Array of IP addresses specifying the addresses that source imports - // will originate from on GitHub.com. - Importer []string `json:"importer,omitempty"` - - // An array of IP addresses in CIDR format specifying the IP addresses - // GitHub Actions will originate from. - Actions []string `json:"actions,omitempty"` - - // An array of IP addresses in CIDR format specifying the IP addresses - // Dependabot will originate from. - Dependabot []string `json:"dependabot,omitempty"` - - // A map of algorithms to SSH key fingerprints. - SSHKeyFingerprints map[string]string `json:"ssh_key_fingerprints,omitempty"` - - // An array of SSH keys. - SSHKeys []string `json:"ssh_keys,omitempty"` - - // An array of IP addresses in CIDR format specifying the addresses - // which serve GitHub websites. - Web []string `json:"web,omitempty"` - - // An array of IP addresses in CIDR format specifying the addresses - // which serve GitHub APIs. - API []string `json:"api,omitempty"` -} - -// APIMeta returns information about GitHub.com, the service. Or, if you access -// this endpoint on your organization’s GitHub Enterprise installation, this -// endpoint provides information about that installation. -// -// GitHub API docs: https://docs.github.com/en/rest/meta#get-github-meta-information -func (c *Client) APIMeta(ctx context.Context) (*APIMeta, *Response, error) { - req, err := c.NewRequest("GET", "meta", nil) - if err != nil { - return nil, nil, err - } - - meta := new(APIMeta) - resp, err := c.Do(ctx, req, meta) - if err != nil { - return nil, resp, err - } - - return meta, resp, nil -} - -// Octocat returns an ASCII art octocat with the specified message in a speech -// bubble. If message is empty, a random zen phrase is used. -func (c *Client) Octocat(ctx context.Context, message string) (string, *Response, error) { - u := "octocat" - if message != "" { - u = fmt.Sprintf("%s?s=%s", u, url.QueryEscape(message)) - } - - req, err := c.NewRequest("GET", u, nil) - if err != nil { - return "", nil, err - } - - buf := new(bytes.Buffer) - resp, err := c.Do(ctx, req, buf) - if err != nil { - return "", resp, err - } - - return buf.String(), resp, nil -} - -// Zen returns a random line from The Zen of GitHub. -// -// see also: http://warpspire.com/posts/taste/ -func (c *Client) Zen(ctx context.Context) (string, *Response, error) { - req, err := c.NewRequest("GET", "zen", nil) - if err != nil { - return "", nil, err - } - - buf := new(bytes.Buffer) - resp, err := c.Do(ctx, req, buf) - if err != nil { - return "", resp, err - } - - return buf.String(), resp, nil -} diff --git a/github/misc_test.go b/github/misc_test.go deleted file mode 100644 index 45c99893812..00000000000 --- a/github/misc_test.go +++ /dev/null @@ -1,356 +0,0 @@ -// Copyright 2014 The go-github AUTHORS. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package github - -import ( - "context" - "encoding/json" - "fmt" - "net/http" - "testing" - - "github.com/google/go-cmp/cmp" -) - -func TestMarkdown(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() - - input := &markdownRequest{ - Text: String("# text #"), - Mode: String("gfm"), - Context: String("google/go-github"), - } - mux.HandleFunc("/markdown", func(w http.ResponseWriter, r *http.Request) { - v := new(markdownRequest) - assertNilError(t, json.NewDecoder(r.Body).Decode(v)) - - testMethod(t, r, "POST") - if !cmp.Equal(v, input) { - t.Errorf("Request body = %+v, want %+v", v, input) - } - fmt.Fprint(w, `

text

`) - }) - - ctx := context.Background() - md, _, err := client.Markdown(ctx, "# text #", &MarkdownOptions{ - Mode: "gfm", - Context: "google/go-github", - }) - if err != nil { - t.Errorf("Markdown returned error: %v", err) - } - - if want := "

text

"; want != md { - t.Errorf("Markdown returned %+v, want %+v", md, want) - } - - const methodName = "Markdown" - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Markdown(ctx, "# text #", &MarkdownOptions{ - Mode: "gfm", - Context: "google/go-github", - }) - if got != "" { - t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) - } - return resp, err - }) -} - -func TestListEmojis(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() - - mux.HandleFunc("/emojis", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, `{"+1": "+1.png"}`) - }) - - ctx := context.Background() - emoji, _, err := client.ListEmojis(ctx) - if err != nil { - t.Errorf("ListEmojis returned error: %v", err) - } - - want := map[string]string{"+1": "+1.png"} - if !cmp.Equal(want, emoji) { - t.Errorf("ListEmojis returned %+v, want %+v", emoji, want) - } - - const methodName = "ListEmojis" - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.ListEmojis(ctx) - if got != nil { - t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) - } - return resp, err - }) -} - -func TestListCodesOfConduct(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() - - mux.HandleFunc("/codes_of_conduct", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeCodesOfConductPreview) - fmt.Fprint(w, `[{ - "key": "key", - "name": "name", - "url": "url"} - ]`) - }) - - ctx := context.Background() - cs, _, err := client.ListCodesOfConduct(ctx) - if err != nil { - t.Errorf("ListCodesOfConduct returned error: %v", err) - } - - want := []*CodeOfConduct{ - { - Key: String("key"), - Name: String("name"), - URL: String("url"), - }} - if !cmp.Equal(want, cs) { - t.Errorf("ListCodesOfConduct returned %+v, want %+v", cs, want) - } - - const methodName = "ListCodesOfConduct" - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.ListCodesOfConduct(ctx) - if got != nil { - t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) - } - return resp, err - }) -} - -func TestGetCodeOfConduct(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() - - mux.HandleFunc("/codes_of_conduct/k", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - testHeader(t, r, "Accept", mediaTypeCodesOfConductPreview) - fmt.Fprint(w, `{ - "key": "key", - "name": "name", - "url": "url", - "body": "body"}`, - ) - }) - - ctx := context.Background() - coc, _, err := client.GetCodeOfConduct(ctx, "k") - if err != nil { - t.Errorf("ListCodesOfConduct returned error: %v", err) - } - - want := &CodeOfConduct{ - Key: String("key"), - Name: String("name"), - URL: String("url"), - Body: String("body"), - } - if !cmp.Equal(want, coc) { - t.Errorf("GetCodeOfConductByKey returned %+v, want %+v", coc, want) - } - - const methodName = "GetCodeOfConduct" - testBadOptions(t, methodName, func() (err error) { - _, _, err = client.GetCodeOfConduct(ctx, "\n") - return err - }) - - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.GetCodeOfConduct(ctx, "k") - if got != nil { - t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) - } - return resp, err - }) -} - -func TestAPIMeta_Marshal(t *testing.T) { - testJSONMarshal(t, &APIMeta{}, "{}") - - a := &APIMeta{ - Hooks: []string{"h"}, - Git: []string{"g"}, - VerifiablePasswordAuthentication: Bool(true), - Pages: []string{"p"}, - Importer: []string{"i"}, - Actions: []string{"a"}, - Dependabot: []string{"d"}, - SSHKeyFingerprints: map[string]string{"a": "f"}, - SSHKeys: []string{"k"}, - API: []string{"a"}, - Web: []string{"w"}, - } - want := `{ - "hooks":["h"], - "git":["g"], - "verifiable_password_authentication":true, - "pages":["p"], - "importer":["i"], - "actions":["a"], - "dependabot":["d"], - "ssh_key_fingerprints":{"a":"f"}, - "ssh_keys":["k"], - "api":["a"], - "web":["w"] - }` - - testJSONMarshal(t, a, want) -} - -func TestAPIMeta(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() - - mux.HandleFunc("/meta", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, `{"web":["w"],"api":["a"],"hooks":["h"], "git":["g"], "pages":["p"], "importer":["i"], "actions":["a"], "dependabot":["d"], "verifiable_password_authentication": true}`) - }) - - ctx := context.Background() - meta, _, err := client.APIMeta(ctx) - if err != nil { - t.Errorf("APIMeta returned error: %v", err) - } - - want := &APIMeta{ - Hooks: []string{"h"}, - Git: []string{"g"}, - Pages: []string{"p"}, - Importer: []string{"i"}, - Actions: []string{"a"}, - Dependabot: []string{"d"}, - API: []string{"a"}, - Web: []string{"w"}, - - VerifiablePasswordAuthentication: Bool(true), - } - if !cmp.Equal(want, meta) { - t.Errorf("APIMeta returned %+v, want %+v", meta, want) - } - - const methodName = "APIMeta" - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.APIMeta(ctx) - if got != nil { - t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) - } - return resp, err - }) -} - -func TestOctocat(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() - - input := "input" - output := "sample text" - - mux.HandleFunc("/octocat", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - testFormValues(t, r, values{"s": input}) - w.Header().Set("Content-Type", "application/octocat-stream") - fmt.Fprint(w, output) - }) - - ctx := context.Background() - got, _, err := client.Octocat(ctx, input) - if err != nil { - t.Errorf("Octocat returned error: %v", err) - } - - if want := output; got != want { - t.Errorf("Octocat returned %+v, want %+v", got, want) - } - - const methodName = "Octocat" - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Octocat(ctx, input) - if got != "" { - t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) - } - return resp, err - }) -} - -func TestZen(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() - - output := "sample text" - - mux.HandleFunc("/zen", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - w.Header().Set("Content-Type", "text/plain;charset=utf-8") - fmt.Fprint(w, output) - }) - - ctx := context.Background() - got, _, err := client.Zen(ctx) - if err != nil { - t.Errorf("Zen returned error: %v", err) - } - - if want := output; got != want { - t.Errorf("Zen returned %+v, want %+v", got, want) - } - - const methodName = "Zen" - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Zen(ctx) - if got != "" { - t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) - } - return resp, err - }) -} - -func TestMarkdownRequest_Marshal(t *testing.T) { - testJSONMarshal(t, &markdownRequest{}, "{}") - - a := &markdownRequest{ - Text: String("txt"), - Mode: String("mode"), - Context: String("ctx"), - } - - want := `{ - "text": "txt", - "mode": "mode", - "context": "ctx" - }` - - testJSONMarshal(t, a, want) -} - -func TestCodeOfConduct_Marshal(t *testing.T) { - testJSONMarshal(t, &CodeOfConduct{}, "{}") - - a := &CodeOfConduct{ - Name: String("name"), - Key: String("key"), - URL: String("url"), - Body: String("body"), - } - - want := `{ - "name": "name", - "key": "key", - "url": "url", - "body": "body" - }` - - testJSONMarshal(t, a, want) -} diff --git a/test/integration/misc_test.go b/test/integration/misc_test.go index e0cee29bf07..6ffb163fdcd 100644 --- a/test/integration/misc_test.go +++ b/test/integration/misc_test.go @@ -15,32 +15,32 @@ import ( ) func TestEmojis(t *testing.T) { - emoji, _, err := client.ListEmojis(context.Background()) + emoji, _, err := client.Emojis.List(context.Background()) if err != nil { - t.Fatalf("ListEmojis returned error: %v", err) + t.Fatalf("List returned error: %v", err) } if len(emoji) == 0 { - t.Errorf("ListEmojis returned no emojis") + t.Errorf("List returned no emojis") } if _, ok := emoji["+1"]; !ok { - t.Errorf("ListEmojis missing '+1' emoji") + t.Errorf("List missing '+1' emoji") } } func TestAPIMeta(t *testing.T) { - meta, _, err := client.APIMeta(context.Background()) + meta, _, err := client.Meta.Get(context.Background()) if err != nil { - t.Fatalf("APIMeta returned error: %v", err) + t.Fatalf("Get returned error: %v", err) } if len(meta.Hooks) == 0 { - t.Errorf("APIMeta returned no hook addresses") + t.Errorf("Get returned no hook addresses") } if len(meta.Git) == 0 { - t.Errorf("APIMeta returned no git addresses") + t.Errorf("Get returned no git addresses") } if !*meta.VerifiablePasswordAuthentication { From a1e8b0ec3b4b625d40a7526d51bfdab27e3eabc1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Oct 2023 17:36:00 -0400 Subject: [PATCH 037/145] Bump golang.org/x/net from 0.15.0 to 0.16.0 in /scrape (#2954) --- scrape/go.mod | 2 +- scrape/go.sum | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/scrape/go.mod b/scrape/go.mod index 9b70258ff76..0bb9f38ecac 100644 --- a/scrape/go.mod +++ b/scrape/go.mod @@ -7,5 +7,5 @@ require ( github.com/google/go-cmp v0.5.9 github.com/google/go-github/v55 v55.0.0 github.com/xlzd/gotp v0.1.0 - golang.org/x/net v0.15.0 + golang.org/x/net v0.16.0 ) diff --git a/scrape/go.sum b/scrape/go.sum index 7db3e4418ea..4a8cc6b0911 100644 --- a/scrape/go.sum +++ b/scrape/go.sum @@ -23,8 +23,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= -golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= -golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= +golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -35,8 +35,8 @@ golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= -golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +golang.org/x/net v0.16.0 h1:7eBu7KsSvFDtSXUIDbh3aqlK4DPsZ1rByC8PFfBThos= +golang.org/x/net v0.16.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -52,15 +52,15 @@ golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= -golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= +golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= From 77b5b3d9efd8336a03180031a0764aa9dabdc98f Mon Sep 17 00:00:00 2001 From: Jasper <62405708+brekelj1@users.noreply.github.com> Date: Tue, 10 Oct 2023 08:39:46 +1100 Subject: [PATCH 038/145] Add prevent_self_review on repo environments (#2951) --- github/github-accessors.go | 16 ++++++++++++++++ github/github-accessors_test.go | 20 ++++++++++++++++++++ github/repos_environments.go | 12 +++++++----- 3 files changed, 43 insertions(+), 5 deletions(-) diff --git a/github/github-accessors.go b/github/github-accessors.go index a0e7a74366e..78a184e6c80 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -4838,6 +4838,14 @@ func (c *CreateUpdateEnvironment) GetDeploymentBranchPolicy() *BranchPolicy { return c.DeploymentBranchPolicy } +// GetPreventSelfReview returns the PreventSelfReview field if it's non-nil, zero value otherwise. +func (c *CreateUpdateEnvironment) GetPreventSelfReview() bool { + if c == nil || c.PreventSelfReview == nil { + return false + } + return *c.PreventSelfReview +} + // GetWaitTimer returns the WaitTimer field if it's non-nil, zero value otherwise. func (c *CreateUpdateEnvironment) GetWaitTimer() int { if c == nil || c.WaitTimer == nil { @@ -15534,6 +15542,14 @@ func (p *ProtectionRule) GetNodeID() string { return *p.NodeID } +// GetPreventSelfReview returns the PreventSelfReview field if it's non-nil, zero value otherwise. +func (p *ProtectionRule) GetPreventSelfReview() bool { + if p == nil || p.PreventSelfReview == nil { + return false + } + return *p.PreventSelfReview +} + // GetType returns the Type field if it's non-nil, zero value otherwise. func (p *ProtectionRule) GetType() string { if p == nil || p.Type == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 9b3c36fd9bc..54c89eb9876 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -5712,6 +5712,16 @@ func TestCreateUpdateEnvironment_GetDeploymentBranchPolicy(tt *testing.T) { c.GetDeploymentBranchPolicy() } +func TestCreateUpdateEnvironment_GetPreventSelfReview(tt *testing.T) { + var zeroValue bool + c := &CreateUpdateEnvironment{PreventSelfReview: &zeroValue} + c.GetPreventSelfReview() + c = &CreateUpdateEnvironment{} + c.GetPreventSelfReview() + c = nil + c.GetPreventSelfReview() +} + func TestCreateUpdateEnvironment_GetWaitTimer(tt *testing.T) { var zeroValue int c := &CreateUpdateEnvironment{WaitTimer: &zeroValue} @@ -18047,6 +18057,16 @@ func TestProtectionRule_GetNodeID(tt *testing.T) { p.GetNodeID() } +func TestProtectionRule_GetPreventSelfReview(tt *testing.T) { + var zeroValue bool + p := &ProtectionRule{PreventSelfReview: &zeroValue} + p.GetPreventSelfReview() + p = &ProtectionRule{} + p.GetPreventSelfReview() + p = nil + p.GetPreventSelfReview() +} + func TestProtectionRule_GetType(tt *testing.T) { var zeroValue string p := &ProtectionRule{Type: &zeroValue} diff --git a/github/repos_environments.go b/github/repos_environments.go index 2399a42c746..e22ca5cd1be 100644 --- a/github/repos_environments.go +++ b/github/repos_environments.go @@ -52,11 +52,12 @@ type EnvResponse struct { // ProtectionRule represents a single protection rule applied to the environment. type ProtectionRule struct { - ID *int64 `json:"id,omitempty"` - NodeID *string `json:"node_id,omitempty"` - Type *string `json:"type,omitempty"` - WaitTimer *int `json:"wait_timer,omitempty"` - Reviewers []*RequiredReviewer `json:"reviewers,omitempty"` + ID *int64 `json:"id,omitempty"` + NodeID *string `json:"node_id,omitempty"` + PreventSelfReview *bool `json:"prevent_self_review,omitempty"` + Type *string `json:"type,omitempty"` + WaitTimer *int `json:"wait_timer,omitempty"` + Reviewers []*RequiredReviewer `json:"reviewers,omitempty"` } // RequiredReviewer represents a required reviewer. @@ -173,6 +174,7 @@ type CreateUpdateEnvironment struct { Reviewers []*EnvReviewers `json:"reviewers"` CanAdminsBypass *bool `json:"can_admins_bypass"` DeploymentBranchPolicy *BranchPolicy `json:"deployment_branch_policy"` + PreventSelfReview *bool `json:"prevent_self_review,omitempty"` } // createUpdateEnvironmentNoEnterprise represents the fields accepted for Pro/Teams private repos. From fb8f20f8fc6ef16f06d40a1b730a4abd3cc6caa5 Mon Sep 17 00:00:00 2001 From: Lachlan Cooper Date: Wed, 11 Oct 2023 05:10:51 +1100 Subject: [PATCH 039/145] Support options for GetCodeownersErrors (#2953) Fixes: #2952. --- github/repos_codeowners.go | 15 ++++++- github/repos_codeowners_test.go | 71 +++++++++++++++++++++++++++++++-- 2 files changed, 81 insertions(+), 5 deletions(-) diff --git a/github/repos_codeowners.go b/github/repos_codeowners.go index 835d56e164c..1c3f78abd9b 100644 --- a/github/repos_codeowners.go +++ b/github/repos_codeowners.go @@ -10,6 +10,14 @@ import ( "fmt" ) +// GetCodeownersErrorsOptions specifies the optional parameters to the +// RepositoriesService.GetCodeownersErrors method. +type GetCodeownersErrorsOptions struct { + // A branch, tag or commit name used to determine which version of the CODEOWNERS file to use. + // Default: the repository's default branch (e.g. main). + Ref string `url:"ref,omitempty"` +} + // CodeownersErrors represents a list of syntax errors detected in the CODEOWNERS file. type CodeownersErrors struct { Errors []*CodeownersError `json:"errors"` @@ -29,8 +37,13 @@ type CodeownersError struct { // GetCodeownersErrors lists any syntax errors that are detected in the CODEOWNERS file. // // GitHub API docs: https://docs.github.com/en/rest/repos/repos#list-codeowners-errors -func (s *RepositoriesService) GetCodeownersErrors(ctx context.Context, owner, repo string) (*CodeownersErrors, *Response, error) { +func (s *RepositoriesService) GetCodeownersErrors(ctx context.Context, owner, repo string, opts *GetCodeownersErrorsOptions) (*CodeownersErrors, *Response, error) { u := fmt.Sprintf("repos/%v/%v/codeowners/errors", owner, repo) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err diff --git a/github/repos_codeowners_test.go b/github/repos_codeowners_test.go index 62c58c5b192..84f0ee462bb 100644 --- a/github/repos_codeowners_test.go +++ b/github/repos_codeowners_test.go @@ -14,7 +14,7 @@ import ( "github.com/google/go-cmp/cmp" ) -func TestRepositoriesService_GetCodeownersErrors(t *testing.T) { +func TestRepositoriesService_GetCodeownersErrors_noRef(t *testing.T) { client, mux, _, teardown := setup() defer teardown() @@ -38,7 +38,7 @@ func TestRepositoriesService_GetCodeownersErrors(t *testing.T) { }) ctx := context.Background() - codeownersErrors, _, err := client.Repositories.GetCodeownersErrors(ctx, "o", "r") + codeownersErrors, _, err := client.Repositories.GetCodeownersErrors(ctx, "o", "r", nil) if err != nil { t.Errorf("Repositories.GetCodeownersErrors returned error: %v", err) } @@ -62,12 +62,75 @@ func TestRepositoriesService_GetCodeownersErrors(t *testing.T) { const methodName = "GetCodeownersErrors" testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Repositories.GetCodeownersErrors(ctx, "\n", "\n") + _, _, err = client.Repositories.GetCodeownersErrors(ctx, "\n", "\n", nil) return err }) testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Repositories.GetCodeownersErrors(ctx, "o", "r") + got, resp, err := client.Repositories.GetCodeownersErrors(ctx, "o", "r", nil) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestRepositoriesService_GetCodeownersErrors_specificRef(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/repos/o/r/codeowners/errors", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + testHeader(t, r, "Accept", mediaTypeV3) + testFormValues(t, r, values{"ref": "mybranch"}) + fmt.Fprint(w, `{ + "errors": [ + { + "line": 1, + "column": 1, + "kind": "Invalid pattern", + "source": "***/*.rb @monalisa", + "suggestion": "Did you mean **/*.rb?", + "message": "Invalid pattern on line 3: Did you mean **/*.rb?\n\n ***/*.rb @monalisa\n ^", + "path": ".github/CODEOWNERS" + } + ] + } + `) + }) + + opts := &GetCodeownersErrorsOptions{Ref: "mybranch"} + ctx := context.Background() + codeownersErrors, _, err := client.Repositories.GetCodeownersErrors(ctx, "o", "r", opts) + if err != nil { + t.Errorf("Repositories.GetCodeownersErrors returned error: %v", err) + } + + want := &CodeownersErrors{ + Errors: []*CodeownersError{ + { + Line: 1, + Column: 1, + Kind: "Invalid pattern", + Source: "***/*.rb @monalisa", + Suggestion: String("Did you mean **/*.rb?"), + Message: "Invalid pattern on line 3: Did you mean **/*.rb?\n\n ***/*.rb @monalisa\n ^", + Path: ".github/CODEOWNERS", + }, + }, + } + if !cmp.Equal(codeownersErrors, want) { + t.Errorf("Repositories.GetCodeownersErrors returned %+v, want %+v", codeownersErrors, want) + } + + const methodName = "GetCodeownersErrors" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Repositories.GetCodeownersErrors(ctx, "\n", "\n", opts) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Repositories.GetCodeownersErrors(ctx, "o", "r", opts) if got != nil { t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) } From 9f746fad4bb1eb295f5b7e625a9c632ca243fbd2 Mon Sep 17 00:00:00 2001 From: Dion Gionet Mallet Date: Wed, 11 Oct 2023 08:47:58 -0400 Subject: [PATCH 040/145] Add type field to DeploymentBranchPolicy (#2957) Fixes: #2956. --- github/github-accessors.go | 16 +++++++++++++++ github/github-accessors_test.go | 20 +++++++++++++++++++ github/repos_deployment_branch_policies.go | 2 ++ .../repos_deployment_branch_policies_test.go | 6 +++--- 4 files changed, 41 insertions(+), 3 deletions(-) diff --git a/github/github-accessors.go b/github/github-accessors.go index 78a184e6c80..199c9b8a37d 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -5582,6 +5582,14 @@ func (d *DeploymentBranchPolicy) GetNodeID() string { return *d.NodeID } +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (d *DeploymentBranchPolicy) GetType() string { + if d == nil || d.Type == nil { + return "" + } + return *d.Type +} + // GetName returns the Name field if it's non-nil, zero value otherwise. func (d *DeploymentBranchPolicyRequest) GetName() string { if d == nil || d.Name == nil { @@ -5590,6 +5598,14 @@ func (d *DeploymentBranchPolicyRequest) GetName() string { return *d.Name } +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (d *DeploymentBranchPolicyRequest) GetType() string { + if d == nil || d.Type == nil { + return "" + } + return *d.Type +} + // GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. func (d *DeploymentBranchPolicyResponse) GetTotalCount() int { if d == nil || d.TotalCount == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 54c89eb9876..d179a927750 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -6570,6 +6570,16 @@ func TestDeploymentBranchPolicy_GetNodeID(tt *testing.T) { d.GetNodeID() } +func TestDeploymentBranchPolicy_GetType(tt *testing.T) { + var zeroValue string + d := &DeploymentBranchPolicy{Type: &zeroValue} + d.GetType() + d = &DeploymentBranchPolicy{} + d.GetType() + d = nil + d.GetType() +} + func TestDeploymentBranchPolicyRequest_GetName(tt *testing.T) { var zeroValue string d := &DeploymentBranchPolicyRequest{Name: &zeroValue} @@ -6580,6 +6590,16 @@ func TestDeploymentBranchPolicyRequest_GetName(tt *testing.T) { d.GetName() } +func TestDeploymentBranchPolicyRequest_GetType(tt *testing.T) { + var zeroValue string + d := &DeploymentBranchPolicyRequest{Type: &zeroValue} + d.GetType() + d = &DeploymentBranchPolicyRequest{} + d.GetType() + d = nil + d.GetType() +} + func TestDeploymentBranchPolicyResponse_GetTotalCount(tt *testing.T) { var zeroValue int d := &DeploymentBranchPolicyResponse{TotalCount: &zeroValue} diff --git a/github/repos_deployment_branch_policies.go b/github/repos_deployment_branch_policies.go index 8c4628b39bc..32bf72ccab5 100644 --- a/github/repos_deployment_branch_policies.go +++ b/github/repos_deployment_branch_policies.go @@ -15,6 +15,7 @@ type DeploymentBranchPolicy struct { Name *string `json:"name,omitempty"` ID *int64 `json:"id,omitempty"` NodeID *string `json:"node_id,omitempty"` + Type *string `json:"type,omitempty"` } // DeploymentBranchPolicyResponse represents the slightly different format of response that comes back when you list deployment branch policies. @@ -26,6 +27,7 @@ type DeploymentBranchPolicyResponse struct { // DeploymentBranchPolicyRequest represents a deployment branch policy request. type DeploymentBranchPolicyRequest struct { Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` } // ListDeploymentBranchPolicies lists the deployment branch policies for an environment. diff --git a/github/repos_deployment_branch_policies_test.go b/github/repos_deployment_branch_policies_test.go index 69bffac86ed..9d2acd199d3 100644 --- a/github/repos_deployment_branch_policies_test.go +++ b/github/repos_deployment_branch_policies_test.go @@ -83,16 +83,16 @@ func TestRepositoriesService_CreateDeploymentBranchPolicy(t *testing.T) { mux.HandleFunc("/repos/o/r/environments/e/deployment-branch-policies", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") - fmt.Fprint(w, `{"id":1}`) + fmt.Fprint(w, `{"id":1, "type":"branch"}`) }) ctx := context.Background() - got, _, err := client.Repositories.CreateDeploymentBranchPolicy(ctx, "o", "r", "e", &DeploymentBranchPolicyRequest{Name: String("n")}) + got, _, err := client.Repositories.CreateDeploymentBranchPolicy(ctx, "o", "r", "e", &DeploymentBranchPolicyRequest{Name: String("n"), Type: String("branch")}) if err != nil { t.Errorf("Repositories.CreateDeploymentBranchPolicy returned error: %v", err) } - want := &DeploymentBranchPolicy{ID: Int64(1)} + want := &DeploymentBranchPolicy{ID: Int64(1), Type: String("branch")} if !reflect.DeepEqual(got, want) { t.Errorf("Repositories.CreateDeploymentBranchPolicy = %+v, want %+v", got, want) } From 2efd7ddf633bcc05e4967cf601d4eb6c2f65f1e8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 11 Oct 2023 19:07:49 -0400 Subject: [PATCH 041/145] Bump golang.org/x/net from 0.16.0 to 0.17.0 in /scrape (#2958) --- scrape/go.mod | 2 +- scrape/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scrape/go.mod b/scrape/go.mod index 0bb9f38ecac..54ba62c13d7 100644 --- a/scrape/go.mod +++ b/scrape/go.mod @@ -7,5 +7,5 @@ require ( github.com/google/go-cmp v0.5.9 github.com/google/go-github/v55 v55.0.0 github.com/xlzd/gotp v0.1.0 - golang.org/x/net v0.16.0 + golang.org/x/net v0.17.0 ) diff --git a/scrape/go.sum b/scrape/go.sum index 4a8cc6b0911..e2a573f53f8 100644 --- a/scrape/go.sum +++ b/scrape/go.sum @@ -35,8 +35,8 @@ golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.16.0 h1:7eBu7KsSvFDtSXUIDbh3aqlK4DPsZ1rByC8PFfBThos= -golang.org/x/net v0.16.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= From 05ea56229977602a87946e0ea7bad837889a5cd6 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Wed, 11 Oct 2023 19:33:33 -0400 Subject: [PATCH 042/145] Bump golang.org/x/net from 0.10.0 to 0.17.0 in /example (#2960) Fixes: #2959. --- example/go.mod | 8 ++++---- example/go.sum | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/example/go.mod b/example/go.mod index 7f7c9ededaa..b89ac02e06a 100644 --- a/example/go.mod +++ b/example/go.mod @@ -7,8 +7,8 @@ require ( github.com/bradleyfalzon/ghinstallation/v2 v2.0.4 github.com/gofri/go-github-ratelimit v1.0.3 github.com/google/go-github/v55 v55.0.0 - golang.org/x/crypto v0.12.0 - golang.org/x/term v0.11.0 + golang.org/x/crypto v0.14.0 + golang.org/x/term v0.13.0 google.golang.org/appengine v1.6.7 ) @@ -18,8 +18,8 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/google/go-github/v41 v41.0.0 // indirect github.com/google/go-querystring v1.1.0 // indirect - golang.org/x/net v0.10.0 // indirect - golang.org/x/sys v0.11.0 // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/sys v0.13.0 // indirect google.golang.org/protobuf v1.28.0 // indirect ) diff --git a/example/go.sum b/example/go.sum index 7b1a57e73c8..2c16d048c2f 100644 --- a/example/go.sum +++ b/example/go.sum @@ -28,8 +28,8 @@ golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= -golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= +golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= @@ -39,8 +39,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -54,15 +54,15 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0= -golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= +golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= +golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= From 5e25c5c215b3d21991d17447fba2e9d13a875159 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Wed, 11 Oct 2023 19:46:53 -0400 Subject: [PATCH 043/145] Bump version of go-github to v56.0.0 (#2961) --- README.md | 15 ++++++++------- example/actionpermissions/main.go | 2 +- example/appengine/app.go | 2 +- example/basicauth/main.go | 2 +- .../codespaces/newreposecretwithxcrypto/main.go | 2 +- .../codespaces/newusersecretwithxcrypto/main.go | 2 +- example/commitpr/main.go | 2 +- example/go.mod | 6 +++--- example/listenvironments/main.go | 2 +- example/migrations/main.go | 2 +- example/newfilewithappauth/main.go | 2 +- example/newrepo/main.go | 2 +- example/newreposecretwithlibsodium/go.mod | 4 ++-- example/newreposecretwithlibsodium/main.go | 2 +- example/newreposecretwithxcrypto/main.go | 2 +- example/ratelimit/main.go | 2 +- example/simple/main.go | 2 +- example/tagprotection/main.go | 2 +- example/tokenauth/main.go | 2 +- example/topics/main.go | 2 +- github/doc.go | 2 +- github/examples_test.go | 2 +- github/github.go | 2 +- go.mod | 2 +- test/fields/fields.go | 2 +- test/integration/activity_test.go | 2 +- test/integration/authorizations_test.go | 2 +- test/integration/github_test.go | 2 +- test/integration/repos_test.go | 2 +- test/integration/users_test.go | 2 +- update-urls/go.mod | 2 +- 31 files changed, 41 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index 1c8d9bd0e56..daf57fe0275 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # go-github # [![go-github release (latest SemVer)](https://img.shields.io/github/v/release/google/go-github?sort=semver)](https://github.com/google/go-github/releases) -[![GoDoc](https://img.shields.io/static/v1?label=godoc&message=reference&color=blue)](https://pkg.go.dev/github.com/google/go-github/v55/github) +[![GoDoc](https://img.shields.io/static/v1?label=godoc&message=reference&color=blue)](https://pkg.go.dev/github.com/google/go-github/v56/github) [![Test Status](https://github.com/google/go-github/workflows/tests/badge.svg)](https://github.com/google/go-github/actions?query=workflow%3Atests) [![Test Coverage](https://codecov.io/gh/google/go-github/branch/master/graph/badge.svg)](https://codecov.io/gh/google/go-github) [![Discuss at go-github@googlegroups.com](https://img.shields.io/badge/discuss-go--github%40googlegroups.com-blue.svg)](https://groups.google.com/group/go-github) @@ -24,7 +24,7 @@ If you're interested in using the [GraphQL API v4][], the recommended library is go-github is compatible with modern Go releases in module mode, with Go installed: ```bash -go get github.com/google/go-github/v55 +go get github.com/google/go-github/v56 ``` will resolve and add the package to the current development module, along with its dependencies. @@ -32,7 +32,7 @@ will resolve and add the package to the current development module, along with i Alternatively the same can be achieved if you use import in a package: ```go -import "github.com/google/go-github/v55/github" +import "github.com/google/go-github/v56/github" ``` and run `go get` without parameters. @@ -40,13 +40,13 @@ and run `go get` without parameters. Finally, to use the top-of-trunk version of this repo, use the following command: ```bash -go get github.com/google/go-github/v55@master +go get github.com/google/go-github/v56@master ``` ## Usage ## ```go -import "github.com/google/go-github/v55/github" // with go modules enabled (GO111MODULE=on or outside GOPATH) +import "github.com/google/go-github/v56/github" // with go modules enabled (GO111MODULE=on or outside GOPATH) import "github.com/google/go-github/github" // with go modules disabled ``` @@ -117,7 +117,7 @@ import ( "net/http" "github.com/bradleyfalzon/ghinstallation/v2" - "github.com/google/go-github/v55/github" + "github.com/google/go-github/v56/github" ) func main() { @@ -296,7 +296,7 @@ For complete usage of go-github, see the full [package docs][]. [GitHub API v3]: https://docs.github.com/en/rest [personal access token]: https://github.com/blog/1509-personal-api-tokens -[package docs]: https://pkg.go.dev/github.com/google/go-github/v55/github +[package docs]: https://pkg.go.dev/github.com/google/go-github/v56/github [GraphQL API v4]: https://developer.github.com/v4/ [shurcooL/githubv4]: https://github.com/shurcooL/githubv4 [GitHub webhook events]: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads @@ -369,6 +369,7 @@ Versions prior to 48.2.0 are not listed. | go-github Version | GitHub v3 API Version | | ----------------- | --------------------- | +| 56.0.0 | 2022-11-28 | | 55.0.0 | 2022-11-28 | | 54.0.0 | 2022-11-28 | | 53.2.0 | 2022-11-28 | diff --git a/example/actionpermissions/main.go b/example/actionpermissions/main.go index 4ff7008ca9d..711906a1227 100644 --- a/example/actionpermissions/main.go +++ b/example/actionpermissions/main.go @@ -14,7 +14,7 @@ import ( "log" "os" - "github.com/google/go-github/v55/github" + "github.com/google/go-github/v56/github" ) var ( diff --git a/example/appengine/app.go b/example/appengine/app.go index 449f880cd17..fff9807f7fa 100644 --- a/example/appengine/app.go +++ b/example/appengine/app.go @@ -12,7 +12,7 @@ import ( "net/http" "os" - "github.com/google/go-github/v55/github" + "github.com/google/go-github/v56/github" "google.golang.org/appengine" "google.golang.org/appengine/log" ) diff --git a/example/basicauth/main.go b/example/basicauth/main.go index 95ec4360c21..e9027efcbce 100644 --- a/example/basicauth/main.go +++ b/example/basicauth/main.go @@ -21,7 +21,7 @@ import ( "os" "strings" - "github.com/google/go-github/v55/github" + "github.com/google/go-github/v56/github" "golang.org/x/term" ) diff --git a/example/codespaces/newreposecretwithxcrypto/main.go b/example/codespaces/newreposecretwithxcrypto/main.go index 18c8ed24e3c..68b67696cfb 100644 --- a/example/codespaces/newreposecretwithxcrypto/main.go +++ b/example/codespaces/newreposecretwithxcrypto/main.go @@ -36,7 +36,7 @@ import ( "log" "os" - "github.com/google/go-github/v55/github" + "github.com/google/go-github/v56/github" "golang.org/x/crypto/nacl/box" ) diff --git a/example/codespaces/newusersecretwithxcrypto/main.go b/example/codespaces/newusersecretwithxcrypto/main.go index 9e05d6117e4..9264aabad74 100644 --- a/example/codespaces/newusersecretwithxcrypto/main.go +++ b/example/codespaces/newusersecretwithxcrypto/main.go @@ -37,7 +37,7 @@ import ( "log" "os" - "github.com/google/go-github/v55/github" + "github.com/google/go-github/v56/github" "golang.org/x/crypto/nacl/box" ) diff --git a/example/commitpr/main.go b/example/commitpr/main.go index 7e73d7ffdef..15919277f91 100644 --- a/example/commitpr/main.go +++ b/example/commitpr/main.go @@ -33,7 +33,7 @@ import ( "time" "github.com/ProtonMail/go-crypto/openpgp" - "github.com/google/go-github/v55/github" + "github.com/google/go-github/v56/github" ) var ( diff --git a/example/go.mod b/example/go.mod index b89ac02e06a..6900dbaafa6 100644 --- a/example/go.mod +++ b/example/go.mod @@ -1,4 +1,4 @@ -module github.com/google/go-github/v55/example +module github.com/google/go-github/v56/example go 1.17 @@ -6,7 +6,7 @@ require ( github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 github.com/bradleyfalzon/ghinstallation/v2 v2.0.4 github.com/gofri/go-github-ratelimit v1.0.3 - github.com/google/go-github/v55 v55.0.0 + github.com/google/go-github/v56 v56.0.0 golang.org/x/crypto v0.14.0 golang.org/x/term v0.13.0 google.golang.org/appengine v1.6.7 @@ -24,4 +24,4 @@ require ( ) // Use version at HEAD, not the latest published. -replace github.com/google/go-github/v55 => ../ +replace github.com/google/go-github/v56 => ../ diff --git a/example/listenvironments/main.go b/example/listenvironments/main.go index 56aef7cf73a..ec3e9878ffc 100644 --- a/example/listenvironments/main.go +++ b/example/listenvironments/main.go @@ -18,7 +18,7 @@ import ( "log" "os" - "github.com/google/go-github/v55/github" + "github.com/google/go-github/v56/github" ) func main() { diff --git a/example/migrations/main.go b/example/migrations/main.go index c5ee99c178f..8304b75e962 100644 --- a/example/migrations/main.go +++ b/example/migrations/main.go @@ -12,7 +12,7 @@ import ( "context" "fmt" - "github.com/google/go-github/v55/github" + "github.com/google/go-github/v56/github" ) func fetchAllUserMigrations() ([]*github.UserMigration, error) { diff --git a/example/newfilewithappauth/main.go b/example/newfilewithappauth/main.go index cd85a885106..36f56fca5f9 100644 --- a/example/newfilewithappauth/main.go +++ b/example/newfilewithappauth/main.go @@ -16,7 +16,7 @@ import ( "time" "github.com/bradleyfalzon/ghinstallation/v2" - "github.com/google/go-github/v55/github" + "github.com/google/go-github/v56/github" ) func main() { diff --git a/example/newrepo/main.go b/example/newrepo/main.go index aa800333a6c..b2d0879c801 100644 --- a/example/newrepo/main.go +++ b/example/newrepo/main.go @@ -16,7 +16,7 @@ import ( "log" "os" - "github.com/google/go-github/v55/github" + "github.com/google/go-github/v56/github" ) var ( diff --git a/example/newreposecretwithlibsodium/go.mod b/example/newreposecretwithlibsodium/go.mod index 114862d69f3..6f71c4f9ce0 100644 --- a/example/newreposecretwithlibsodium/go.mod +++ b/example/newreposecretwithlibsodium/go.mod @@ -4,8 +4,8 @@ go 1.15 require ( github.com/GoKillers/libsodium-go v0.0.0-20171022220152-dd733721c3cb - github.com/google/go-github/v55 v55.0.0 + github.com/google/go-github/v56 v56.0.0 ) // Use version at HEAD, not the latest published. -replace github.com/google/go-github/v55 => ../.. +replace github.com/google/go-github/v56 => ../.. diff --git a/example/newreposecretwithlibsodium/main.go b/example/newreposecretwithlibsodium/main.go index bdd9affb2f4..aa9ea38a834 100644 --- a/example/newreposecretwithlibsodium/main.go +++ b/example/newreposecretwithlibsodium/main.go @@ -36,7 +36,7 @@ import ( "os" sodium "github.com/GoKillers/libsodium-go/cryptobox" - "github.com/google/go-github/v55/github" + "github.com/google/go-github/v56/github" ) var ( diff --git a/example/newreposecretwithxcrypto/main.go b/example/newreposecretwithxcrypto/main.go index 3b65e1548d8..686b12e7a3c 100644 --- a/example/newreposecretwithxcrypto/main.go +++ b/example/newreposecretwithxcrypto/main.go @@ -36,7 +36,7 @@ import ( "log" "os" - "github.com/google/go-github/v55/github" + "github.com/google/go-github/v56/github" "golang.org/x/crypto/nacl/box" ) diff --git a/example/ratelimit/main.go b/example/ratelimit/main.go index a311c9c058d..9c07cf301b8 100644 --- a/example/ratelimit/main.go +++ b/example/ratelimit/main.go @@ -13,7 +13,7 @@ import ( "fmt" "github.com/gofri/go-github-ratelimit/github_ratelimit" - "github.com/google/go-github/v55/github" + "github.com/google/go-github/v56/github" ) func main() { diff --git a/example/simple/main.go b/example/simple/main.go index 72583159d87..fcaddd6ae91 100644 --- a/example/simple/main.go +++ b/example/simple/main.go @@ -12,7 +12,7 @@ import ( "context" "fmt" - "github.com/google/go-github/v55/github" + "github.com/google/go-github/v56/github" ) // Fetch all the public organizations' membership of a user. diff --git a/example/tagprotection/main.go b/example/tagprotection/main.go index 4127d2b44de..e0e494e7da8 100644 --- a/example/tagprotection/main.go +++ b/example/tagprotection/main.go @@ -18,7 +18,7 @@ import ( "os" "strings" - "github.com/google/go-github/v55/github" + "github.com/google/go-github/v56/github" "golang.org/x/term" ) diff --git a/example/tokenauth/main.go b/example/tokenauth/main.go index ccd36543584..9d30ad79663 100644 --- a/example/tokenauth/main.go +++ b/example/tokenauth/main.go @@ -15,7 +15,7 @@ import ( "log" "os" - "github.com/google/go-github/v55/github" + "github.com/google/go-github/v56/github" "golang.org/x/term" ) diff --git a/example/topics/main.go b/example/topics/main.go index 98614836c77..80f5627672e 100644 --- a/example/topics/main.go +++ b/example/topics/main.go @@ -12,7 +12,7 @@ import ( "context" "fmt" - "github.com/google/go-github/v55/github" + "github.com/google/go-github/v56/github" ) // Fetch and lists all the public topics associated with the specified GitHub topic diff --git a/github/doc.go b/github/doc.go index bace6fb3c6f..4a9aa95c3af 100644 --- a/github/doc.go +++ b/github/doc.go @@ -8,7 +8,7 @@ Package github provides a client for using the GitHub API. Usage: - import "github.com/google/go-github/v55/github" // with go modules enabled (GO111MODULE=on or outside GOPATH) + import "github.com/google/go-github/v56/github" // with go modules enabled (GO111MODULE=on or outside GOPATH) import "github.com/google/go-github/github" // with go modules disabled Construct a new GitHub client, then use the various services on the client to diff --git a/github/examples_test.go b/github/examples_test.go index 4aca86218fa..ab319151786 100644 --- a/github/examples_test.go +++ b/github/examples_test.go @@ -12,7 +12,7 @@ import ( "fmt" "log" - "github.com/google/go-github/v55/github" + "github.com/google/go-github/v56/github" ) func ExampleMarkdownService_Render() { diff --git a/github/github.go b/github/github.go index 519f3f31a37..d71236ef088 100644 --- a/github/github.go +++ b/github/github.go @@ -27,7 +27,7 @@ import ( ) const ( - Version = "v55.0.0" + Version = "v56.0.0" defaultAPIVersion = "2022-11-28" defaultBaseURL = "https://api.github.com/" diff --git a/go.mod b/go.mod index 05f97f6f1ff..3a5c1501969 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/google/go-github/v55 +module github.com/google/go-github/v56 require ( github.com/google/go-cmp v0.5.9 diff --git a/test/fields/fields.go b/test/fields/fields.go index 124079a5cea..3334569dd38 100644 --- a/test/fields/fields.go +++ b/test/fields/fields.go @@ -25,7 +25,7 @@ import ( "reflect" "strings" - "github.com/google/go-github/v55/github" + "github.com/google/go-github/v56/github" ) var ( diff --git a/test/integration/activity_test.go b/test/integration/activity_test.go index 90d43711b4e..52c163c8a97 100644 --- a/test/integration/activity_test.go +++ b/test/integration/activity_test.go @@ -12,7 +12,7 @@ import ( "context" "testing" - "github.com/google/go-github/v55/github" + "github.com/google/go-github/v56/github" ) const ( diff --git a/test/integration/authorizations_test.go b/test/integration/authorizations_test.go index 872c8862820..66c7952a311 100644 --- a/test/integration/authorizations_test.go +++ b/test/integration/authorizations_test.go @@ -15,7 +15,7 @@ import ( "testing" "time" - "github.com/google/go-github/v55/github" + "github.com/google/go-github/v56/github" ) const msgEnvMissing = "Skipping test because the required environment variable (%v) is not present." diff --git a/test/integration/github_test.go b/test/integration/github_test.go index a51a2b23a47..2d297f0ede3 100644 --- a/test/integration/github_test.go +++ b/test/integration/github_test.go @@ -15,7 +15,7 @@ import ( "net/http" "os" - "github.com/google/go-github/v55/github" + "github.com/google/go-github/v56/github" ) var ( diff --git a/test/integration/repos_test.go b/test/integration/repos_test.go index cc6ff0425c8..b0fa75cb8fc 100644 --- a/test/integration/repos_test.go +++ b/test/integration/repos_test.go @@ -15,7 +15,7 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/google/go-github/v55/github" + "github.com/google/go-github/v56/github" ) func TestRepositories_CRUD(t *testing.T) { diff --git a/test/integration/users_test.go b/test/integration/users_test.go index 64efcd04a3e..d3a9abb0e80 100644 --- a/test/integration/users_test.go +++ b/test/integration/users_test.go @@ -14,7 +14,7 @@ import ( "math/rand" "testing" - "github.com/google/go-github/v55/github" + "github.com/google/go-github/v56/github" ) func TestUsers_Get(t *testing.T) { diff --git a/update-urls/go.mod b/update-urls/go.mod index 8fcf97b0614..4d20e6cee73 100644 --- a/update-urls/go.mod +++ b/update-urls/go.mod @@ -1,4 +1,4 @@ -module github.com/google/go-github/v55/update-urls +module github.com/google/go-github/v56/update-urls go 1.16 From 16e695dadf7afb7983193499816a009ae2227a61 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Wed, 11 Oct 2023 20:02:39 -0400 Subject: [PATCH 044/145] Bump go-github from v55 to v56 in /scrape (#2962) --- scrape/apps.go | 2 +- scrape/apps_test.go | 2 +- scrape/go.mod | 2 +- scrape/go.sum | 24 ++---------------------- 4 files changed, 5 insertions(+), 25 deletions(-) diff --git a/scrape/apps.go b/scrape/apps.go index 9cb99ddc0f8..851c4e1d2fb 100644 --- a/scrape/apps.go +++ b/scrape/apps.go @@ -17,7 +17,7 @@ import ( "strings" "github.com/PuerkitoBio/goquery" - "github.com/google/go-github/v55/github" + "github.com/google/go-github/v56/github" ) // AppRestrictionsEnabled returns whether the specified organization has diff --git a/scrape/apps_test.go b/scrape/apps_test.go index 8542426c83e..155056876b3 100644 --- a/scrape/apps_test.go +++ b/scrape/apps_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/google/go-github/v55/github" + "github.com/google/go-github/v56/github" ) func Test_AppRestrictionsEnabled(t *testing.T) { diff --git a/scrape/go.mod b/scrape/go.mod index 54ba62c13d7..8f921034fa4 100644 --- a/scrape/go.mod +++ b/scrape/go.mod @@ -5,7 +5,7 @@ go 1.13 require ( github.com/PuerkitoBio/goquery v1.8.1 github.com/google/go-cmp v0.5.9 - github.com/google/go-github/v55 v55.0.0 + github.com/google/go-github/v56 v56.0.0 github.com/xlzd/gotp v0.1.0 golang.org/x/net v0.17.0 ) diff --git a/scrape/go.sum b/scrape/go.sum index e2a573f53f8..3c9fd48d680 100644 --- a/scrape/go.sum +++ b/scrape/go.sum @@ -1,19 +1,12 @@ -github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 h1:wPbRQzjjwFc0ih8puEVAOFGELsn1zoIIYdxvML7mDxA= -github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8/go.mod h1:I0gYDMZ6Z5GRU7l58bNFSkPTFN6Yl12dsUlAZ8xy98g= github.com/PuerkitoBio/goquery v1.8.1 h1:uQxhNlArOIdbrH1tr0UXwdVFgDcZDrZVdcpygAcwmWM= github.com/PuerkitoBio/goquery v1.8.1/go.mod h1:Q8ICL1kNUJ2sXGoAhPGUdYDJvgQgHzJsnnd3H7Ho5jQ= github.com/andybalholm/cascadia v1.3.1 h1:nhxRkql1kdYCc8Snf7D5/D3spOX+dBgjA6u8x004T2c= github.com/andybalholm/cascadia v1.3.1/go.mod h1:R4bJ1UQfqADjvDa4P6HZHLh/3OxWWEqc0Sk8XGwHqvA= -github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= -github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= -github.com/cloudflare/circl v1.1.0/go.mod h1:prBCrKB9DV4poKZY1l9zBXg2QJY7mvgRvtMxxK7fi4I= -github.com/cloudflare/circl v1.3.3 h1:fE/Qz0QdIGqeWfnwq0RE0R7MI51s0M2E4Ga9kq5AEMs= -github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-github/v55 v55.0.0 h1:4pp/1tNMB9X/LuAhs5i0KQAE40NmiR/y6prLNb9x9cg= -github.com/google/go-github/v55 v55.0.0/go.mod h1:JLahOTA1DnXzhxEymmFF5PP2tSS9JVNj68mSZNDwskA= +github.com/google/go-github/v56 v56.0.0 h1:TysL7dMa/r7wsQi44BjqlwaHvwlFlqkK8CtBWCX3gb4= +github.com/google/go-github/v56 v56.0.0/go.mod h1:D8cdcX98YWJvi7TLo7zM4/h8ZTx6u6fwGEkCdisopo0= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/xlzd/gotp v0.1.0 h1:37blvlKCh38s+fkem+fFh7sMnceltoIEBYTVXyoa5Po= @@ -21,9 +14,6 @@ github.com/xlzd/gotp v0.1.0/go.mod h1:ndLJ3JKzi3xLmUProq4LLxCuECL93dG9WASNLpHz8q github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= -golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= -golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= @@ -31,7 +21,6 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210916014120-12bc252f5db8/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= @@ -44,31 +33,22 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= -golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= From ee3f273456454b9a254f039adf5c4c20eac721b0 Mon Sep 17 00:00:00 2001 From: Mishin Nikolai Date: Sun, 15 Oct 2023 00:13:14 +0200 Subject: [PATCH 045/145] Add support for packages IP address for APIMeta (#2964) Fixes: #2963 . --- github/meta.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/github/meta.go b/github/meta.go index a4d9bac77b4..57fa8ccf588 100644 --- a/github/meta.go +++ b/github/meta.go @@ -32,6 +32,10 @@ type APIMeta struct { // not supported on these servers.) VerifiablePasswordAuthentication *bool `json:"verifiable_password_authentication,omitempty"` + // An array of IP addresses in CIDR format specifying the addresses + // which serve GitHub Packages. + Packages []string `json:"packages,omitempty"` + // An array of IP addresses in CIDR format specifying the addresses // which serve GitHub Pages websites. Pages []string `json:"pages,omitempty"` From 56ca0e5d559f691400370d2341542f06c0305df9 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Mon, 16 Oct 2023 15:49:31 -0400 Subject: [PATCH 046/145] Bump github.com/google/go-cmp from 0.5.9 to 0.6.0 (#2967) --- example/go.sum | 2 +- example/newreposecretwithlibsodium/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- scrape/go.mod | 2 +- scrape/go.sum | 3 ++- update-urls/go.mod | 2 +- update-urls/go.sum | 4 ++-- 8 files changed, 12 insertions(+), 11 deletions(-) diff --git a/example/go.sum b/example/go.sum index 2c16d048c2f..be6272956d8 100644 --- a/example/go.sum +++ b/example/go.sum @@ -17,7 +17,7 @@ github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-github/v41 v41.0.0 h1:HseJrM2JFf2vfiZJ8anY2hqBjdfY1Vlj/K27ueww4gg= github.com/google/go-github/v41 v41.0.0/go.mod h1:XgmCA5H323A9rtgExdTcnDkcqp6S30AVACCBDOonIxg= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= diff --git a/example/newreposecretwithlibsodium/go.sum b/example/newreposecretwithlibsodium/go.sum index dd58884a049..a1345cced05 100644 --- a/example/newreposecretwithlibsodium/go.sum +++ b/example/newreposecretwithlibsodium/go.sum @@ -1,8 +1,8 @@ github.com/GoKillers/libsodium-go v0.0.0-20171022220152-dd733721c3cb h1:ilqSFSbR1fq6x88heeHrvAqlg+ES+tZk2ZcaCmiH1gI= github.com/GoKillers/libsodium-go v0.0.0-20171022220152-dd733721c3cb/go.mod h1:72TQeEkiDH9QMXZa5nJJvZre0UjqqO67X2QEIoOwCRU= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/go.mod b/go.mod index 3a5c1501969..718bedab9d4 100644 --- a/go.mod +++ b/go.mod @@ -1,7 +1,7 @@ module github.com/google/go-github/v56 require ( - github.com/google/go-cmp v0.5.9 + github.com/google/go-cmp v0.6.0 github.com/google/go-querystring v1.1.0 ) diff --git a/go.sum b/go.sum index a2c5fe4a12f..b2abdf11c21 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,6 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/scrape/go.mod b/scrape/go.mod index 8f921034fa4..22bd9bf60ec 100644 --- a/scrape/go.mod +++ b/scrape/go.mod @@ -4,7 +4,7 @@ go 1.13 require ( github.com/PuerkitoBio/goquery v1.8.1 - github.com/google/go-cmp v0.5.9 + github.com/google/go-cmp v0.6.0 github.com/google/go-github/v56 v56.0.0 github.com/xlzd/gotp v0.1.0 golang.org/x/net v0.17.0 diff --git a/scrape/go.sum b/scrape/go.sum index 3c9fd48d680..d7b761f318d 100644 --- a/scrape/go.sum +++ b/scrape/go.sum @@ -3,8 +3,9 @@ github.com/PuerkitoBio/goquery v1.8.1/go.mod h1:Q8ICL1kNUJ2sXGoAhPGUdYDJvgQgHzJs github.com/andybalholm/cascadia v1.3.1 h1:nhxRkql1kdYCc8Snf7D5/D3spOX+dBgjA6u8x004T2c= github.com/andybalholm/cascadia v1.3.1/go.mod h1:R4bJ1UQfqADjvDa4P6HZHLh/3OxWWEqc0Sk8XGwHqvA= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-github/v56 v56.0.0 h1:TysL7dMa/r7wsQi44BjqlwaHvwlFlqkK8CtBWCX3gb4= github.com/google/go-github/v56 v56.0.0/go.mod h1:D8cdcX98YWJvi7TLo7zM4/h8ZTx6u6fwGEkCdisopo0= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= diff --git a/update-urls/go.mod b/update-urls/go.mod index 4d20e6cee73..81d9a3a5848 100644 --- a/update-urls/go.mod +++ b/update-urls/go.mod @@ -3,6 +3,6 @@ module github.com/google/go-github/v56/update-urls go 1.16 require ( - github.com/google/go-cmp v0.5.9 + github.com/google/go-cmp v0.6.0 github.com/pmezard/go-difflib v1.0.0 ) diff --git a/update-urls/go.sum b/update-urls/go.sum index 915dea3a949..ddc1bfa1ce9 100644 --- a/update-urls/go.sum +++ b/update-urls/go.sum @@ -1,4 +1,4 @@ -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= From eea6e0a8b1464f5b360c7bde92367845685b84c9 Mon Sep 17 00:00:00 2001 From: Nayeem Hasan Date: Fri, 20 Oct 2023 23:15:23 +0600 Subject: [PATCH 047/145] Move RateLimits method to a service (#2969) Fixes: #2968. --- github/github.go | 99 +-------- github/github_test.go | 372 -------------------------------- github/rate_limit.go | 109 ++++++++++ github/rate_limit_test.go | 388 ++++++++++++++++++++++++++++++++++ test/integration/misc_test.go | 2 +- 5 files changed, 503 insertions(+), 467 deletions(-) create mode 100644 github/rate_limit.go create mode 100644 github/rate_limit_test.go diff --git a/github/github.go b/github/github.go index d71236ef088..edd86ab2ad8 100644 --- a/github/github.go +++ b/github/github.go @@ -203,6 +203,7 @@ type Client struct { Organizations *OrganizationsService Projects *ProjectsService PullRequests *PullRequestsService + RateLimit *RateLimitService Reactions *ReactionsService Repositories *RepositoriesService SCIM *SCIMService @@ -424,6 +425,7 @@ func (c *Client) initialize() { c.Organizations = (*OrganizationsService)(&c.common) c.Projects = (*ProjectsService)(&c.common) c.PullRequests = (*PullRequestsService)(&c.common) + c.RateLimit = (*RateLimitService)(&c.common) c.Reactions = (*ReactionsService)(&c.common) c.Repositories = (*RepositoriesService)(&c.common) c.SCIM = (*SCIMService)(&c.common) @@ -1281,54 +1283,6 @@ func parseBoolResponse(err error) (bool, error) { return false, err } -// Rate represents the rate limit for the current client. -type Rate struct { - // The number of requests per hour the client is currently limited to. - Limit int `json:"limit"` - - // The number of remaining requests the client can make this hour. - Remaining int `json:"remaining"` - - // The time at which the current rate limit will reset. - Reset Timestamp `json:"reset"` -} - -func (r Rate) String() string { - return Stringify(r) -} - -// RateLimits represents the rate limits for the current client. -type RateLimits struct { - // The rate limit for non-search API requests. Unauthenticated - // requests are limited to 60 per hour. Authenticated requests are - // limited to 5,000 per hour. - // - // GitHub API docs: https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting - Core *Rate `json:"core"` - - // The rate limit for search API requests. Unauthenticated requests - // are limited to 10 requests per minutes. Authenticated requests are - // limited to 30 per minute. - // - // GitHub API docs: https://docs.github.com/en/rest/search#rate-limit - Search *Rate `json:"search"` - - // GitHub API docs: https://docs.github.com/en/graphql/overview/resource-limitations#rate-limit - GraphQL *Rate `json:"graphql"` - - // GitHub API dos: https://docs.github.com/en/rest/rate-limit - IntegrationManifest *Rate `json:"integration_manifest"` - - SourceImport *Rate `json:"source_import"` - CodeScanningUpload *Rate `json:"code_scanning_upload"` - ActionsRunnerRegistration *Rate `json:"actions_runner_registration"` - SCIM *Rate `json:"scim"` -} - -func (r RateLimits) String() string { - return Stringify(r) -} - type rateLimitCategory uint8 const ( @@ -1378,53 +1332,10 @@ func category(method, path string) rateLimitCategory { } // RateLimits returns the rate limits for the current client. +// +// Deprecated: Use RateLimitService.Get instead. func (c *Client) RateLimits(ctx context.Context) (*RateLimits, *Response, error) { - req, err := c.NewRequest("GET", "rate_limit", nil) - if err != nil { - return nil, nil, err - } - - response := new(struct { - Resources *RateLimits `json:"resources"` - }) - - // This resource is not subject to rate limits. - ctx = context.WithValue(ctx, bypassRateLimitCheck, true) - resp, err := c.Do(ctx, req, response) - if err != nil { - return nil, resp, err - } - - if response.Resources != nil { - c.rateMu.Lock() - if response.Resources.Core != nil { - c.rateLimits[coreCategory] = *response.Resources.Core - } - if response.Resources.Search != nil { - c.rateLimits[searchCategory] = *response.Resources.Search - } - if response.Resources.GraphQL != nil { - c.rateLimits[graphqlCategory] = *response.Resources.GraphQL - } - if response.Resources.IntegrationManifest != nil { - c.rateLimits[integrationManifestCategory] = *response.Resources.IntegrationManifest - } - if response.Resources.SourceImport != nil { - c.rateLimits[sourceImportCategory] = *response.Resources.SourceImport - } - if response.Resources.CodeScanningUpload != nil { - c.rateLimits[codeScanningUploadCategory] = *response.Resources.CodeScanningUpload - } - if response.Resources.ActionsRunnerRegistration != nil { - c.rateLimits[actionsRunnerRegistrationCategory] = *response.Resources.ActionsRunnerRegistration - } - if response.Resources.SCIM != nil { - c.rateLimits[scimCategory] = *response.Resources.SCIM - } - c.rateMu.Unlock() - } - - return response.Resources, resp, nil + return c.RateLimit.Get(ctx) } func setCredentialsAsHeaders(req *http.Request, id, secret string) *http.Request { diff --git a/github/github_test.go b/github/github_test.go index 7d92946dfd0..90e95b035f5 100644 --- a/github/github_test.go +++ b/github/github_test.go @@ -468,23 +468,6 @@ func TestClient_rateLimits(t *testing.T) { } } -func TestRateLimits_String(t *testing.T) { - v := RateLimits{ - Core: &Rate{}, - Search: &Rate{}, - GraphQL: &Rate{}, - IntegrationManifest: &Rate{}, - SourceImport: &Rate{}, - CodeScanningUpload: &Rate{}, - ActionsRunnerRegistration: &Rate{}, - SCIM: &Rate{}, - } - want := `github.RateLimits{Core:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, Search:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, GraphQL:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, IntegrationManifest:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, SourceImport:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, CodeScanningUpload:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, ActionsRunnerRegistration:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, SCIM:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}}` - if got := v.String(); got != want { - t.Errorf("RateLimits.String = %v, want %v", got, want) - } -} - func TestNewRequest(t *testing.T) { c := NewClient(nil) @@ -2123,251 +2106,6 @@ func TestError_Error(t *testing.T) { } } -func TestRateLimits(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() - - mux.HandleFunc("/rate_limit", func(w http.ResponseWriter, r *http.Request) { - testMethod(t, r, "GET") - fmt.Fprint(w, `{"resources":{ - "core": {"limit":2,"remaining":1,"reset":1372700873}, - "search": {"limit":3,"remaining":2,"reset":1372700874}, - "graphql": {"limit":4,"remaining":3,"reset":1372700875}, - "integration_manifest": {"limit":5,"remaining":4,"reset":1372700876}, - "source_import": {"limit":6,"remaining":5,"reset":1372700877}, - "code_scanning_upload": {"limit":7,"remaining":6,"reset":1372700878}, - "actions_runner_registration": {"limit":8,"remaining":7,"reset":1372700879}, - "scim": {"limit":9,"remaining":8,"reset":1372700880} - }}`) - }) - - ctx := context.Background() - rate, _, err := client.RateLimits(ctx) - if err != nil { - t.Errorf("RateLimits returned error: %v", err) - } - - want := &RateLimits{ - Core: &Rate{ - Limit: 2, - Remaining: 1, - Reset: Timestamp{time.Date(2013, time.July, 1, 17, 47, 53, 0, time.UTC).Local()}, - }, - Search: &Rate{ - Limit: 3, - Remaining: 2, - Reset: Timestamp{time.Date(2013, time.July, 1, 17, 47, 54, 0, time.UTC).Local()}, - }, - GraphQL: &Rate{ - Limit: 4, - Remaining: 3, - Reset: Timestamp{time.Date(2013, time.July, 1, 17, 47, 55, 0, time.UTC).Local()}, - }, - IntegrationManifest: &Rate{ - Limit: 5, - Remaining: 4, - Reset: Timestamp{time.Date(2013, time.July, 1, 17, 47, 56, 0, time.UTC).Local()}, - }, - SourceImport: &Rate{ - Limit: 6, - Remaining: 5, - Reset: Timestamp{time.Date(2013, time.July, 1, 17, 47, 57, 0, time.UTC).Local()}, - }, - CodeScanningUpload: &Rate{ - Limit: 7, - Remaining: 6, - Reset: Timestamp{time.Date(2013, time.July, 1, 17, 47, 58, 0, time.UTC).Local()}, - }, - ActionsRunnerRegistration: &Rate{ - Limit: 8, - Remaining: 7, - Reset: Timestamp{time.Date(2013, time.July, 1, 17, 47, 59, 0, time.UTC).Local()}, - }, - SCIM: &Rate{ - Limit: 9, - Remaining: 8, - Reset: Timestamp{time.Date(2013, time.July, 1, 17, 48, 00, 0, time.UTC).Local()}, - }, - } - if !cmp.Equal(rate, want) { - t.Errorf("RateLimits returned %+v, want %+v", rate, want) - } - tests := []struct { - category rateLimitCategory - rate *Rate - }{ - { - category: coreCategory, - rate: want.Core, - }, - { - category: searchCategory, - rate: want.Search, - }, - { - category: graphqlCategory, - rate: want.GraphQL, - }, - { - category: integrationManifestCategory, - rate: want.IntegrationManifest, - }, - { - category: sourceImportCategory, - rate: want.SourceImport, - }, - { - category: codeScanningUploadCategory, - rate: want.CodeScanningUpload, - }, - { - category: actionsRunnerRegistrationCategory, - rate: want.ActionsRunnerRegistration, - }, - { - category: scimCategory, - rate: want.SCIM, - }, - } - - for _, tt := range tests { - if got, want := client.rateLimits[tt.category], *tt.rate; got != want { - t.Errorf("client.rateLimits[%v] is %+v, want %+v", tt.category, got, want) - } - } -} - -func TestRateLimits_coverage(t *testing.T) { - client, _, _, teardown := setup() - defer teardown() - - ctx := context.Background() - - const methodName = "RateLimits" - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - _, resp, err := client.RateLimits(ctx) - return resp, err - }) -} - -func TestRateLimits_overQuota(t *testing.T) { - client, mux, _, teardown := setup() - defer teardown() - - client.rateLimits[coreCategory] = Rate{ - Limit: 1, - Remaining: 0, - Reset: Timestamp{time.Now().Add(time.Hour).Local()}, - } - mux.HandleFunc("/rate_limit", func(w http.ResponseWriter, r *http.Request) { - fmt.Fprint(w, `{"resources":{ - "core": {"limit":2,"remaining":1,"reset":1372700873}, - "search": {"limit":3,"remaining":2,"reset":1372700874}, - "graphql": {"limit":4,"remaining":3,"reset":1372700875}, - "integration_manifest": {"limit":5,"remaining":4,"reset":1372700876}, - "source_import": {"limit":6,"remaining":5,"reset":1372700877}, - "code_scanning_upload": {"limit":7,"remaining":6,"reset":1372700878}, - "actions_runner_registration": {"limit":8,"remaining":7,"reset":1372700879}, - "scim": {"limit":9,"remaining":8,"reset":1372700880} - }}`) - }) - - ctx := context.Background() - rate, _, err := client.RateLimits(ctx) - if err != nil { - t.Errorf("RateLimits returned error: %v", err) - } - - want := &RateLimits{ - Core: &Rate{ - Limit: 2, - Remaining: 1, - Reset: Timestamp{time.Date(2013, time.July, 1, 17, 47, 53, 0, time.UTC).Local()}, - }, - Search: &Rate{ - Limit: 3, - Remaining: 2, - Reset: Timestamp{time.Date(2013, time.July, 1, 17, 47, 54, 0, time.UTC).Local()}, - }, - GraphQL: &Rate{ - Limit: 4, - Remaining: 3, - Reset: Timestamp{time.Date(2013, time.July, 1, 17, 47, 55, 0, time.UTC).Local()}, - }, - IntegrationManifest: &Rate{ - Limit: 5, - Remaining: 4, - Reset: Timestamp{time.Date(2013, time.July, 1, 17, 47, 56, 0, time.UTC).Local()}, - }, - SourceImport: &Rate{ - Limit: 6, - Remaining: 5, - Reset: Timestamp{time.Date(2013, time.July, 1, 17, 47, 57, 0, time.UTC).Local()}, - }, - CodeScanningUpload: &Rate{ - Limit: 7, - Remaining: 6, - Reset: Timestamp{time.Date(2013, time.July, 1, 17, 47, 58, 0, time.UTC).Local()}, - }, - ActionsRunnerRegistration: &Rate{ - Limit: 8, - Remaining: 7, - Reset: Timestamp{time.Date(2013, time.July, 1, 17, 47, 59, 0, time.UTC).Local()}, - }, - SCIM: &Rate{ - Limit: 9, - Remaining: 8, - Reset: Timestamp{time.Date(2013, time.July, 1, 17, 48, 00, 0, time.UTC).Local()}, - }, - } - if !cmp.Equal(rate, want) { - t.Errorf("RateLimits returned %+v, want %+v", rate, want) - } - - tests := []struct { - category rateLimitCategory - rate *Rate - }{ - { - category: coreCategory, - rate: want.Core, - }, - { - category: searchCategory, - rate: want.Search, - }, - { - category: graphqlCategory, - rate: want.GraphQL, - }, - { - category: integrationManifestCategory, - rate: want.IntegrationManifest, - }, - { - category: sourceImportCategory, - rate: want.SourceImport, - }, - { - category: codeScanningUploadCategory, - rate: want.CodeScanningUpload, - }, - { - category: actionsRunnerRegistrationCategory, - rate: want.ActionsRunnerRegistration, - }, - { - category: scimCategory, - rate: want.SCIM, - }, - } - for _, tt := range tests { - if got, want := client.rateLimits[tt.category], *tt.rate; got != want { - t.Errorf("client.rateLimits[%v] is %+v, want %+v", tt.category, got, want) - } - } -} - func TestSetCredentialsAsHeaders(t *testing.T) { req := new(http.Request) id, secret := "id", "secret" @@ -2770,116 +2508,6 @@ func TestError_Marshal(t *testing.T) { testJSONMarshal(t, u, want) } -func TestRate_Marshal(t *testing.T) { - testJSONMarshal(t, &Rate{}, "{}") - - u := &Rate{ - Limit: 1, - Remaining: 1, - Reset: Timestamp{referenceTime}, - } - - want := `{ - "limit": 1, - "remaining": 1, - "reset": ` + referenceTimeStr + ` - }` - - testJSONMarshal(t, u, want) -} - -func TestRateLimits_Marshal(t *testing.T) { - testJSONMarshal(t, &RateLimits{}, "{}") - - u := &RateLimits{ - Core: &Rate{ - Limit: 1, - Remaining: 1, - Reset: Timestamp{referenceTime}, - }, - Search: &Rate{ - Limit: 1, - Remaining: 1, - Reset: Timestamp{referenceTime}, - }, - GraphQL: &Rate{ - Limit: 1, - Remaining: 1, - Reset: Timestamp{referenceTime}, - }, - IntegrationManifest: &Rate{ - Limit: 1, - Remaining: 1, - Reset: Timestamp{referenceTime}, - }, - SourceImport: &Rate{ - Limit: 1, - Remaining: 1, - Reset: Timestamp{referenceTime}, - }, - CodeScanningUpload: &Rate{ - Limit: 1, - Remaining: 1, - Reset: Timestamp{referenceTime}, - }, - ActionsRunnerRegistration: &Rate{ - Limit: 1, - Remaining: 1, - Reset: Timestamp{referenceTime}, - }, - SCIM: &Rate{ - Limit: 1, - Remaining: 1, - Reset: Timestamp{referenceTime}, - }, - } - - want := `{ - "core": { - "limit": 1, - "remaining": 1, - "reset": ` + referenceTimeStr + ` - }, - "search": { - "limit": 1, - "remaining": 1, - "reset": ` + referenceTimeStr + ` - }, - "graphql": { - "limit": 1, - "remaining": 1, - "reset": ` + referenceTimeStr + ` - }, - "integration_manifest": { - "limit": 1, - "remaining": 1, - "reset": ` + referenceTimeStr + ` - }, - "source_import": { - "limit": 1, - "remaining": 1, - "reset": ` + referenceTimeStr + ` - }, - "code_scanning_upload": { - "limit": 1, - "remaining": 1, - "reset": ` + referenceTimeStr + ` - }, - "actions_runner_registration": { - "limit": 1, - "remaining": 1, - "reset": ` + referenceTimeStr + ` - }, - "scim": { - "limit": 1, - "remaining": 1, - "reset": ` + referenceTimeStr + ` - } - }` - - testJSONMarshal(t, u, want) -} - func TestParseTokenExpiration(t *testing.T) { tests := []struct { header string diff --git a/github/rate_limit.go b/github/rate_limit.go new file mode 100644 index 00000000000..4243a144033 --- /dev/null +++ b/github/rate_limit.go @@ -0,0 +1,109 @@ +// Copyright 2023 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import "context" + +// RateLimitService provides access to rate limit functions in the GitHub API. +type RateLimitService service + +// Rate represents the rate limit for the current client. +type Rate struct { + // The number of requests per hour the client is currently limited to. + Limit int `json:"limit"` + + // The number of remaining requests the client can make this hour. + Remaining int `json:"remaining"` + + // The time at which the current rate limit will reset. + Reset Timestamp `json:"reset"` +} + +func (r Rate) String() string { + return Stringify(r) +} + +// RateLimits represents the rate limits for the current client. +type RateLimits struct { + // The rate limit for non-search API requests. Unauthenticated + // requests are limited to 60 per hour. Authenticated requests are + // limited to 5,000 per hour. + // + // GitHub API docs: https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting + Core *Rate `json:"core"` + + // The rate limit for search API requests. Unauthenticated requests + // are limited to 10 requests per minutes. Authenticated requests are + // limited to 30 per minute. + // + // GitHub API docs: https://docs.github.com/en/rest/search#rate-limit + Search *Rate `json:"search"` + + // GitHub API docs: https://docs.github.com/en/graphql/overview/resource-limitations#rate-limit + GraphQL *Rate `json:"graphql"` + + // GitHub API dos: https://docs.github.com/en/rest/rate-limit + IntegrationManifest *Rate `json:"integration_manifest"` + + SourceImport *Rate `json:"source_import"` + CodeScanningUpload *Rate `json:"code_scanning_upload"` + ActionsRunnerRegistration *Rate `json:"actions_runner_registration"` + SCIM *Rate `json:"scim"` +} + +func (r RateLimits) String() string { + return Stringify(r) +} + +// RateLimits returns the rate limits for the current client. +func (s *RateLimitService) Get(ctx context.Context) (*RateLimits, *Response, error) { + req, err := s.client.NewRequest("GET", "rate_limit", nil) + if err != nil { + return nil, nil, err + } + + response := new(struct { + Resources *RateLimits `json:"resources"` + }) + + // This resource is not subject to rate limits. + ctx = context.WithValue(ctx, bypassRateLimitCheck, true) + resp, err := s.client.Do(ctx, req, response) + if err != nil { + return nil, resp, err + } + + if response.Resources != nil { + s.client.rateMu.Lock() + if response.Resources.Core != nil { + s.client.rateLimits[coreCategory] = *response.Resources.Core + } + if response.Resources.Search != nil { + s.client.rateLimits[searchCategory] = *response.Resources.Search + } + if response.Resources.GraphQL != nil { + s.client.rateLimits[graphqlCategory] = *response.Resources.GraphQL + } + if response.Resources.IntegrationManifest != nil { + s.client.rateLimits[integrationManifestCategory] = *response.Resources.IntegrationManifest + } + if response.Resources.SourceImport != nil { + s.client.rateLimits[sourceImportCategory] = *response.Resources.SourceImport + } + if response.Resources.CodeScanningUpload != nil { + s.client.rateLimits[codeScanningUploadCategory] = *response.Resources.CodeScanningUpload + } + if response.Resources.ActionsRunnerRegistration != nil { + s.client.rateLimits[actionsRunnerRegistrationCategory] = *response.Resources.ActionsRunnerRegistration + } + if response.Resources.SCIM != nil { + s.client.rateLimits[scimCategory] = *response.Resources.SCIM + } + s.client.rateMu.Unlock() + } + + return response.Resources, resp, nil +} diff --git a/github/rate_limit_test.go b/github/rate_limit_test.go new file mode 100644 index 00000000000..167288bc889 --- /dev/null +++ b/github/rate_limit_test.go @@ -0,0 +1,388 @@ +// Copyright 2023 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" + "net/http" + "testing" + "time" + + "github.com/google/go-cmp/cmp" +) + +func TestRateLimits_String(t *testing.T) { + v := RateLimits{ + Core: &Rate{}, + Search: &Rate{}, + GraphQL: &Rate{}, + IntegrationManifest: &Rate{}, + SourceImport: &Rate{}, + CodeScanningUpload: &Rate{}, + ActionsRunnerRegistration: &Rate{}, + SCIM: &Rate{}, + } + want := `github.RateLimits{Core:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, Search:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, GraphQL:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, IntegrationManifest:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, SourceImport:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, CodeScanningUpload:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, ActionsRunnerRegistration:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, SCIM:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}}` + if got := v.String(); got != want { + t.Errorf("RateLimits.String = %v, want %v", got, want) + } +} + +func TestRateLimits(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/rate_limit", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + fmt.Fprint(w, `{"resources":{ + "core": {"limit":2,"remaining":1,"reset":1372700873}, + "search": {"limit":3,"remaining":2,"reset":1372700874}, + "graphql": {"limit":4,"remaining":3,"reset":1372700875}, + "integration_manifest": {"limit":5,"remaining":4,"reset":1372700876}, + "source_import": {"limit":6,"remaining":5,"reset":1372700877}, + "code_scanning_upload": {"limit":7,"remaining":6,"reset":1372700878}, + "actions_runner_registration": {"limit":8,"remaining":7,"reset":1372700879}, + "scim": {"limit":9,"remaining":8,"reset":1372700880} + }}`) + }) + + ctx := context.Background() + rate, _, err := client.RateLimit.Get(ctx) + if err != nil { + t.Errorf("RateLimits returned error: %v", err) + } + + want := &RateLimits{ + Core: &Rate{ + Limit: 2, + Remaining: 1, + Reset: Timestamp{time.Date(2013, time.July, 1, 17, 47, 53, 0, time.UTC).Local()}, + }, + Search: &Rate{ + Limit: 3, + Remaining: 2, + Reset: Timestamp{time.Date(2013, time.July, 1, 17, 47, 54, 0, time.UTC).Local()}, + }, + GraphQL: &Rate{ + Limit: 4, + Remaining: 3, + Reset: Timestamp{time.Date(2013, time.July, 1, 17, 47, 55, 0, time.UTC).Local()}, + }, + IntegrationManifest: &Rate{ + Limit: 5, + Remaining: 4, + Reset: Timestamp{time.Date(2013, time.July, 1, 17, 47, 56, 0, time.UTC).Local()}, + }, + SourceImport: &Rate{ + Limit: 6, + Remaining: 5, + Reset: Timestamp{time.Date(2013, time.July, 1, 17, 47, 57, 0, time.UTC).Local()}, + }, + CodeScanningUpload: &Rate{ + Limit: 7, + Remaining: 6, + Reset: Timestamp{time.Date(2013, time.July, 1, 17, 47, 58, 0, time.UTC).Local()}, + }, + ActionsRunnerRegistration: &Rate{ + Limit: 8, + Remaining: 7, + Reset: Timestamp{time.Date(2013, time.July, 1, 17, 47, 59, 0, time.UTC).Local()}, + }, + SCIM: &Rate{ + Limit: 9, + Remaining: 8, + Reset: Timestamp{time.Date(2013, time.July, 1, 17, 48, 00, 0, time.UTC).Local()}, + }, + } + if !cmp.Equal(rate, want) { + t.Errorf("RateLimits returned %+v, want %+v", rate, want) + } + tests := []struct { + category rateLimitCategory + rate *Rate + }{ + { + category: coreCategory, + rate: want.Core, + }, + { + category: searchCategory, + rate: want.Search, + }, + { + category: graphqlCategory, + rate: want.GraphQL, + }, + { + category: integrationManifestCategory, + rate: want.IntegrationManifest, + }, + { + category: sourceImportCategory, + rate: want.SourceImport, + }, + { + category: codeScanningUploadCategory, + rate: want.CodeScanningUpload, + }, + { + category: actionsRunnerRegistrationCategory, + rate: want.ActionsRunnerRegistration, + }, + { + category: scimCategory, + rate: want.SCIM, + }, + } + + for _, tt := range tests { + if got, want := client.rateLimits[tt.category], *tt.rate; got != want { + t.Errorf("client.rateLimits[%v] is %+v, want %+v", tt.category, got, want) + } + } +} + +func TestRateLimits_coverage(t *testing.T) { + client, _, _, teardown := setup() + defer teardown() + + ctx := context.Background() + + const methodName = "RateLimits" + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + _, resp, err := client.RateLimit.Get(ctx) + return resp, err + }) +} + +func TestRateLimits_overQuota(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + client.rateLimits[coreCategory] = Rate{ + Limit: 1, + Remaining: 0, + Reset: Timestamp{time.Now().Add(time.Hour).Local()}, + } + mux.HandleFunc("/rate_limit", func(w http.ResponseWriter, r *http.Request) { + fmt.Fprint(w, `{"resources":{ + "core": {"limit":2,"remaining":1,"reset":1372700873}, + "search": {"limit":3,"remaining":2,"reset":1372700874}, + "graphql": {"limit":4,"remaining":3,"reset":1372700875}, + "integration_manifest": {"limit":5,"remaining":4,"reset":1372700876}, + "source_import": {"limit":6,"remaining":5,"reset":1372700877}, + "code_scanning_upload": {"limit":7,"remaining":6,"reset":1372700878}, + "actions_runner_registration": {"limit":8,"remaining":7,"reset":1372700879}, + "scim": {"limit":9,"remaining":8,"reset":1372700880} + }}`) + }) + + ctx := context.Background() + rate, _, err := client.RateLimit.Get(ctx) + if err != nil { + t.Errorf("RateLimits returned error: %v", err) + } + + want := &RateLimits{ + Core: &Rate{ + Limit: 2, + Remaining: 1, + Reset: Timestamp{time.Date(2013, time.July, 1, 17, 47, 53, 0, time.UTC).Local()}, + }, + Search: &Rate{ + Limit: 3, + Remaining: 2, + Reset: Timestamp{time.Date(2013, time.July, 1, 17, 47, 54, 0, time.UTC).Local()}, + }, + GraphQL: &Rate{ + Limit: 4, + Remaining: 3, + Reset: Timestamp{time.Date(2013, time.July, 1, 17, 47, 55, 0, time.UTC).Local()}, + }, + IntegrationManifest: &Rate{ + Limit: 5, + Remaining: 4, + Reset: Timestamp{time.Date(2013, time.July, 1, 17, 47, 56, 0, time.UTC).Local()}, + }, + SourceImport: &Rate{ + Limit: 6, + Remaining: 5, + Reset: Timestamp{time.Date(2013, time.July, 1, 17, 47, 57, 0, time.UTC).Local()}, + }, + CodeScanningUpload: &Rate{ + Limit: 7, + Remaining: 6, + Reset: Timestamp{time.Date(2013, time.July, 1, 17, 47, 58, 0, time.UTC).Local()}, + }, + ActionsRunnerRegistration: &Rate{ + Limit: 8, + Remaining: 7, + Reset: Timestamp{time.Date(2013, time.July, 1, 17, 47, 59, 0, time.UTC).Local()}, + }, + SCIM: &Rate{ + Limit: 9, + Remaining: 8, + Reset: Timestamp{time.Date(2013, time.July, 1, 17, 48, 00, 0, time.UTC).Local()}, + }, + } + if !cmp.Equal(rate, want) { + t.Errorf("RateLimits returned %+v, want %+v", rate, want) + } + + tests := []struct { + category rateLimitCategory + rate *Rate + }{ + { + category: coreCategory, + rate: want.Core, + }, + { + category: searchCategory, + rate: want.Search, + }, + { + category: graphqlCategory, + rate: want.GraphQL, + }, + { + category: integrationManifestCategory, + rate: want.IntegrationManifest, + }, + { + category: sourceImportCategory, + rate: want.SourceImport, + }, + { + category: codeScanningUploadCategory, + rate: want.CodeScanningUpload, + }, + { + category: actionsRunnerRegistrationCategory, + rate: want.ActionsRunnerRegistration, + }, + { + category: scimCategory, + rate: want.SCIM, + }, + } + for _, tt := range tests { + if got, want := client.rateLimits[tt.category], *tt.rate; got != want { + t.Errorf("client.rateLimits[%v] is %+v, want %+v", tt.category, got, want) + } + } +} + +func TestRateLimits_Marshal(t *testing.T) { + testJSONMarshal(t, &RateLimits{}, "{}") + + u := &RateLimits{ + Core: &Rate{ + Limit: 1, + Remaining: 1, + Reset: Timestamp{referenceTime}, + }, + Search: &Rate{ + Limit: 1, + Remaining: 1, + Reset: Timestamp{referenceTime}, + }, + GraphQL: &Rate{ + Limit: 1, + Remaining: 1, + Reset: Timestamp{referenceTime}, + }, + IntegrationManifest: &Rate{ + Limit: 1, + Remaining: 1, + Reset: Timestamp{referenceTime}, + }, + SourceImport: &Rate{ + Limit: 1, + Remaining: 1, + Reset: Timestamp{referenceTime}, + }, + CodeScanningUpload: &Rate{ + Limit: 1, + Remaining: 1, + Reset: Timestamp{referenceTime}, + }, + ActionsRunnerRegistration: &Rate{ + Limit: 1, + Remaining: 1, + Reset: Timestamp{referenceTime}, + }, + SCIM: &Rate{ + Limit: 1, + Remaining: 1, + Reset: Timestamp{referenceTime}, + }, + } + + want := `{ + "core": { + "limit": 1, + "remaining": 1, + "reset": ` + referenceTimeStr + ` + }, + "search": { + "limit": 1, + "remaining": 1, + "reset": ` + referenceTimeStr + ` + }, + "graphql": { + "limit": 1, + "remaining": 1, + "reset": ` + referenceTimeStr + ` + }, + "integration_manifest": { + "limit": 1, + "remaining": 1, + "reset": ` + referenceTimeStr + ` + }, + "source_import": { + "limit": 1, + "remaining": 1, + "reset": ` + referenceTimeStr + ` + }, + "code_scanning_upload": { + "limit": 1, + "remaining": 1, + "reset": ` + referenceTimeStr + ` + }, + "actions_runner_registration": { + "limit": 1, + "remaining": 1, + "reset": ` + referenceTimeStr + ` + }, + "scim": { + "limit": 1, + "remaining": 1, + "reset": ` + referenceTimeStr + ` + } + }` + + testJSONMarshal(t, u, want) +} + +func TestRate_Marshal(t *testing.T) { + testJSONMarshal(t, &Rate{}, "{}") + + u := &Rate{ + Limit: 1, + Remaining: 1, + Reset: Timestamp{referenceTime}, + } + + want := `{ + "limit": 1, + "remaining": 1, + "reset": ` + referenceTimeStr + ` + }` + + testJSONMarshal(t, u, want) +} diff --git a/test/integration/misc_test.go b/test/integration/misc_test.go index 6ffb163fdcd..0e9ef6e01e7 100644 --- a/test/integration/misc_test.go +++ b/test/integration/misc_test.go @@ -49,7 +49,7 @@ func TestAPIMeta(t *testing.T) { } func TestRateLimits(t *testing.T) { - limits, _, err := client.RateLimits(context.Background()) + limits, _, err := client.RateLimit.Get(context.Background()) if err != nil { t.Fatalf("RateLimits returned error: %v", err) } From 3c49fd961c0c3119e9242500028b1774fd92214e Mon Sep 17 00:00:00 2001 From: Rajat Jindal Date: Mon, 23 Oct 2023 22:57:16 +0530 Subject: [PATCH 048/145] Add nil check in ErrorResponse.Error method (#2971) Fixes: #2970. --- github/github.go | 14 +++++++++++--- github/github_test.go | 13 +++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/github/github.go b/github/github.go index edd86ab2ad8..834aa86bc6a 100644 --- a/github/github.go +++ b/github/github.go @@ -1017,9 +1017,17 @@ type ErrorBlock struct { } func (r *ErrorResponse) Error() string { - return fmt.Sprintf("%v %v: %d %v %+v", - r.Response.Request.Method, sanitizeURL(r.Response.Request.URL), - r.Response.StatusCode, r.Message, r.Errors) + if r.Response != nil && r.Response.Request != nil { + return fmt.Sprintf("%v %v: %d %v %+v", + r.Response.Request.Method, sanitizeURL(r.Response.Request.URL), + r.Response.StatusCode, r.Message, r.Errors) + } + + if r.Response != nil { + return fmt.Sprintf("%d %v %+v", r.Response.StatusCode, r.Message, r.Errors) + } + + return fmt.Sprintf("%v %+v", r.Message, r.Errors) } // Is returns whether the provided error equals this error. diff --git a/github/github_test.go b/github/github_test.go index 90e95b035f5..b994496cc01 100644 --- a/github/github_test.go +++ b/github/github_test.go @@ -2097,6 +2097,19 @@ func TestErrorResponse_Error(t *testing.T) { if err.Error() == "" { t.Errorf("Expected non-empty ErrorResponse.Error()") } + + //dont panic if request is nil + res = &http.Response{} + err = ErrorResponse{Message: "m", Response: res} + if err.Error() == "" { + t.Errorf("Expected non-empty ErrorResponse.Error()") + } + + //dont panic if response is nil + err = ErrorResponse{Message: "m"} + if err.Error() == "" { + t.Errorf("Expected non-empty ErrorResponse.Error()") + } } func TestError_Error(t *testing.T) { From 66ed84deba8936684a4a6bb09b00135f326064fc Mon Sep 17 00:00:00 2001 From: WillAbides <233500+WillAbides@users.noreply.github.com> Date: Mon, 23 Oct 2023 14:28:03 -0500 Subject: [PATCH 049/145] Lint godoc comments (#2972) --- .golangci.yml | 13 +++++++++++++ github/actions_permissions_enterprise.go | 2 +- github/actions_permissions_orgs.go | 2 +- github/codesofconduct.go | 6 ++++-- github/codespaces.go | 2 +- github/emojis.go | 3 ++- github/event_types.go | 2 +- github/issues.go | 2 +- github/messages.go | 2 +- github/meta.go | 10 +++++++--- github/orgs_packages.go | 16 ++++++++-------- github/rate_limit.go | 2 +- github/reactions.go | 2 +- github/repos.go | 3 ++- github/repos_pages.go | 2 +- github/repos_rules.go | 2 +- github/secret_scanning.go | 12 ++++++------ github/users_packages.go | 16 ++++++++-------- github/users_ssh_signing_keys.go | 2 +- 19 files changed, 61 insertions(+), 40 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index d1ec5b11c92..1770bd2e417 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -18,10 +18,13 @@ linters: linters-settings: gosec: excludes: + # duplicates errcheck + - G104 # performance issue: see https://github.com/golangci/golangci-lint/issues/4039 # and https://github.com/securego/gosec/issues/1007 - G602 issues: + exclude-use-default: false exclude-rules: - linters: - dupl @@ -38,3 +41,13 @@ issues: # We need to use sha1 for validating signatures - linters: [ gosec ] text: 'G505: Blocklisted import crypto/sha1: weak cryptographic primitive' + + # This is adapted from golangci-lint's default exclusions. It disables linting for error checks on + # os.RemoveAll and any function ending in "Close". + - linters: [ errcheck ] + text: Error return value of .(.*Close|os\.Remove(All)?). is not checked + + # We don't care about file inclusion via variable in examples or internal tools. + - linters: [ gosec ] + text: 'G304: Potential file inclusion via variable' + path: '^(example|update-urls)\/' diff --git a/github/actions_permissions_enterprise.go b/github/actions_permissions_enterprise.go index 8311e729438..1d97fc91b4f 100644 --- a/github/actions_permissions_enterprise.go +++ b/github/actions_permissions_enterprise.go @@ -10,7 +10,7 @@ import ( "fmt" ) -// ActionsEnabledOnEnterpriseOrgs represents all the repositories in an enterprise for which Actions is enabled. +// ActionsEnabledOnEnterpriseRepos represents all the repositories in an enterprise for which Actions is enabled. type ActionsEnabledOnEnterpriseRepos struct { TotalCount int `json:"total_count"` Organizations []*Organization `json:"organizations"` diff --git a/github/actions_permissions_orgs.go b/github/actions_permissions_orgs.go index 801f1d97437..d55a2d45a61 100644 --- a/github/actions_permissions_orgs.go +++ b/github/actions_permissions_orgs.go @@ -145,7 +145,7 @@ func (s *ActionsService) AddEnabledReposInOrg(ctx context.Context, owner string, return resp, nil } -// RemoveEnabledRepoInOrg removes a single repository from the list of enabled repos for GitHub Actions in an organization. +// RemoveEnabledReposInOrg removes a single repository from the list of enabled repos for GitHub Actions in an organization. // // GitHub API docs: https://docs.github.com/en/rest/actions/permissions#disable-a-selected-repository-for-github-actions-in-an-organization func (s *ActionsService) RemoveEnabledReposInOrg(ctx context.Context, owner string, repositoryID int64) (*Response, error) { diff --git a/github/codesofconduct.go b/github/codesofconduct.go index 4318ba56d2c..11e1fb38df0 100644 --- a/github/codesofconduct.go +++ b/github/codesofconduct.go @@ -46,7 +46,8 @@ func (s *CodesOfConductService) List(ctx context.Context) ([]*CodeOfConduct, *Re return cs, resp, nil } -// ListCodesOfConduct +// ListCodesOfConduct returns all codes of conduct. +// // Deprecated: Use CodesOfConductService.List instead func (c *Client) ListCodesOfConduct(ctx context.Context) ([]*CodeOfConduct, *Response, error) { return c.CodesOfConduct.List(ctx) @@ -74,7 +75,8 @@ func (s *CodesOfConductService) Get(ctx context.Context, key string) (*CodeOfCon return coc, resp, nil } -// GetCodeOfConduct +// GetCodeOfConduct returns an individual code of conduct. +// // Deprecated: Use CodesOfConductService.Get instead func (c *Client) GetCodeOfConduct(ctx context.Context, key string) (*CodeOfConduct, *Response, error) { return c.CodesOfConduct.Get(ctx, key) diff --git a/github/codespaces.go b/github/codespaces.go index cd8b0e5bee5..f2e6a284cf0 100644 --- a/github/codespaces.go +++ b/github/codespaces.go @@ -112,7 +112,7 @@ func (s *CodespacesService) ListInRepo(ctx context.Context, owner, repo string, return codespaces, resp, nil } -// ListOptions represents the options for listing codespaces for a user. +// ListCodespacesOptions represents the options for listing codespaces for a user. type ListCodespacesOptions struct { ListOptions RepositoryID int64 `url:"repository_id,omitempty"` diff --git a/github/emojis.go b/github/emojis.go index 15b57130b3b..5a2c86baa38 100644 --- a/github/emojis.go +++ b/github/emojis.go @@ -30,7 +30,8 @@ func (s *EmojisService) List(ctx context.Context) (map[string]string, *Response, return emoji, resp, nil } -// ListEmojis +// ListEmojis returns the emojis available to use on GitHub. +// // Deprecated: Use EmojisService.List instead func (c *Client) ListEmojis(ctx context.Context) (map[string]string, *Response, error) { return c.Emojis.List(ctx) diff --git a/github/event_types.go b/github/event_types.go index e91d22686ff..c270f6bcf0a 100644 --- a/github/event_types.go +++ b/github/event_types.go @@ -1069,7 +1069,7 @@ type ArchivedAt struct { To *Timestamp `json:"to,omitempty"` } -// ProjectsV2 represents an item belonging to a project. +// ProjectV2Item represents an item belonging to a project. type ProjectV2Item struct { ID *int64 `json:"id,omitempty"` NodeID *string `json:"node_id,omitempty"` diff --git a/github/issues.go b/github/issues.go index 42e58a17a8a..44364811d3f 100644 --- a/github/issues.go +++ b/github/issues.go @@ -303,7 +303,7 @@ func (s *IssuesService) Edit(ctx context.Context, owner string, repo string, num return i, resp, nil } -// Remove a milestone from an issue. +// RemoveMilestone removes a milestone from an issue. // // This is a helper method to explicitly update an issue with a `null` milestone, thereby removing it. // diff --git a/github/messages.go b/github/messages.go index c16b6015284..0d9811549c2 100644 --- a/github/messages.go +++ b/github/messages.go @@ -326,7 +326,7 @@ func ParseWebHook(messageType string, payload []byte) (interface{}, error) { return event.ParsePayload() } -// WebhookTypes returns a sorted list of all the known GitHub event type strings +// MessageTypes returns a sorted list of all the known GitHub event type strings // supported by go-github. func MessageTypes() []string { types := make([]string, 0, len(eventTypeMapping)) diff --git a/github/meta.go b/github/meta.go index 57fa8ccf588..3e9743b00cb 100644 --- a/github/meta.go +++ b/github/meta.go @@ -87,7 +87,8 @@ func (s *MetaService) Get(ctx context.Context) (*APIMeta, *Response, error) { return meta, resp, nil } -// APIMeta +// APIMeta returns information about GitHub.com. +// // Deprecated: Use MetaService.Get instead. func (c *Client) APIMeta(ctx context.Context) (*APIMeta, *Response, error) { return c.Meta.Get(ctx) @@ -117,7 +118,9 @@ func (s *MetaService) Octocat(ctx context.Context, message string) (string, *Res return buf.String(), resp, nil } -// Octocat +// Octocat returns an ASCII art octocat with the specified message in a speech +// bubble. If message is empty, a random zen phrase is used. +// // Deprecated: Use MetaService.Octocat instead. func (c *Client) Octocat(ctx context.Context, message string) (string, *Response, error) { return c.Meta.Octocat(ctx, message) @@ -143,7 +146,8 @@ func (s *MetaService) Zen(ctx context.Context) (string, *Response, error) { return buf.String(), resp, nil } -// Zen +// Zen returns a random line from The Zen of GitHub. +// // Deprecated: Use MetaService.Zen instead. func (c *Client) Zen(ctx context.Context) (string, *Response, error) { return c.Meta.Zen(ctx) diff --git a/github/orgs_packages.go b/github/orgs_packages.go index 0ae68aaa369..449b3dd3e91 100644 --- a/github/orgs_packages.go +++ b/github/orgs_packages.go @@ -10,7 +10,7 @@ import ( "fmt" ) -// List the packages for an organization. +// ListPackages lists the packages for an organization. // // GitHub API docs: https://docs.github.com/en/rest/packages#list-packages-for-an-organization func (s *OrganizationsService) ListPackages(ctx context.Context, org string, opts *PackageListOptions) ([]*Package, *Response, error) { @@ -34,7 +34,7 @@ func (s *OrganizationsService) ListPackages(ctx context.Context, org string, opt return packages, resp, nil } -// Get a package by name from an organization. +// GetPackage gets a package by name from an organization. // // GitHub API docs: https://docs.github.com/en/rest/packages#get-a-package-for-an-organization func (s *OrganizationsService) GetPackage(ctx context.Context, org, packageType, packageName string) (*Package, *Response, error) { @@ -53,7 +53,7 @@ func (s *OrganizationsService) GetPackage(ctx context.Context, org, packageType, return pack, resp, nil } -// Delete a package from an organization. +// DeletePackage deletes a package from an organization. // // GitHub API docs: https://docs.github.com/en/rest/packages#delete-a-package-for-an-organization func (s *OrganizationsService) DeletePackage(ctx context.Context, org, packageType, packageName string) (*Response, error) { @@ -66,7 +66,7 @@ func (s *OrganizationsService) DeletePackage(ctx context.Context, org, packageTy return s.client.Do(ctx, req, nil) } -// Restore a package to an organization. +// RestorePackage restores a package to an organization. // // GitHub API docs: https://docs.github.com/en/rest/packages#restore-a-package-for-an-organization func (s *OrganizationsService) RestorePackage(ctx context.Context, org, packageType, packageName string) (*Response, error) { @@ -79,7 +79,7 @@ func (s *OrganizationsService) RestorePackage(ctx context.Context, org, packageT return s.client.Do(ctx, req, nil) } -// Get all versions of a package in an organization. +// PackageGetAllVersions gets all versions of a package in an organization. // // GitHub API docs: https://docs.github.com/en/rest/packages#list-package-versions-for-a-package-owned-by-an-organization func (s *OrganizationsService) PackageGetAllVersions(ctx context.Context, org, packageType, packageName string, opts *PackageListOptions) ([]*PackageVersion, *Response, error) { @@ -103,7 +103,7 @@ func (s *OrganizationsService) PackageGetAllVersions(ctx context.Context, org, p return versions, resp, nil } -// Get a specific version of a package in an organization. +// PackageGetVersion gets a specific version of a package in an organization. // // GitHub API docs: https://docs.github.com/en/rest/packages#get-a-package-version-for-an-organization func (s *OrganizationsService) PackageGetVersion(ctx context.Context, org, packageType, packageName string, packageVersionID int64) (*PackageVersion, *Response, error) { @@ -122,7 +122,7 @@ func (s *OrganizationsService) PackageGetVersion(ctx context.Context, org, packa return version, resp, nil } -// Delete a package version from an organization. +// PackageDeleteVersion deletes a package version from an organization. // // GitHub API docs: https://docs.github.com/en/rest/packages#delete-package-version-for-an-organization func (s *OrganizationsService) PackageDeleteVersion(ctx context.Context, org, packageType, packageName string, packageVersionID int64) (*Response, error) { @@ -135,7 +135,7 @@ func (s *OrganizationsService) PackageDeleteVersion(ctx context.Context, org, pa return s.client.Do(ctx, req, nil) } -// Restore a package version to an organization. +// PackageRestoreVersion restores a package version to an organization. // // GitHub API docs: https://docs.github.com/en/rest/packages#restore-package-version-for-an-organization func (s *OrganizationsService) PackageRestoreVersion(ctx context.Context, org, packageType, packageName string, packageVersionID int64) (*Response, error) { diff --git a/github/rate_limit.go b/github/rate_limit.go index 4243a144033..838c3ba7966 100644 --- a/github/rate_limit.go +++ b/github/rate_limit.go @@ -58,7 +58,7 @@ func (r RateLimits) String() string { return Stringify(r) } -// RateLimits returns the rate limits for the current client. +// Get returns the rate limits for the current client. func (s *RateLimitService) Get(ctx context.Context) (*RateLimits, *Response, error) { req, err := s.client.NewRequest("GET", "rate_limit", nil) if err != nil { diff --git a/github/reactions.go b/github/reactions.go index 14d193ae887..f06a8ef3dbc 100644 --- a/github/reactions.go +++ b/github/reactions.go @@ -493,7 +493,7 @@ func (s *ReactionsService) deleteReaction(ctx context.Context, url string) (*Res return s.client.Do(ctx, req, nil) } -// Create a reaction to a release. +// CreateReleaseReaction creates a reaction to a release. // Note that a response with a Status: 200 OK means that you already // added the reaction type to this release. // The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes". diff --git a/github/repos.go b/github/repos.go index f2059926ec8..60ff9b41347 100644 --- a/github/repos.go +++ b/github/repos.go @@ -1153,7 +1153,8 @@ type AllowForcePushes struct { Enabled bool `json:"enabled"` } -// RequiredConversationResolution, if enabled, requires all comments on the pull request to be resolved before it can be merged to a protected branch. +// RequiredConversationResolution requires all comments on the pull request to be resolved before it can be +// merged to a protected branch when enabled. type RequiredConversationResolution struct { Enabled bool `json:"enabled"` } diff --git a/github/repos_pages.go b/github/repos_pages.go index 83075dbdd23..060f6eb8b1d 100644 --- a/github/repos_pages.go +++ b/github/repos_pages.go @@ -286,7 +286,7 @@ func (s *RepositoriesService) RequestPageBuild(ctx context.Context, owner, repo return build, resp, nil } -// GetPagesHealthCheck gets a DNS health check for the CNAME record configured for a repository's GitHub Pages. +// GetPageHealthCheck gets a DNS health check for the CNAME record configured for a repository's GitHub Pages. // // GitHub API docs: https://docs.github.com/en/rest/pages#get-a-dns-health-check-for-github-pages func (s *RepositoriesService) GetPageHealthCheck(ctx context.Context, owner, repo string) (*PagesHealthCheckResponse, *Response, error) { diff --git a/github/repos_rules.go b/github/repos_rules.go index 7f964fe6655..2c24f8c27b3 100644 --- a/github/repos_rules.go +++ b/github/repos_rules.go @@ -48,7 +48,7 @@ type RulesetRepositoryIDsConditionParameters struct { RepositoryIDs []int64 `json:"repository_ids,omitempty"` } -// RulesetCondition represents the conditions object in a ruleset. +// RulesetConditions represents the conditions object in a ruleset. // Set either RepositoryName or RepositoryID, not both. type RulesetConditions struct { RefName *RulesetRefConditionParameters `json:"ref_name,omitempty"` diff --git a/github/secret_scanning.go b/github/secret_scanning.go index 30d3da8ebf8..ddcbfc1b667 100644 --- a/github/secret_scanning.go +++ b/github/secret_scanning.go @@ -90,7 +90,7 @@ type SecretScanningAlertUpdateOptions struct { Resolution *string `json:"resolution,omitempty"` } -// Lists secret scanning alerts for eligible repositories in an enterprise, from newest to oldest. +// ListAlertsForEnterprise lists secret scanning alerts for eligible repositories in an enterprise, from newest to oldest. // // To use this endpoint, you must be a member of the enterprise, and you must use an access token with the repo scope or // security_events scope. Alerts are only returned for organizations in the enterprise for which you are an organization owner or a security manager. @@ -117,7 +117,7 @@ func (s *SecretScanningService) ListAlertsForEnterprise(ctx context.Context, ent return alerts, resp, nil } -// Lists secret scanning alerts for eligible repositories in an organization, from newest to oldest. +// ListAlertsForOrg lists secret scanning alerts for eligible repositories in an organization, from newest to oldest. // // To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with // the repo scope or security_events scope. @@ -144,7 +144,7 @@ func (s *SecretScanningService) ListAlertsForOrg(ctx context.Context, org string return alerts, resp, nil } -// Lists secret scanning alerts for a private repository, from newest to oldest. +// ListAlertsForRepo lists secret scanning alerts for a private repository, from newest to oldest. // // To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with // the repo scope or security_events scope. @@ -171,7 +171,7 @@ func (s *SecretScanningService) ListAlertsForRepo(ctx context.Context, owner, re return alerts, resp, nil } -// Gets a single secret scanning alert detected in a private repository. +// GetAlert gets a single secret scanning alert detected in a private repository. // // To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with // the repo scope or security_events scope. @@ -194,7 +194,7 @@ func (s *SecretScanningService) GetAlert(ctx context.Context, owner, repo string return alert, resp, nil } -// Updates the status of a secret scanning alert in a private repository. +// UpdateAlert updates the status of a secret scanning alert in a private repository. // // To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with // the repo scope or security_events scope. @@ -217,7 +217,7 @@ func (s *SecretScanningService) UpdateAlert(ctx context.Context, owner, repo str return alert, resp, nil } -// Lists all locations for a given secret scanning alert for a private repository. +// ListLocationsForAlert lists all locations for a given secret scanning alert for a private repository. // // To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with // the repo scope or security_events scope. diff --git a/github/users_packages.go b/github/users_packages.go index da04919eccd..c3ffc6ab074 100644 --- a/github/users_packages.go +++ b/github/users_packages.go @@ -10,7 +10,7 @@ import ( "fmt" ) -// List the packages for a user. Passing the empty string for "user" will +// ListPackages lists the packages for a user. Passing the empty string for "user" will // list packages for the authenticated user. // // GitHub API docs: https://docs.github.com/en/rest/packages#list-packages-for-the-authenticated-users-namespace @@ -41,7 +41,7 @@ func (s *UsersService) ListPackages(ctx context.Context, user string, opts *Pack return packages, resp, nil } -// Get a package by name for a user. Passing the empty string for "user" will +// GetPackage gets a package by name for a user. Passing the empty string for "user" will // get the package for the authenticated user. // // GitHub API docs: https://docs.github.com/en/rest/packages#get-a-package-for-the-authenticated-user @@ -68,7 +68,7 @@ func (s *UsersService) GetPackage(ctx context.Context, user, packageType, packag return pack, resp, nil } -// Delete a package from a user. Passing the empty string for "user" will +// DeletePackage deletes a package from a user. Passing the empty string for "user" will // delete the package for the authenticated user. // // GitHub API docs: https://docs.github.com/en/rest/packages#delete-a-package-for-the-authenticated-user @@ -89,7 +89,7 @@ func (s *UsersService) DeletePackage(ctx context.Context, user, packageType, pac return s.client.Do(ctx, req, nil) } -// Restore a package to a user. Passing the empty string for "user" will +// RestorePackage restores a package to a user. Passing the empty string for "user" will // restore the package for the authenticated user. // // GitHub API docs: https://docs.github.com/en/rest/packages#restore-a-package-for-the-authenticated-user @@ -110,7 +110,7 @@ func (s *UsersService) RestorePackage(ctx context.Context, user, packageType, pa return s.client.Do(ctx, req, nil) } -// Get all versions of a package for a user. Passing the empty string for "user" will +// PackageGetAllVersions gets all versions of a package for a user. Passing the empty string for "user" will // get versions for the authenticated user. // // GitHub API docs: https://docs.github.com/en/rest/packages#get-all-package-versions-for-a-package-owned-by-the-authenticated-user @@ -141,7 +141,7 @@ func (s *UsersService) PackageGetAllVersions(ctx context.Context, user, packageT return versions, resp, nil } -// Get a specific version of a package for a user. Passing the empty string for "user" will +// PackageGetVersion gets a specific version of a package for a user. Passing the empty string for "user" will // get the version for the authenticated user. // // GitHub API docs: https://docs.github.com/en/rest/packages#get-a-package-version-for-the-authenticated-user @@ -168,7 +168,7 @@ func (s *UsersService) PackageGetVersion(ctx context.Context, user, packageType, return version, resp, nil } -// Delete a package version for a user. Passing the empty string for "user" will +// PackageDeleteVersion deletes a package version for a user. Passing the empty string for "user" will // delete the version for the authenticated user. // // GitHub API docs: https://docs.github.com/en/rest/packages#delete-a-package-version-for-the-authenticated-user @@ -189,7 +189,7 @@ func (s *UsersService) PackageDeleteVersion(ctx context.Context, user, packageTy return s.client.Do(ctx, req, nil) } -// Restore a package version to a user. Passing the empty string for "user" will +// PackageRestoreVersion restores a package version to a user. Passing the empty string for "user" will // restore the version for the authenticated user. // // GitHub API docs: https://docs.github.com/en/rest/packages#restore-a-package-version-for-the-authenticated-user diff --git a/github/users_ssh_signing_keys.go b/github/users_ssh_signing_keys.go index 567623f8875..23e4c36aea3 100644 --- a/github/users_ssh_signing_keys.go +++ b/github/users_ssh_signing_keys.go @@ -93,7 +93,7 @@ func (s *UsersService) CreateSSHSigningKey(ctx context.Context, key *Key) (*SSHS return k, resp, nil } -// DeleteKey deletes a SSH signing key for the authenticated user. +// DeleteSSHSigningKey deletes a SSH signing key for the authenticated user. // // GitHub API docs: https://docs.github.com/en/rest/users/ssh-signing-keys#delete-an-ssh-signing-key-for-the-authenticated-user func (s *UsersService) DeleteSSHSigningKey(ctx context.Context, id int64) (*Response, error) { From 5b34ea7816491eb20286d951b04081ab4de6d381 Mon Sep 17 00:00:00 2001 From: schaffe-cb <137919538+schaffe-cb@users.noreply.github.com> Date: Wed, 25 Oct 2023 14:00:20 -0700 Subject: [PATCH 050/145] Add referenced workflows to WorkflowRun (#2975) Fixes: #2974. --- github/actions_workflow_runs.go | 73 +++++++++++++++------------- github/actions_workflow_runs_test.go | 16 +++++- github/github-accessors.go | 24 +++++++++ github/github-accessors_test.go | 30 ++++++++++++ 4 files changed, 109 insertions(+), 34 deletions(-) diff --git a/github/actions_workflow_runs.go b/github/actions_workflow_runs.go index 390c26af9c3..d57e4887db1 100644 --- a/github/actions_workflow_runs.go +++ b/github/actions_workflow_runs.go @@ -14,39 +14,40 @@ import ( // WorkflowRun represents a repository action workflow run. type WorkflowRun struct { - ID *int64 `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - NodeID *string `json:"node_id,omitempty"` - HeadBranch *string `json:"head_branch,omitempty"` - HeadSHA *string `json:"head_sha,omitempty"` - RunNumber *int `json:"run_number,omitempty"` - RunAttempt *int `json:"run_attempt,omitempty"` - Event *string `json:"event,omitempty"` - DisplayTitle *string `json:"display_title,omitempty"` - Status *string `json:"status,omitempty"` - Conclusion *string `json:"conclusion,omitempty"` - WorkflowID *int64 `json:"workflow_id,omitempty"` - CheckSuiteID *int64 `json:"check_suite_id,omitempty"` - CheckSuiteNodeID *string `json:"check_suite_node_id,omitempty"` - URL *string `json:"url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - PullRequests []*PullRequest `json:"pull_requests,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - RunStartedAt *Timestamp `json:"run_started_at,omitempty"` - JobsURL *string `json:"jobs_url,omitempty"` - LogsURL *string `json:"logs_url,omitempty"` - CheckSuiteURL *string `json:"check_suite_url,omitempty"` - ArtifactsURL *string `json:"artifacts_url,omitempty"` - CancelURL *string `json:"cancel_url,omitempty"` - RerunURL *string `json:"rerun_url,omitempty"` - PreviousAttemptURL *string `json:"previous_attempt_url,omitempty"` - HeadCommit *HeadCommit `json:"head_commit,omitempty"` - WorkflowURL *string `json:"workflow_url,omitempty"` - Repository *Repository `json:"repository,omitempty"` - HeadRepository *Repository `json:"head_repository,omitempty"` - Actor *User `json:"actor,omitempty"` - TriggeringActor *User `json:"triggering_actor,omitempty"` + ID *int64 `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + NodeID *string `json:"node_id,omitempty"` + HeadBranch *string `json:"head_branch,omitempty"` + HeadSHA *string `json:"head_sha,omitempty"` + RunNumber *int `json:"run_number,omitempty"` + RunAttempt *int `json:"run_attempt,omitempty"` + Event *string `json:"event,omitempty"` + DisplayTitle *string `json:"display_title,omitempty"` + Status *string `json:"status,omitempty"` + Conclusion *string `json:"conclusion,omitempty"` + WorkflowID *int64 `json:"workflow_id,omitempty"` + CheckSuiteID *int64 `json:"check_suite_id,omitempty"` + CheckSuiteNodeID *string `json:"check_suite_node_id,omitempty"` + URL *string `json:"url,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + PullRequests []*PullRequest `json:"pull_requests,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + RunStartedAt *Timestamp `json:"run_started_at,omitempty"` + JobsURL *string `json:"jobs_url,omitempty"` + LogsURL *string `json:"logs_url,omitempty"` + CheckSuiteURL *string `json:"check_suite_url,omitempty"` + ArtifactsURL *string `json:"artifacts_url,omitempty"` + CancelURL *string `json:"cancel_url,omitempty"` + RerunURL *string `json:"rerun_url,omitempty"` + PreviousAttemptURL *string `json:"previous_attempt_url,omitempty"` + HeadCommit *HeadCommit `json:"head_commit,omitempty"` + WorkflowURL *string `json:"workflow_url,omitempty"` + Repository *Repository `json:"repository,omitempty"` + HeadRepository *Repository `json:"head_repository,omitempty"` + Actor *User `json:"actor,omitempty"` + TriggeringActor *User `json:"triggering_actor,omitempty"` + ReferencedWorkflows []*ReferencedWorkflow `json:"referenced_workflows,omitempty"` } // WorkflowRuns represents a slice of repository action workflow run. @@ -104,6 +105,12 @@ type PendingDeploymentsRequest struct { Comment string `json:"comment"` } +type ReferencedWorkflow struct { + Path *string `json:"path,omitempty"` + SHA *string `json:"sha,omitempty"` + Ref *string `json:"ref,omitempty"` +} + func (s *ActionsService) listWorkflowRuns(ctx context.Context, endpoint string, opts *ListWorkflowRunsOptions) (*WorkflowRuns, *Response, error) { u, err := addOptions(endpoint, opts) if err != nil { diff --git a/github/actions_workflow_runs_test.go b/github/actions_workflow_runs_test.go index 8a573c20ac2..b4b1c9177f6 100644 --- a/github/actions_workflow_runs_test.go +++ b/github/actions_workflow_runs_test.go @@ -761,6 +761,13 @@ func TestWorkflowRun_Marshal(t *testing.T) { SuspendedAt: &Timestamp{referenceTime}, URL: String("u2"), }, + ReferencedWorkflows: []*ReferencedWorkflow{ + { + Path: String("rwfp"), + SHA: String("rwfsha"), + Ref: String("rwfref"), + }, + }, } want := `{ @@ -881,7 +888,14 @@ func TestWorkflowRun_Marshal(t *testing.T) { "created_at": ` + referenceTimeStr + `, "suspended_at": ` + referenceTimeStr + `, "url": "u2" - } + }, + "referenced_workflows": [ + { + "path": "rwfp", + "sha": "rwfsha", + "ref": "rwfref" + } + ] }` testJSONMarshal(t, u, want) diff --git a/github/github-accessors.go b/github/github-accessors.go index 199c9b8a37d..fc79d01d7c8 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -17710,6 +17710,30 @@ func (r *Reference) GetURL() string { return *r.URL } +// GetPath returns the Path field if it's non-nil, zero value otherwise. +func (r *ReferencedWorkflow) GetPath() string { + if r == nil || r.Path == nil { + return "" + } + return *r.Path +} + +// GetRef returns the Ref field if it's non-nil, zero value otherwise. +func (r *ReferencedWorkflow) GetRef() string { + if r == nil || r.Ref == nil { + return "" + } + return *r.Ref +} + +// GetSHA returns the SHA field if it's non-nil, zero value otherwise. +func (r *ReferencedWorkflow) GetSHA() string { + if r == nil || r.SHA == nil { + return "" + } + return *r.SHA +} + // GetExpiresAt returns the ExpiresAt field if it's non-nil, zero value otherwise. func (r *RegistrationToken) GetExpiresAt() Timestamp { if r == nil || r.ExpiresAt == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index d179a927750..ff4a49d7fb7 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -20521,6 +20521,36 @@ func TestReference_GetURL(tt *testing.T) { r.GetURL() } +func TestReferencedWorkflow_GetPath(tt *testing.T) { + var zeroValue string + r := &ReferencedWorkflow{Path: &zeroValue} + r.GetPath() + r = &ReferencedWorkflow{} + r.GetPath() + r = nil + r.GetPath() +} + +func TestReferencedWorkflow_GetRef(tt *testing.T) { + var zeroValue string + r := &ReferencedWorkflow{Ref: &zeroValue} + r.GetRef() + r = &ReferencedWorkflow{} + r.GetRef() + r = nil + r.GetRef() +} + +func TestReferencedWorkflow_GetSHA(tt *testing.T) { + var zeroValue string + r := &ReferencedWorkflow{SHA: &zeroValue} + r.GetSHA() + r = &ReferencedWorkflow{} + r.GetSHA() + r = nil + r.GetSHA() +} + func TestRegistrationToken_GetExpiresAt(tt *testing.T) { var zeroValue Timestamp r := &RegistrationToken{ExpiresAt: &zeroValue} From a54bc7da1d91a3d2de234741640965ac9ece6d74 Mon Sep 17 00:00:00 2001 From: WillAbides <233500+WillAbides@users.noreply.github.com> Date: Fri, 3 Nov 2023 09:26:59 -0500 Subject: [PATCH 051/145] Use metadata to reconcile go-github with GitHub's OpenAPI descriptions (#2919) --- .codecov.yml | 4 +- .github/dependabot.yml | 2 +- .github/workflows/linter.yml | 3 + .golangci.yml | 2 +- CONTRIBUTING.md | 121 +- github/actions.go | 2 +- github/actions_artifacts.go | 26 +- github/actions_cache.go | 40 +- github/actions_oidc.go | 16 +- github/actions_permissions_enterprise.go | 16 + github/actions_permissions_orgs.go | 36 +- github/actions_required_workflows.go | 40 +- github/actions_runner_groups.go | 52 +- github/actions_runners.go | 56 +- github/actions_secrets.go | 76 +- github/actions_variables.go | 76 +- github/actions_workflow_jobs.go | 12 +- github/actions_workflow_runs.go | 60 +- github/actions_workflows.go | 44 +- github/activity.go | 6 +- github/activity_events.go | 38 +- github/activity_notifications.go | 38 +- github/activity_star.go | 23 +- github/activity_watching.go | 23 +- github/admin.go | 10 +- github/admin_orgs.go | 12 +- github/admin_stats.go | 4 +- github/admin_users.go | 16 +- github/apps.go | 65 +- github/apps_hooks.go | 8 +- github/apps_hooks_deliveries.go | 12 +- github/apps_installation.go | 20 +- github/apps_manifest.go | 4 +- github/apps_marketplace.go | 29 +- github/authorizations.go | 30 +- github/billing.go | 30 +- github/checks.go | 50 +- github/code-scanning.go | 70 +- github/codesofconduct.go | 4 + github/codespaces.go | 28 +- github/codespaces_secrets.go | 92 +- github/dependabot.go | 2 +- github/dependabot_alerts.go | 12 +- github/dependabot_secrets.go | 56 +- github/dependency_graph.go | 4 +- github/doc.go | 6 +- github/emojis.go | 2 + github/enterprise.go | 2 +- github/enterprise_actions_runner_groups.go | 52 +- github/enterprise_actions_runners.go | 20 +- github/enterprise_audit_log.go | 4 +- .../enterprise_code_security_and_analysis.go | 12 +- github/event_types.go | 124 +- github/gists.go | 61 +- github/gists_comments.go | 20 +- github/git.go | 2 +- github/git_blobs.go | 12 +- github/git_commits.go | 8 +- github/git_refs.go | 20 +- github/git_tags.go | 8 +- github/git_trees.go | 8 +- github/github.go | 23 +- github/gitignore.go | 10 +- github/interactions.go | 2 +- github/interactions_orgs.go | 12 +- github/interactions_repos.go | 12 +- github/issue_import.go | 12 +- github/issues.go | 43 +- github/issues_assignees.go | 16 +- github/issues_comments.go | 23 +- github/issues_events.go | 12 +- github/issues_labels.go | 44 +- github/issues_milestones.go | 20 +- github/issues_timeline.go | 6 +- github/licenses.go | 10 +- github/markdown.go | 2 + github/messages.go | 4 +- github/meta.go | 6 + github/migrations.go | 26 +- github/migrations_source_import.go | 36 +- github/migrations_user.go | 24 +- github/orgs.go | 33 +- github/orgs_actions_allowed.go | 10 +- github/orgs_actions_permissions.go | 10 +- github/orgs_audit_log.go | 6 +- github/orgs_credential_authorizations.go | 8 +- github/orgs_custom_roles.go | 18 +- github/orgs_hooks.go | 24 +- github/orgs_hooks_configuration.go | 8 +- github/orgs_hooks_deliveries.go | 12 +- github/orgs_members.go | 65 +- github/orgs_outside_collaborators.go | 12 +- github/orgs_packages.go | 32 +- github/orgs_personal_access_tokens.go | 4 +- github/orgs_projects.go | 8 +- github/orgs_rules.go | 20 +- github/orgs_security_managers.go | 12 +- github/orgs_users_blocking.go | 16 +- github/projects.go | 82 +- github/pulls.go | 48 +- github/pulls_comments.go | 29 +- github/pulls_reviewers.go | 12 +- github/pulls_reviews.go | 34 +- github/rate_limit.go | 4 + github/reactions.go | 102 +- github/repos.go | 268 +- github/repos_actions_access.go | 10 +- github/repos_actions_allowed.go | 8 +- github/repos_actions_permissions.go | 10 +- github/repos_autolinks.go | 16 +- github/repos_codeowners.go | 4 +- github/repos_collaborators.go | 22 +- github/repos_comments.go | 24 +- github/repos_commits.go | 29 +- github/repos_community_health.go | 4 +- github/repos_contents.go | 36 +- github/repos_deployment_branch_policies.go | 20 +- github/repos_deployments.go | 28 +- github/repos_environments.go | 18 +- github/repos_forks.go | 8 +- github/repos_hooks.go | 36 +- github/repos_hooks_configuration.go | 8 +- github/repos_hooks_deliveries.go | 16 +- github/repos_invitations.go | 12 +- github/repos_keys.go | 16 +- github/repos_lfs.go | 8 +- github/repos_merging.go | 8 +- github/repos_pages.go | 36 +- github/repos_prereceive_hooks.go | 16 +- github/repos_projects.go | 8 +- github/repos_releases.go | 56 +- github/repos_rules.go | 24 +- github/repos_stats.go | 20 +- github/repos_statuses.go | 12 +- github/repos_tags.go | 12 +- github/repos_traffic.go | 16 +- github/scim.go | 32 +- github/search.go | 34 +- github/secret_scanning.go | 28 +- github/security_advisories.go | 12 +- github/teams.go | 151 +- github/teams_discussion_comments.go | 40 +- github/teams_discussions.go | 40 +- github/teams_members.go | 40 +- github/users.go | 39 +- github/users_administration.go | 16 +- github/users_blocking.go | 16 +- github/users_emails.go | 16 +- github/users_followers.go | 29 +- github/users_gpg_keys.go | 19 +- github/users_keys.go | 19 +- github/users_packages.go | 56 +- github/users_projects.go | 8 +- github/users_ssh_signing_keys.go | 19 +- openapi_operations.yaml | 6291 +++++++++++++++++ script/lint.sh | 27 +- script/metadata.sh | 14 + script/test.sh | 6 + tools/go.mod | 24 + tools/go.sum | 61 + tools/metadata/main.go | 194 + tools/metadata/main_test.go | 422 ++ tools/metadata/metadata.go | 520 ++ tools/metadata/metadata_test.go | 28 + tools/metadata/openapi.go | 172 + .../testdata/format/openapi_operations.yaml | 16 + .../golden/TestFormat/openapi_operations.yaml | 13 + .../golden/TestUpdateGo/valid/github/a.go | 37 + .../TestUpdateOpenAPI/openapi_operations.yaml | 14 + tools/metadata/testdata/unused/github/a.go | 8 + .../testdata/unused/openapi_operations.yaml | 15 + .../testdata/update-go/invalid/github/a.go | 24 + .../update-go/invalid/openapi_operations.yaml | 16 + .../testdata/update-go/valid/github/a.go | 31 + .../update-go/valid/github/ignoreme.txt | 0 .../update-go/valid/openapi_operations.yaml | 13 + .../update-openapi/openapi_operations.yaml | 4 + update-urls/activity-events_test.go | 190 - update-urls/go.mod | 8 - update-urls/go.sum | 4 - update-urls/main.go | 1352 ---- update-urls/main_test.go | 617 -- update-urls/reactions_test.go | 140 - update-urls/testdata/activity-events.html | 5686 --------------- .../testdata/activity_events-original.go | 196 - update-urls/testdata/activity_events-want.go | 196 - update-urls/testdata/reactions-original.go | 490 -- update-urls/testdata/reactions-want.go | 490 -- update-urls/testdata/reactions.html | 5690 --------------- 189 files changed, 10969 insertions(+), 16146 deletions(-) create mode 100644 openapi_operations.yaml create mode 100755 script/metadata.sh create mode 100644 tools/go.mod create mode 100644 tools/go.sum create mode 100644 tools/metadata/main.go create mode 100644 tools/metadata/main_test.go create mode 100644 tools/metadata/metadata.go create mode 100644 tools/metadata/metadata_test.go create mode 100644 tools/metadata/openapi.go create mode 100644 tools/metadata/testdata/format/openapi_operations.yaml create mode 100644 tools/metadata/testdata/golden/TestFormat/openapi_operations.yaml create mode 100644 tools/metadata/testdata/golden/TestUpdateGo/valid/github/a.go create mode 100644 tools/metadata/testdata/golden/TestUpdateOpenAPI/openapi_operations.yaml create mode 100644 tools/metadata/testdata/unused/github/a.go create mode 100644 tools/metadata/testdata/unused/openapi_operations.yaml create mode 100644 tools/metadata/testdata/update-go/invalid/github/a.go create mode 100644 tools/metadata/testdata/update-go/invalid/openapi_operations.yaml create mode 100644 tools/metadata/testdata/update-go/valid/github/a.go create mode 100644 tools/metadata/testdata/update-go/valid/github/ignoreme.txt create mode 100644 tools/metadata/testdata/update-go/valid/openapi_operations.yaml create mode 100644 tools/metadata/testdata/update-openapi/openapi_operations.yaml delete mode 100644 update-urls/activity-events_test.go delete mode 100644 update-urls/go.mod delete mode 100644 update-urls/go.sum delete mode 100644 update-urls/main.go delete mode 100644 update-urls/main_test.go delete mode 100644 update-urls/reactions_test.go delete mode 100644 update-urls/testdata/activity-events.html delete mode 100644 update-urls/testdata/activity_events-original.go delete mode 100644 update-urls/testdata/activity_events-want.go delete mode 100644 update-urls/testdata/reactions-original.go delete mode 100644 update-urls/testdata/reactions-want.go delete mode 100644 update-urls/testdata/reactions.html diff --git a/.codecov.yml b/.codecov.yml index 2ef223a6e96..6488176ce17 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -3,5 +3,5 @@ ignore: - "github/github-accessors.go" # ignore experimental scrape package - "scrape" - # ignore update-urls - - "update-urls" + # ignore tools + - "tools" diff --git a/.github/dependabot.yml b/.github/dependabot.yml index d4960c13431..0c068c6c1ac 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -9,7 +9,7 @@ updates: schedule: interval: weekly - package-ecosystem: gomod - directory: update-urls + directory: tools schedule: interval: weekly - package-ecosystem: github-actions diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 98a1f5de8be..f9d6d7e4639 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -14,3 +14,6 @@ jobs: go-version: 1.x cache-dependency-path: "**/go.sum" - run: script/lint.sh + env: + CHECK_GITHUB_OPENAPI: 1 + GITHUB_TOKEN: ${{ github.token }} diff --git a/.golangci.yml b/.golangci.yml index 1770bd2e417..79d8481fd63 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -50,4 +50,4 @@ issues: # We don't care about file inclusion via variable in examples or internal tools. - linters: [ gosec ] text: 'G304: Potential file inclusion via variable' - path: '^(example|update-urls)\/' + path: '^(example|tools)\/' diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 451924ce4c3..e1fdbef5abe 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,10 +1,9 @@ -# How to contribute # +# How to contribute We'd love to accept your patches and contributions to this project. There are a just a few small guidelines you need to follow. - -## Contributor License Agreement ## +## Contributor License Agreement Contributions to any Google project must be accompanied by a Contributor License Agreement. This is not a copyright **assignment**, it simply gives @@ -17,7 +16,7 @@ You generally only need to submit a CLA once, so if you've already submitted one again. -## Reporting issues ## +## Reporting issues Bugs, feature requests, and development-related questions should be directed to our [GitHub issue tracker](https://github.com/google/go-github/issues). If @@ -29,7 +28,7 @@ how the requested feature would help you do that. Security related bugs can either be reported in the issue tracker, or if they are more sensitive, emailed to . -## Submitting a patch ## +## Submitting a patch 1. It's generally best to start by opening a new issue describing the bug or feature you're intending to fix. Even if you think it's relatively minor, @@ -73,7 +72,112 @@ are more sensitive, emailed to . [pull request]: https://help.github.com/articles/creating-a-pull-request [monitored by codecov.io]: https://codecov.io/gh/google/go-github -## Scripts ## +## Code Comments + +Every exported method needs to have code comments that follow +[Go Doc Comments][]. A typical method's comments will look like this: + +```go +// Get fetches a repository. +// +// GitHub API docs: https://docs.github.com/rest/repos/repos#get-a-repository +// +//meta:operation GET /repos/{owner}/{repo} +func (s *RepositoriesService) Get(ctx context.Context, owner, repo string) (*Repository, *Response, error) { +u := fmt.Sprintf("repos/%v/%v", owner, repo) +req, err := s.client.NewRequest("GET", u, nil) +... +} +``` + +The first line is the name of the method followed by a short description. This +could also be a longer description if needed, but there is no need to repeat any +details that are documented in GitHub's documentation because users are expected +to follow the documentation links to learn more. + +After the description comes a link to the GitHub API documentation. This is +added or fixed automatically when you run `script/generate.sh`, so you won't +need to set this yourself. + +Finally, the `//meta:operation` comment is a directive to the code generator +that maps the method to the corresponding OpenAPI operation. Once again, there +can be multiple directives for methods that call multiple +endpoints. `script/generate.sh` will normalize these directives for you, so if +you are adding a new method you can use the pattern from the `u := fmt.Sprintf` +line instead of looking up what the url parameters are called in the OpenAPI +description. + +[Go Doc Comments]: https://go.dev/doc/comment + +## Metadata + +GitHub publishes [OpenAPI descriptions of their API][]. We use these +descriptions to keep documentation links up to date and to keep track of which +methods call which endpoints via the `//meta:operation` comments described +above. GitHub's descriptions are far too large to keep in this repository or to +pull down every time we generate code, so we keep only the metadata we need +in `openapi_operations.yaml`. + +### openapi_operations.yaml + +Most contributors won't need to interact with `openapi_operations.yaml`, but it +may be useful to know what it is. Its sections are: + +- `openapi_operations` - is the metadata that comes from GitHub's OpenAPI + descriptions. It is generated by `script/metadata.sh update-openapi` and + should not be edited by hand. In the rare case where it needs to be + overridden, use the `operation_overrides` section instead. + + An operation consists of `name`, `documentation_url`, + and `openapi_files`. `openapi_files` is the list of files where the operation + is described. In order or preference, values can be "api.github.com.json" for + operations available on the free plan, "ghec.json" for operations available on + GitHub Enterprise Cloud or "ghes-.json" for operations available on + GitHub Enterprise Server. When an operation is described in multiple ghes + files, only the most recent version is included. `documentation_url` is the + URL that should be linked from godoc. It is the documentation link found in + the first file listed in `openapi_files`. + +- `openapi_commit` - is the git commit that `script/metadata.sh update-openapi` + saw when it last updated `openapi_operations`. It is not necessarily the most + recent commit seen because `update-openapi` doesn't update the file when + there are no changes to `openapi_operations`. + +- `operations` - contains manually added metadata that is not in GitHub's + OpenAPI descriptions. There are only a few of these. Some have + documentation_urls that point to relevant GitHub documentation that is not in + the OpenAPI descriptions. Others have no documentation_url and result in a + note in the generated code that the documentation is missing. + +- `operation_overrides` - is where we override the documentation_url for + operations where the link in the OpenAPI descriptions is wrong. + +### tools/metadata + +The `tools/metadata` package is a command-line tool for working with metadata. +In a typical workflow, you won't use it directly, but you will use it indirectly +through `script/generate.sh` and `script/lint.sh`. + +Its subcommands are: + +- `update-openapi` - updates `openapi_operations.yaml` with the latest + information from GitHub's OpenAPI descriptions. With `--validate` it will + validate that the descriptions are correct as of the commit + in `openapi_commit`. `update-openapi --validate` is called + by `script/lint.sh`. + +- `update-go` - updates Go files with documentation URLs and formats comments. + It is used by `script/generate.sh`. + +- `format` - formats whitespace in `openapi_operations.yaml` and sorts its + arrays. It is used by `script/fmt.sh`. + +- `unused` - lists operations from `openapi_operations.yaml` that are not mapped + from any methods. + +[OpenAPI descriptions of their API]: https://github.com/github/rest-api-description + +## Scripts The `script` directory has shell scripts that help with common development tasks. @@ -86,6 +190,9 @@ tasks. **script/lint.sh** runs linters on the project and checks generated files are current. +**script/metadata.sh** runs `tools/metadata`. See the [Metadata](#metadata) +section for more information. + **script/test.sh** runs tests on all modules. ## Other notes on code organization ## @@ -104,7 +211,7 @@ defined at live in [repos_hooks.go]: https://github.com/google/go-github/blob/master/github/repos_hooks.go -## Maintainer's Guide ## +## Maintainer's Guide (These notes are mostly only for people merging in pull requests.) diff --git a/github/actions.go b/github/actions.go index 8d552f2d0db..4b88a1e1145 100644 --- a/github/actions.go +++ b/github/actions.go @@ -8,5 +8,5 @@ package github // ActionsService handles communication with the actions related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/en/rest/actions/ +// GitHub API docs: https://docs.github.com/rest/actions/ type ActionsService service diff --git a/github/actions_artifacts.go b/github/actions_artifacts.go index 6389268b4ea..f804b809b4a 100644 --- a/github/actions_artifacts.go +++ b/github/actions_artifacts.go @@ -14,7 +14,7 @@ import ( // ArtifactWorkflowRun represents a GitHub artifact's workflow run. // -// GitHub API docs: https://docs.github.com/en/rest/actions/artifacts +// GitHub API docs: https://docs.github.com/rest/actions/artifacts type ArtifactWorkflowRun struct { ID *int64 `json:"id,omitempty"` RepositoryID *int64 `json:"repository_id,omitempty"` @@ -27,7 +27,7 @@ type ArtifactWorkflowRun struct { // data between jobs in a workflow and provide storage for data // once a workflow is complete. // -// GitHub API docs: https://docs.github.com/en/rest/actions/artifacts +// GitHub API docs: https://docs.github.com/rest/actions/artifacts type Artifact struct { ID *int64 `json:"id,omitempty"` NodeID *string `json:"node_id,omitempty"` @@ -44,7 +44,7 @@ type Artifact struct { // ArtifactList represents a list of GitHub artifacts. // -// GitHub API docs: https://docs.github.com/en/rest/actions/artifacts#artifacts +// GitHub API docs: https://docs.github.com/rest/actions/artifacts#artifacts type ArtifactList struct { TotalCount *int64 `json:"total_count,omitempty"` Artifacts []*Artifact `json:"artifacts,omitempty"` @@ -52,7 +52,9 @@ type ArtifactList struct { // ListArtifacts lists all artifacts that belong to a repository. // -// GitHub API docs: https://docs.github.com/en/rest/actions/artifacts#list-artifacts-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/artifacts#list-artifacts-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/actions/artifacts func (s *ActionsService) ListArtifacts(ctx context.Context, owner, repo string, opts *ListOptions) (*ArtifactList, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/artifacts", owner, repo) u, err := addOptions(u, opts) @@ -76,7 +78,9 @@ func (s *ActionsService) ListArtifacts(ctx context.Context, owner, repo string, // ListWorkflowRunArtifacts lists all artifacts that belong to a workflow run. // -// GitHub API docs: https://docs.github.com/en/rest/actions/artifacts#list-workflow-run-artifacts +// GitHub API docs: https://docs.github.com/rest/actions/artifacts#list-workflow-run-artifacts +// +//meta:operation GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts func (s *ActionsService) ListWorkflowRunArtifacts(ctx context.Context, owner, repo string, runID int64, opts *ListOptions) (*ArtifactList, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/artifacts", owner, repo, runID) u, err := addOptions(u, opts) @@ -100,7 +104,9 @@ func (s *ActionsService) ListWorkflowRunArtifacts(ctx context.Context, owner, re // GetArtifact gets a specific artifact for a workflow run. // -// GitHub API docs: https://docs.github.com/en/rest/actions/artifacts#get-an-artifact +// GitHub API docs: https://docs.github.com/rest/actions/artifacts#get-an-artifact +// +//meta:operation GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id} func (s *ActionsService) GetArtifact(ctx context.Context, owner, repo string, artifactID int64) (*Artifact, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/artifacts/%v", owner, repo, artifactID) @@ -120,7 +126,9 @@ func (s *ActionsService) GetArtifact(ctx context.Context, owner, repo string, ar // DownloadArtifact gets a redirect URL to download an archive for a repository. // -// GitHub API docs: https://docs.github.com/en/rest/actions/artifacts#download-an-artifact +// GitHub API docs: https://docs.github.com/rest/actions/artifacts#download-an-artifact +// +//meta:operation GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}/{archive_format} func (s *ActionsService) DownloadArtifact(ctx context.Context, owner, repo string, artifactID int64, maxRedirects int) (*url.URL, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/artifacts/%v/zip", owner, repo, artifactID) @@ -144,7 +152,9 @@ func (s *ActionsService) DownloadArtifact(ctx context.Context, owner, repo strin // DeleteArtifact deletes a workflow run artifact. // -// GitHub API docs: https://docs.github.com/en/rest/actions/artifacts#delete-an-artifact +// GitHub API docs: https://docs.github.com/rest/actions/artifacts#delete-an-artifact +// +//meta:operation DELETE /repos/{owner}/{repo}/actions/artifacts/{artifact_id} func (s *ActionsService) DeleteArtifact(ctx context.Context, owner, repo string, artifactID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/artifacts/%v", owner, repo, artifactID) diff --git a/github/actions_cache.go b/github/actions_cache.go index 9592d9ab62f..271d7d82069 100644 --- a/github/actions_cache.go +++ b/github/actions_cache.go @@ -12,7 +12,7 @@ import ( // ActionsCache represents a GitHub action cache. // -// GitHub API docs: https://docs.github.com/en/rest/actions/cache?apiVersion=2022-11-28#about-the-cache-api +// GitHub API docs: https://docs.github.com/rest/actions/cache#about-the-cache-api type ActionsCache struct { ID *int64 `json:"id,omitempty" url:"-"` Ref *string `json:"ref,omitempty" url:"ref"` @@ -25,7 +25,7 @@ type ActionsCache struct { // ActionsCacheList represents a list of GitHub actions Cache. // -// GitHub API docs: https://docs.github.com/en/rest/actions/cache?apiVersion=2022-11-28#list-github-actions-caches-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/cache#list-github-actions-caches-for-a-repository type ActionsCacheList struct { TotalCount int `json:"total_count"` ActionsCaches []*ActionsCache `json:"actions_caches,omitempty"` @@ -33,7 +33,7 @@ type ActionsCacheList struct { // ActionsCacheUsage represents a GitHub Actions Cache Usage object. // -// GitHub API docs: https://docs.github.com/en/rest/actions/cache?apiVersion=2022-11-28#get-github-actions-cache-usage-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/cache#get-github-actions-cache-usage-for-a-repository type ActionsCacheUsage struct { FullName string `json:"full_name"` ActiveCachesSizeInBytes int64 `json:"active_caches_size_in_bytes"` @@ -42,7 +42,7 @@ type ActionsCacheUsage struct { // ActionsCacheUsageList represents a list of repositories with GitHub Actions cache usage for an organization. // -// GitHub API docs: https://docs.github.com/en/rest/actions/cache?apiVersion=2022-11-28#get-github-actions-cache-usage-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/cache#get-github-actions-cache-usage-for-a-repository type ActionsCacheUsageList struct { TotalCount int `json:"total_count"` RepoCacheUsage []*ActionsCacheUsage `json:"repository_cache_usages,omitempty"` @@ -50,7 +50,7 @@ type ActionsCacheUsageList struct { // TotalCacheUsage represents total GitHub actions cache usage of an organization or enterprise. // -// GitHub API docs: https://docs.github.com/en/rest/actions/cache?apiVersion=2022-11-28#get-github-actions-cache-usage-for-an-enterprise +// GitHub API docs: https://docs.github.com/rest/actions/cache#get-github-actions-cache-usage-for-an-enterprise type TotalCacheUsage struct { TotalActiveCachesUsageSizeInBytes int64 `json:"total_active_caches_size_in_bytes"` TotalActiveCachesCount int `json:"total_active_caches_count"` @@ -58,7 +58,7 @@ type TotalCacheUsage struct { // ActionsCacheListOptions represents a list of all possible optional Query parameters for ListCaches method. // -// GitHub API docs: https://docs.github.com/en/rest/actions/cache?apiVersion=2022-11-28#list-github-actions-caches-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/cache#list-github-actions-caches-for-a-repository type ActionsCacheListOptions struct { ListOptions // The Git reference for the results you want to list. @@ -77,7 +77,9 @@ type ActionsCacheListOptions struct { // // Permissions: must have the actions:read permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/actions/cache?apiVersion=2022-11-28#list-github-actions-caches-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/cache#list-github-actions-caches-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/actions/caches func (s *ActionsService) ListCaches(ctx context.Context, owner, repo string, opts *ActionsCacheListOptions) (*ActionsCacheList, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/caches", owner, repo) u, err := addOptions(u, opts) @@ -107,7 +109,9 @@ func (s *ActionsService) ListCaches(ctx context.Context, owner, repo string, opt // // Permissions: You must authenticate using an access token with the repo scope to use this endpoint. GitHub Apps must have the actions:write permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/actions/cache?apiVersion=2022-11-28#delete-github-actions-caches-for-a-repository-using-a-cache-key +// GitHub API docs: https://docs.github.com/rest/actions/cache#delete-github-actions-caches-for-a-repository-using-a-cache-key +// +//meta:operation DELETE /repos/{owner}/{repo}/actions/caches func (s *ActionsService) DeleteCachesByKey(ctx context.Context, owner, repo, key string, ref *string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/caches", owner, repo) u, err := addOptions(u, ActionsCache{Key: &key, Ref: ref}) @@ -127,7 +131,9 @@ func (s *ActionsService) DeleteCachesByKey(ctx context.Context, owner, repo, key // // Permissions: You must authenticate using an access token with the repo scope to use this endpoint. GitHub Apps must have the actions:write permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/actions/cache?apiVersion=2022-11-28#delete-a-github-actions-cache-for-a-repository-using-a-cache-id +// GitHub API docs: https://docs.github.com/rest/actions/cache#delete-a-github-actions-cache-for-a-repository-using-a-cache-id +// +//meta:operation DELETE /repos/{owner}/{repo}/actions/caches/{cache_id} func (s *ActionsService) DeleteCachesByID(ctx context.Context, owner, repo string, cacheID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/caches/%v", owner, repo, cacheID) req, err := s.client.NewRequest("DELETE", u, nil) @@ -144,7 +150,9 @@ func (s *ActionsService) DeleteCachesByID(ctx context.Context, owner, repo strin // Permissions: Anyone with read access to the repository can use this endpoint. If the repository is private, you must use an // access token with the repo scope. GitHub Apps must have the actions:read permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/actions/cache?apiVersion=2022-11-28#get-github-actions-cache-usage-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/cache#get-github-actions-cache-usage-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/actions/cache/usage func (s *ActionsService) GetCacheUsageForRepo(ctx context.Context, owner, repo string) (*ActionsCacheUsage, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/cache/usage", owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -167,7 +175,9 @@ func (s *ActionsService) GetCacheUsageForRepo(ctx context.Context, owner, repo s // Permissions: You must authenticate using an access token with the read:org scope to use this endpoint. // GitHub Apps must have the organization_admistration:read permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/actions/cache?apiVersion=2022-11-28#list-repositories-with-github-actions-cache-usage-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/cache#list-repositories-with-github-actions-cache-usage-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/cache/usage-by-repository func (s *ActionsService) ListCacheUsageByRepoForOrg(ctx context.Context, org string, opts *ListOptions) (*ActionsCacheUsageList, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/cache/usage-by-repository", org) u, err := addOptions(u, opts) @@ -195,7 +205,9 @@ func (s *ActionsService) ListCacheUsageByRepoForOrg(ctx context.Context, org str // Permissions: You must authenticate using an access token with the read:org scope to use this endpoint. // GitHub Apps must have the organization_admistration:read permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/actions/cache?apiVersion=2022-11-28#get-github-actions-cache-usage-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/cache#get-github-actions-cache-usage-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/cache/usage func (s *ActionsService) GetTotalCacheUsageForOrg(ctx context.Context, org string) (*TotalCacheUsage, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/cache/usage", org) req, err := s.client.NewRequest("GET", u, nil) @@ -217,7 +229,9 @@ func (s *ActionsService) GetTotalCacheUsageForOrg(ctx context.Context, org strin // // Permissions: You must authenticate using an access token with the "admin:enterprise" scope to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/actions/cache?apiVersion=2022-11-28#get-github-actions-cache-usage-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/cache#get-github-actions-cache-usage-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/cache/usage func (s *ActionsService) GetTotalCacheUsageForEnterprise(ctx context.Context, enterprise string) (*TotalCacheUsage, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/cache/usage", enterprise) req, err := s.client.NewRequest("GET", u, nil) diff --git a/github/actions_oidc.go b/github/actions_oidc.go index b7f2d26ae9c..596aa9d981e 100644 --- a/github/actions_oidc.go +++ b/github/actions_oidc.go @@ -18,7 +18,9 @@ type OIDCSubjectClaimCustomTemplate struct { // GetOrgOIDCSubjectClaimCustomTemplate gets the subject claim customization template for an organization. // -// GitHub API docs: https://docs.github.com/en/rest/actions/oidc#get-the-customization-template-for-an-oidc-subject-claim-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/oidc#get-the-customization-template-for-an-oidc-subject-claim-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/oidc/customization/sub func (s *ActionsService) GetOrgOIDCSubjectClaimCustomTemplate(ctx context.Context, org string) (*OIDCSubjectClaimCustomTemplate, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/oidc/customization/sub", org) return s.getOIDCSubjectClaimCustomTemplate(ctx, u) @@ -26,7 +28,9 @@ func (s *ActionsService) GetOrgOIDCSubjectClaimCustomTemplate(ctx context.Contex // GetRepoOIDCSubjectClaimCustomTemplate gets the subject claim customization template for a repository. // -// GitHub API docs: https://docs.github.com/en/rest/actions/oidc#get-the-customization-template-for-an-oidc-subject-claim-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/oidc#get-the-customization-template-for-an-oidc-subject-claim-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/actions/oidc/customization/sub func (s *ActionsService) GetRepoOIDCSubjectClaimCustomTemplate(ctx context.Context, owner, repo string) (*OIDCSubjectClaimCustomTemplate, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/oidc/customization/sub", owner, repo) return s.getOIDCSubjectClaimCustomTemplate(ctx, u) @@ -49,7 +53,9 @@ func (s *ActionsService) getOIDCSubjectClaimCustomTemplate(ctx context.Context, // SetOrgOIDCSubjectClaimCustomTemplate sets the subject claim customization for an organization. // -// GitHub API docs: https://docs.github.com/en/rest/actions/oidc#set-the-customization-template-for-an-oidc-subject-claim-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/oidc#set-the-customization-template-for-an-oidc-subject-claim-for-an-organization +// +//meta:operation PUT /orgs/{org}/actions/oidc/customization/sub func (s *ActionsService) SetOrgOIDCSubjectClaimCustomTemplate(ctx context.Context, org string, template *OIDCSubjectClaimCustomTemplate) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/oidc/customization/sub", org) return s.setOIDCSubjectClaimCustomTemplate(ctx, u, template) @@ -57,7 +63,9 @@ func (s *ActionsService) SetOrgOIDCSubjectClaimCustomTemplate(ctx context.Contex // SetRepoOIDCSubjectClaimCustomTemplate sets the subject claim customization for a repository. // -// GitHub API docs: https://docs.github.com/en/rest/actions/oidc#set-the-customization-template-for-an-oidc-subject-claim-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/oidc#set-the-customization-template-for-an-oidc-subject-claim-for-a-repository +// +//meta:operation PUT /repos/{owner}/{repo}/actions/oidc/customization/sub func (s *ActionsService) SetRepoOIDCSubjectClaimCustomTemplate(ctx context.Context, owner, repo string, template *OIDCSubjectClaimCustomTemplate) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/oidc/customization/sub", owner, repo) return s.setOIDCSubjectClaimCustomTemplate(ctx, u, template) diff --git a/github/actions_permissions_enterprise.go b/github/actions_permissions_enterprise.go index 1d97fc91b4f..7e10444af47 100644 --- a/github/actions_permissions_enterprise.go +++ b/github/actions_permissions_enterprise.go @@ -32,6 +32,8 @@ func (a ActionsPermissionsEnterprise) String() string { // GetActionsPermissionsInEnterprise gets the GitHub Actions permissions policy for an enterprise. // // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#get-github-actions-permissions-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/permissions func (s *ActionsService) GetActionsPermissionsInEnterprise(ctx context.Context, enterprise string) (*ActionsPermissionsEnterprise, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/permissions", enterprise) @@ -52,6 +54,8 @@ func (s *ActionsService) GetActionsPermissionsInEnterprise(ctx context.Context, // EditActionsPermissionsInEnterprise sets the permissions policy in an enterprise. // // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#set-github-actions-permissions-for-an-enterprise +// +//meta:operation PUT /enterprises/{enterprise}/actions/permissions func (s *ActionsService) EditActionsPermissionsInEnterprise(ctx context.Context, enterprise string, actionsPermissionsEnterprise ActionsPermissionsEnterprise) (*ActionsPermissionsEnterprise, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/permissions", enterprise) req, err := s.client.NewRequest("PUT", u, actionsPermissionsEnterprise) @@ -71,6 +75,8 @@ func (s *ActionsService) EditActionsPermissionsInEnterprise(ctx context.Context, // ListEnabledOrgsInEnterprise lists the selected organizations that are enabled for GitHub Actions in an enterprise. // // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#list-selected-organizations-enabled-for-github-actions-in-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/permissions/organizations func (s *ActionsService) ListEnabledOrgsInEnterprise(ctx context.Context, owner string, opts *ListOptions) (*ActionsEnabledOnEnterpriseRepos, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/permissions/organizations", owner) u, err := addOptions(u, opts) @@ -95,6 +101,8 @@ func (s *ActionsService) ListEnabledOrgsInEnterprise(ctx context.Context, owner // SetEnabledOrgsInEnterprise replaces the list of selected organizations that are enabled for GitHub Actions in an enterprise. // // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#set-selected-organizations-enabled-for-github-actions-in-an-enterprise +// +//meta:operation PUT /enterprises/{enterprise}/actions/permissions/organizations func (s *ActionsService) SetEnabledOrgsInEnterprise(ctx context.Context, owner string, organizationIDs []int64) (*Response, error) { u := fmt.Sprintf("enterprises/%v/actions/permissions/organizations", owner) @@ -116,6 +124,8 @@ func (s *ActionsService) SetEnabledOrgsInEnterprise(ctx context.Context, owner s // AddEnabledOrgInEnterprise adds an organization to the list of selected organizations that are enabled for GitHub Actions in an enterprise. // // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#enable-a-selected-organization-for-github-actions-in-an-enterprise +// +//meta:operation PUT /enterprises/{enterprise}/actions/permissions/organizations/{org_id} func (s *ActionsService) AddEnabledOrgInEnterprise(ctx context.Context, owner string, organizationID int64) (*Response, error) { u := fmt.Sprintf("enterprises/%v/actions/permissions/organizations/%v", owner, organizationID) @@ -135,6 +145,8 @@ func (s *ActionsService) AddEnabledOrgInEnterprise(ctx context.Context, owner st // RemoveEnabledOrgInEnterprise removes an organization from the list of selected organizations that are enabled for GitHub Actions in an enterprise. // // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#disable-a-selected-organization-for-github-actions-in-an-enterprise +// +//meta:operation DELETE /enterprises/{enterprise}/actions/permissions/organizations/{org_id} func (s *ActionsService) RemoveEnabledOrgInEnterprise(ctx context.Context, owner string, organizationID int64) (*Response, error) { u := fmt.Sprintf("enterprises/%v/actions/permissions/organizations/%v", owner, organizationID) @@ -154,6 +166,8 @@ func (s *ActionsService) RemoveEnabledOrgInEnterprise(ctx context.Context, owner // GetActionsAllowedInEnterprise gets the actions that are allowed in an enterprise. // // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/permissions/selected-actions func (s *ActionsService) GetActionsAllowedInEnterprise(ctx context.Context, enterprise string) (*ActionsAllowed, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/permissions/selected-actions", enterprise) @@ -174,6 +188,8 @@ func (s *ActionsService) GetActionsAllowedInEnterprise(ctx context.Context, ente // EditActionsAllowedInEnterprise sets the actions that are allowed in an enterprise. // // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-an-enterprise +// +//meta:operation PUT /enterprises/{enterprise}/actions/permissions/selected-actions func (s *ActionsService) EditActionsAllowedInEnterprise(ctx context.Context, enterprise string, actionsAllowed ActionsAllowed) (*ActionsAllowed, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/permissions/selected-actions", enterprise) req, err := s.client.NewRequest("PUT", u, actionsAllowed) diff --git a/github/actions_permissions_orgs.go b/github/actions_permissions_orgs.go index d55a2d45a61..1a31e4c6f1b 100644 --- a/github/actions_permissions_orgs.go +++ b/github/actions_permissions_orgs.go @@ -12,7 +12,7 @@ import ( // ActionsPermissions represents a policy for repositories and allowed actions in an organization. // -// GitHub API docs: https://docs.github.com/en/rest/actions/permissions +// GitHub API docs: https://docs.github.com/rest/actions/permissions type ActionsPermissions struct { EnabledRepositories *string `json:"enabled_repositories,omitempty"` AllowedActions *string `json:"allowed_actions,omitempty"` @@ -31,7 +31,7 @@ type ActionsEnabledOnOrgRepos struct { // ActionsAllowed represents selected actions that are allowed. // -// GitHub API docs: https://docs.github.com/en/rest/actions/permissions +// GitHub API docs: https://docs.github.com/rest/actions/permissions type ActionsAllowed struct { GithubOwnedAllowed *bool `json:"github_owned_allowed,omitempty"` VerifiedAllowed *bool `json:"verified_allowed,omitempty"` @@ -44,7 +44,9 @@ func (a ActionsAllowed) String() string { // GetActionsPermissions gets the GitHub Actions permissions policy for repositories and allowed actions in an organization. // -// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#get-github-actions-permissions-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/permissions#get-github-actions-permissions-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/permissions func (s *ActionsService) GetActionsPermissions(ctx context.Context, org string) (*ActionsPermissions, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/permissions", org) @@ -64,7 +66,9 @@ func (s *ActionsService) GetActionsPermissions(ctx context.Context, org string) // EditActionsPermissions sets the permissions policy for repositories and allowed actions in an organization. // -// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#set-github-actions-permissions-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/permissions#set-github-actions-permissions-for-an-organization +// +//meta:operation PUT /orgs/{org}/actions/permissions func (s *ActionsService) EditActionsPermissions(ctx context.Context, org string, actionsPermissions ActionsPermissions) (*ActionsPermissions, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/permissions", org) req, err := s.client.NewRequest("PUT", u, actionsPermissions) @@ -83,7 +87,9 @@ func (s *ActionsService) EditActionsPermissions(ctx context.Context, org string, // ListEnabledReposInOrg lists the selected repositories that are enabled for GitHub Actions in an organization. // -// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#list-selected-repositories-enabled-for-github-actions-in-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/permissions#list-selected-repositories-enabled-for-github-actions-in-an-organization +// +//meta:operation GET /orgs/{org}/actions/permissions/repositories func (s *ActionsService) ListEnabledReposInOrg(ctx context.Context, owner string, opts *ListOptions) (*ActionsEnabledOnOrgRepos, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/permissions/repositories", owner) u, err := addOptions(u, opts) @@ -107,7 +113,9 @@ func (s *ActionsService) ListEnabledReposInOrg(ctx context.Context, owner string // SetEnabledReposInOrg replaces the list of selected repositories that are enabled for GitHub Actions in an organization.. // -// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#set-selected-repositories-enabled-for-github-actions-in-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/permissions#set-selected-repositories-enabled-for-github-actions-in-an-organization +// +//meta:operation PUT /orgs/{org}/actions/permissions/repositories func (s *ActionsService) SetEnabledReposInOrg(ctx context.Context, owner string, repositoryIDs []int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/permissions/repositories", owner) @@ -128,7 +136,9 @@ func (s *ActionsService) SetEnabledReposInOrg(ctx context.Context, owner string, // AddEnabledReposInOrg adds a repository to the list of selected repositories that are enabled for GitHub Actions in an organization. // -// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#enable-a-selected-repository-for-github-actions-in-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/permissions#enable-a-selected-repository-for-github-actions-in-an-organization +// +//meta:operation PUT /orgs/{org}/actions/permissions/repositories/{repository_id} func (s *ActionsService) AddEnabledReposInOrg(ctx context.Context, owner string, repositoryID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/permissions/repositories/%v", owner, repositoryID) @@ -147,7 +157,9 @@ func (s *ActionsService) AddEnabledReposInOrg(ctx context.Context, owner string, // RemoveEnabledReposInOrg removes a single repository from the list of enabled repos for GitHub Actions in an organization. // -// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#disable-a-selected-repository-for-github-actions-in-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/permissions#disable-a-selected-repository-for-github-actions-in-an-organization +// +//meta:operation DELETE /orgs/{org}/actions/permissions/repositories/{repository_id} func (s *ActionsService) RemoveEnabledReposInOrg(ctx context.Context, owner string, repositoryID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/permissions/repositories/%v", owner, repositoryID) @@ -166,7 +178,9 @@ func (s *ActionsService) RemoveEnabledReposInOrg(ctx context.Context, owner stri // GetActionsAllowed gets the actions that are allowed in an organization. // -// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/permissions/selected-actions func (s *ActionsService) GetActionsAllowed(ctx context.Context, org string) (*ActionsAllowed, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/permissions/selected-actions", org) @@ -186,7 +200,9 @@ func (s *ActionsService) GetActionsAllowed(ctx context.Context, org string) (*Ac // EditActionsAllowed sets the actions that are allowed in an organization. // -// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-an-organization +// +//meta:operation PUT /orgs/{org}/actions/permissions/selected-actions func (s *ActionsService) EditActionsAllowed(ctx context.Context, org string, actionsAllowed ActionsAllowed) (*ActionsAllowed, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/permissions/selected-actions", org) req, err := s.client.NewRequest("PUT", u, actionsAllowed) diff --git a/github/actions_required_workflows.go b/github/actions_required_workflows.go index 3566eb9d207..b89741a82a1 100644 --- a/github/actions_required_workflows.go +++ b/github/actions_required_workflows.go @@ -67,7 +67,9 @@ type RepoRequiredWorkflows struct { // ListOrgRequiredWorkflows lists the RequiredWorkflows for an org. // -// GitHub API docs: https://docs.github.com/en/rest/actions/required-workflows?apiVersion=2022-11-28#list-required-workflows +// GitHub API docs: https://docs.github.com/actions/using-workflows/required-workflows +// +//meta:operation GET /orgs/{org}/actions/required_workflows func (s *ActionsService) ListOrgRequiredWorkflows(ctx context.Context, org string, opts *ListOptions) (*OrgRequiredWorkflows, *Response, error) { url := fmt.Sprintf("orgs/%v/actions/required_workflows", org) u, err := addOptions(url, opts) @@ -91,7 +93,9 @@ func (s *ActionsService) ListOrgRequiredWorkflows(ctx context.Context, org strin // CreateRequiredWorkflow creates the required workflow in an org. // -// GitHub API docs: https://docs.github.com/en/rest/actions/required-workflows?apiVersion=2022-11-28#create-a-required-workflow +// GitHub API docs: https://docs.github.com/actions/using-workflows/required-workflows +// +//meta:operation POST /orgs/{org}/actions/required_workflows func (s *ActionsService) CreateRequiredWorkflow(ctx context.Context, org string, createRequiredWorkflowOptions *CreateUpdateRequiredWorkflowOptions) (*OrgRequiredWorkflow, *Response, error) { url := fmt.Sprintf("orgs/%v/actions/required_workflows", org) req, err := s.client.NewRequest("POST", url, createRequiredWorkflowOptions) @@ -110,7 +114,9 @@ func (s *ActionsService) CreateRequiredWorkflow(ctx context.Context, org string, // GetRequiredWorkflowByID get the RequiredWorkflows for an org by its ID. // -// GitHub API docs: https://docs.github.com/en/rest/actions/required-workflows?apiVersion=2022-11-28#list-required-workflows +// GitHub API docs: https://docs.github.com/actions/using-workflows/required-workflows +// +//meta:operation GET /orgs/{org}/actions/required_workflows/{workflow_id} func (s *ActionsService) GetRequiredWorkflowByID(ctx context.Context, owner string, requiredWorkflowID int64) (*OrgRequiredWorkflow, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/required_workflows/%v", owner, requiredWorkflowID) @@ -130,7 +136,9 @@ func (s *ActionsService) GetRequiredWorkflowByID(ctx context.Context, owner stri // UpdateRequiredWorkflow updates a required workflow in an org. // -// GitHub API docs: https://docs.github.com/en/rest/actions/required-workflows?apiVersion=2022-11-28#update-a-required-workflow +// GitHub API docs: https://docs.github.com/actions/using-workflows/required-workflows +// +//meta:operation PATCH /orgs/{org}/actions/required_workflows/{workflow_id} func (s *ActionsService) UpdateRequiredWorkflow(ctx context.Context, org string, requiredWorkflowID int64, updateRequiredWorkflowOptions *CreateUpdateRequiredWorkflowOptions) (*OrgRequiredWorkflow, *Response, error) { url := fmt.Sprintf("orgs/%v/actions/required_workflows/%v", org, requiredWorkflowID) req, err := s.client.NewRequest("PATCH", url, updateRequiredWorkflowOptions) @@ -149,7 +157,9 @@ func (s *ActionsService) UpdateRequiredWorkflow(ctx context.Context, org string, // DeleteRequiredWorkflow deletes a required workflow in an org. // -// GitHub API docs: https://docs.github.com/en/rest/actions/required-workflows?apiVersion=2022-11-28#update-a-required-workflow +// GitHub API docs: https://docs.github.com/actions/using-workflows/required-workflows +// +//meta:operation DELETE /orgs/{org}/actions/required_workflows/{workflow_id} func (s *ActionsService) DeleteRequiredWorkflow(ctx context.Context, org string, requiredWorkflowID int64) (*Response, error) { url := fmt.Sprintf("orgs/%v/actions/required_workflows/%v", org, requiredWorkflowID) req, err := s.client.NewRequest("DELETE", url, nil) @@ -161,7 +171,9 @@ func (s *ActionsService) DeleteRequiredWorkflow(ctx context.Context, org string, // ListRequiredWorkflowSelectedRepos lists the Repositories selected for a workflow. // -// GitHub API docs: https://docs.github.com/en/rest/actions/required-workflows?apiVersion=2022-11-28#list-selected-repositories-for-a-required-workflow +// GitHub API docs: https://docs.github.com/actions/using-workflows/required-workflows +// +//meta:operation GET /orgs/{org}/actions/required_workflows/{workflow_id}/repositories func (s *ActionsService) ListRequiredWorkflowSelectedRepos(ctx context.Context, org string, requiredWorkflowID int64, opts *ListOptions) (*RequiredWorkflowSelectedRepos, *Response, error) { url := fmt.Sprintf("orgs/%v/actions/required_workflows/%v/repositories", org, requiredWorkflowID) u, err := addOptions(url, opts) @@ -184,7 +196,9 @@ func (s *ActionsService) ListRequiredWorkflowSelectedRepos(ctx context.Context, // SetRequiredWorkflowSelectedRepos sets the Repositories selected for a workflow. // -// GitHub API docs: https://docs.github.com/en/rest/actions/required-workflows?apiVersion=2022-11-28#sets-repositories-for-a-required-workflow +// GitHub API docs: https://docs.github.com/actions/using-workflows/required-workflows +// +//meta:operation PUT /orgs/{org}/actions/required_workflows/{workflow_id}/repositories func (s *ActionsService) SetRequiredWorkflowSelectedRepos(ctx context.Context, org string, requiredWorkflowID int64, ids SelectedRepoIDs) (*Response, error) { type repoIDs struct { SelectedIDs SelectedRepoIDs `json:"selected_repository_ids"` @@ -200,7 +214,9 @@ func (s *ActionsService) SetRequiredWorkflowSelectedRepos(ctx context.Context, o // AddRepoToRequiredWorkflow adds the Repository to a required workflow. // -// GitHub API docs: https://docs.github.com/en/rest/actions/required-workflows?apiVersion=2022-11-28#add-a-repository-to-a-required-workflow +// GitHub API docs: https://docs.github.com/actions/using-workflows/required-workflows +// +//meta:operation PUT /orgs/{org}/actions/required_workflows/{workflow_id}/repositories/{repository_id} func (s *ActionsService) AddRepoToRequiredWorkflow(ctx context.Context, org string, requiredWorkflowID, repoID int64) (*Response, error) { url := fmt.Sprintf("orgs/%v/actions/required_workflows/%v/repositories/%v", org, requiredWorkflowID, repoID) req, err := s.client.NewRequest("PUT", url, nil) @@ -212,7 +228,9 @@ func (s *ActionsService) AddRepoToRequiredWorkflow(ctx context.Context, org stri // RemoveRepoFromRequiredWorkflow removes the Repository from a required workflow. // -// GitHub API docs: https://docs.github.com/en/rest/actions/required-workflows?apiVersion=2022-11-28#add-a-repository-to-a-required-workflow +// GitHub API docs: https://docs.github.com/actions/using-workflows/required-workflows +// +//meta:operation DELETE /orgs/{org}/actions/required_workflows/{workflow_id}/repositories/{repository_id} func (s *ActionsService) RemoveRepoFromRequiredWorkflow(ctx context.Context, org string, requiredWorkflowID, repoID int64) (*Response, error) { url := fmt.Sprintf("orgs/%v/actions/required_workflows/%v/repositories/%v", org, requiredWorkflowID, repoID) req, err := s.client.NewRequest("DELETE", url, nil) @@ -224,7 +242,9 @@ func (s *ActionsService) RemoveRepoFromRequiredWorkflow(ctx context.Context, org // ListRepoRequiredWorkflows lists the RequiredWorkflows for a repo. // -// Github API docs:https://docs.github.com/en/rest/actions/required-workflows?apiVersion=2022-11-28#list-repository-required-workflows +// GitHub API docs: https://docs.github.com/actions/using-workflows/required-workflows +// +//meta:operation GET /repos/{owner}/{repo}/actions/required_workflows func (s *ActionsService) ListRepoRequiredWorkflows(ctx context.Context, owner, repo string, opts *ListOptions) (*RepoRequiredWorkflows, *Response, error) { url := fmt.Sprintf("repos/%v/%v/actions/required_workflows", owner, repo) u, err := addOptions(url, opts) diff --git a/github/actions_runner_groups.go b/github/actions_runner_groups.go index 00b9b6ce091..a1f453f3c67 100644 --- a/github/actions_runner_groups.go +++ b/github/actions_runner_groups.go @@ -80,7 +80,9 @@ type ListOrgRunnerGroupOptions struct { // ListOrganizationRunnerGroups lists all self-hosted runner groups configured in an organization. // -// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runner-groups#list-self-hosted-runner-groups-for-an-organization +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#list-self-hosted-runner-groups-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/runner-groups func (s *ActionsService) ListOrganizationRunnerGroups(ctx context.Context, org string, opts *ListOrgRunnerGroupOptions) (*RunnerGroups, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups", org) u, err := addOptions(u, opts) @@ -104,7 +106,9 @@ func (s *ActionsService) ListOrganizationRunnerGroups(ctx context.Context, org s // GetOrganizationRunnerGroup gets a specific self-hosted runner group for an organization using its RunnerGroup ID. // -// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runner-groups#get-a-self-hosted-runner-group-for-an-organization +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#get-a-self-hosted-runner-group-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/runner-groups/{runner_group_id} func (s *ActionsService) GetOrganizationRunnerGroup(ctx context.Context, org string, groupID int64) (*RunnerGroup, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v", org, groupID) req, err := s.client.NewRequest("GET", u, nil) @@ -123,7 +127,9 @@ func (s *ActionsService) GetOrganizationRunnerGroup(ctx context.Context, org str // DeleteOrganizationRunnerGroup deletes a self-hosted runner group from an organization. // -// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runner-groups#delete-a-self-hosted-runner-group-from-an-organization +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#delete-a-self-hosted-runner-group-from-an-organization +// +//meta:operation DELETE /orgs/{org}/actions/runner-groups/{runner_group_id} func (s *ActionsService) DeleteOrganizationRunnerGroup(ctx context.Context, org string, groupID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v", org, groupID) @@ -137,7 +143,9 @@ func (s *ActionsService) DeleteOrganizationRunnerGroup(ctx context.Context, org // CreateOrganizationRunnerGroup creates a new self-hosted runner group for an organization. // -// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runner-groups#create-a-self-hosted-runner-group-for-an-organization +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#create-a-self-hosted-runner-group-for-an-organization +// +//meta:operation POST /orgs/{org}/actions/runner-groups func (s *ActionsService) CreateOrganizationRunnerGroup(ctx context.Context, org string, createReq CreateRunnerGroupRequest) (*RunnerGroup, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups", org) req, err := s.client.NewRequest("POST", u, createReq) @@ -156,7 +164,9 @@ func (s *ActionsService) CreateOrganizationRunnerGroup(ctx context.Context, org // UpdateOrganizationRunnerGroup updates a self-hosted runner group for an organization. // -// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runner-groups#update-a-self-hosted-runner-group-for-an-organization +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#update-a-self-hosted-runner-group-for-an-organization +// +//meta:operation PATCH /orgs/{org}/actions/runner-groups/{runner_group_id} func (s *ActionsService) UpdateOrganizationRunnerGroup(ctx context.Context, org string, groupID int64, updateReq UpdateRunnerGroupRequest) (*RunnerGroup, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v", org, groupID) req, err := s.client.NewRequest("PATCH", u, updateReq) @@ -175,7 +185,9 @@ func (s *ActionsService) UpdateOrganizationRunnerGroup(ctx context.Context, org // ListRepositoryAccessRunnerGroup lists the repositories with access to a self-hosted runner group configured in an organization. // -// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runner-groups#list-repository-access-to-a-self-hosted-runner-group-in-an-organization +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#list-repository-access-to-a-self-hosted-runner-group-in-an-organization +// +//meta:operation GET /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories func (s *ActionsService) ListRepositoryAccessRunnerGroup(ctx context.Context, org string, groupID int64, opts *ListOptions) (*ListRepositories, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v/repositories", org, groupID) u, err := addOptions(u, opts) @@ -200,7 +212,9 @@ func (s *ActionsService) ListRepositoryAccessRunnerGroup(ctx context.Context, or // SetRepositoryAccessRunnerGroup replaces the list of repositories that have access to a self-hosted runner group configured in an organization // with a new List of repositories. // -// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runner-groups#set-repository-access-for-a-self-hosted-runner-group-in-an-organization +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#set-repository-access-for-a-self-hosted-runner-group-in-an-organization +// +//meta:operation PUT /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories func (s *ActionsService) SetRepositoryAccessRunnerGroup(ctx context.Context, org string, groupID int64, ids SetRepoAccessRunnerGroupRequest) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v/repositories", org, groupID) @@ -215,7 +229,9 @@ func (s *ActionsService) SetRepositoryAccessRunnerGroup(ctx context.Context, org // AddRepositoryAccessRunnerGroup adds a repository to the list of selected repositories that can access a self-hosted runner group. // The runner group must have visibility set to 'selected'. // -// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runner-groups#add-repository-access-to-a-self-hosted-runner-group-in-an-organization +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#add-repository-access-to-a-self-hosted-runner-group-in-an-organization +// +//meta:operation PUT /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories/{repository_id} func (s *ActionsService) AddRepositoryAccessRunnerGroup(ctx context.Context, org string, groupID, repoID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v/repositories/%v", org, groupID, repoID) @@ -230,7 +246,9 @@ func (s *ActionsService) AddRepositoryAccessRunnerGroup(ctx context.Context, org // RemoveRepositoryAccessRunnerGroup removes a repository from the list of selected repositories that can access a self-hosted runner group. // The runner group must have visibility set to 'selected'. // -// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runner-groups#remove-repository-access-to-a-self-hosted-runner-group-in-an-organization +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#remove-repository-access-to-a-self-hosted-runner-group-in-an-organization +// +//meta:operation DELETE /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories/{repository_id} func (s *ActionsService) RemoveRepositoryAccessRunnerGroup(ctx context.Context, org string, groupID, repoID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v/repositories/%v", org, groupID, repoID) @@ -244,7 +262,9 @@ func (s *ActionsService) RemoveRepositoryAccessRunnerGroup(ctx context.Context, // ListRunnerGroupRunners lists self-hosted runners that are in a specific organization group. // -// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runner-groups#list-self-hosted-runners-in-a-group-for-an-organization +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#list-self-hosted-runners-in-a-group-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/runner-groups/{runner_group_id}/runners func (s *ActionsService) ListRunnerGroupRunners(ctx context.Context, org string, groupID int64, opts *ListOptions) (*Runners, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v/runners", org, groupID) u, err := addOptions(u, opts) @@ -269,7 +289,9 @@ func (s *ActionsService) ListRunnerGroupRunners(ctx context.Context, org string, // SetRunnerGroupRunners replaces the list of self-hosted runners that are part of an organization runner group // with a new list of runners. // -// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runner-groups#set-self-hosted-runners-in-a-group-for-an-organization +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#set-self-hosted-runners-in-a-group-for-an-organization +// +//meta:operation PUT /orgs/{org}/actions/runner-groups/{runner_group_id}/runners func (s *ActionsService) SetRunnerGroupRunners(ctx context.Context, org string, groupID int64, ids SetRunnerGroupRunnersRequest) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v/runners", org, groupID) @@ -283,7 +305,9 @@ func (s *ActionsService) SetRunnerGroupRunners(ctx context.Context, org string, // AddRunnerGroupRunners adds a self-hosted runner to a runner group configured in an organization. // -// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runner-groups#add-a-self-hosted-runner-to-a-group-for-an-organization +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#add-a-self-hosted-runner-to-a-group-for-an-organization +// +//meta:operation PUT /orgs/{org}/actions/runner-groups/{runner_group_id}/runners/{runner_id} func (s *ActionsService) AddRunnerGroupRunners(ctx context.Context, org string, groupID, runnerID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v/runners/%v", org, groupID, runnerID) @@ -298,7 +322,9 @@ func (s *ActionsService) AddRunnerGroupRunners(ctx context.Context, org string, // RemoveRunnerGroupRunners removes a self-hosted runner from a group configured in an organization. // The runner is then returned to the default group. // -// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runner-groups#remove-a-self-hosted-runner-from-a-group-for-an-organization +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#remove-a-self-hosted-runner-from-a-group-for-an-organization +// +//meta:operation DELETE /orgs/{org}/actions/runner-groups/{runner_group_id}/runners/{runner_id} func (s *ActionsService) RemoveRunnerGroupRunners(ctx context.Context, org string, groupID, runnerID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/runner-groups/%v/runners/%v", org, groupID, runnerID) diff --git a/github/actions_runners.go b/github/actions_runners.go index d54d6d41ca2..90cf5804e1e 100644 --- a/github/actions_runners.go +++ b/github/actions_runners.go @@ -22,7 +22,9 @@ type RunnerApplicationDownload struct { // ListRunnerApplicationDownloads lists self-hosted runner application binaries that can be downloaded and run. // -// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runners#list-runner-applications-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#list-runner-applications-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/actions/runners/downloads func (s *ActionsService) ListRunnerApplicationDownloads(ctx context.Context, owner, repo string) ([]*RunnerApplicationDownload, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runners/downloads", owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -58,7 +60,9 @@ type JITRunnerConfig struct { // GenerateOrgJITConfig generate a just-in-time configuration for an organization. // -// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runners?apiVersion=2022-11-28#create-configuration-for-a-just-in-time-runner-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#create-configuration-for-a-just-in-time-runner-for-an-organization +// +//meta:operation POST /orgs/{org}/actions/runners/generate-jitconfig func (s *ActionsService) GenerateOrgJITConfig(ctx context.Context, owner string, request *GenerateJITConfigRequest) (*JITRunnerConfig, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runners/generate-jitconfig", owner) req, err := s.client.NewRequest("POST", u, request) @@ -77,7 +81,9 @@ func (s *ActionsService) GenerateOrgJITConfig(ctx context.Context, owner string, // GenerateRepoJITConfig generates a just-in-time configuration for a repository. // -// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runners?apiVersion=2022-11-28#create-configuration-for-a-just-in-time-runner-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#create-configuration-for-a-just-in-time-runner-for-a-repository +// +//meta:operation POST /repos/{owner}/{repo}/actions/runners/generate-jitconfig func (s *ActionsService) GenerateRepoJITConfig(ctx context.Context, owner, repo string, request *GenerateJITConfigRequest) (*JITRunnerConfig, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runners/generate-jitconfig", owner, repo) req, err := s.client.NewRequest("POST", u, request) @@ -102,7 +108,9 @@ type RegistrationToken struct { // CreateRegistrationToken creates a token that can be used to add a self-hosted runner. // -// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runners#create-a-registration-token-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#create-a-registration-token-for-a-repository +// +//meta:operation POST /repos/{owner}/{repo}/actions/runners/registration-token func (s *ActionsService) CreateRegistrationToken(ctx context.Context, owner, repo string) (*RegistrationToken, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runners/registration-token", owner, repo) @@ -145,7 +153,9 @@ type Runners struct { // ListRunners lists all the self-hosted runners for a repository. // -// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runners#list-self-hosted-runners-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#list-self-hosted-runners-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/actions/runners func (s *ActionsService) ListRunners(ctx context.Context, owner, repo string, opts *ListOptions) (*Runners, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runners", owner, repo) u, err := addOptions(u, opts) @@ -169,7 +179,9 @@ func (s *ActionsService) ListRunners(ctx context.Context, owner, repo string, op // GetRunner gets a specific self-hosted runner for a repository using its runner ID. // -// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runners#get-a-self-hosted-runner-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#get-a-self-hosted-runner-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/actions/runners/{runner_id} func (s *ActionsService) GetRunner(ctx context.Context, owner, repo string, runnerID int64) (*Runner, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runners/%v", owner, repo, runnerID) req, err := s.client.NewRequest("GET", u, nil) @@ -194,7 +206,9 @@ type RemoveToken struct { // CreateRemoveToken creates a token that can be used to remove a self-hosted runner from a repository. // -// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runners#create-a-remove-token-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#create-a-remove-token-for-a-repository +// +//meta:operation POST /repos/{owner}/{repo}/actions/runners/remove-token func (s *ActionsService) CreateRemoveToken(ctx context.Context, owner, repo string) (*RemoveToken, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runners/remove-token", owner, repo) @@ -214,7 +228,9 @@ func (s *ActionsService) CreateRemoveToken(ctx context.Context, owner, repo stri // RemoveRunner forces the removal of a self-hosted runner in a repository using the runner id. // -// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runners#delete-a-self-hosted-runner-from-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#delete-a-self-hosted-runner-from-a-repository +// +//meta:operation DELETE /repos/{owner}/{repo}/actions/runners/{runner_id} func (s *ActionsService) RemoveRunner(ctx context.Context, owner, repo string, runnerID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runners/%v", owner, repo, runnerID) @@ -228,7 +244,9 @@ func (s *ActionsService) RemoveRunner(ctx context.Context, owner, repo string, r // ListOrganizationRunnerApplicationDownloads lists self-hosted runner application binaries that can be downloaded and run. // -// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runners#list-runner-applications-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#list-runner-applications-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/runners/downloads func (s *ActionsService) ListOrganizationRunnerApplicationDownloads(ctx context.Context, owner string) ([]*RunnerApplicationDownload, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runners/downloads", owner) req, err := s.client.NewRequest("GET", u, nil) @@ -247,7 +265,9 @@ func (s *ActionsService) ListOrganizationRunnerApplicationDownloads(ctx context. // CreateOrganizationRegistrationToken creates a token that can be used to add a self-hosted runner to an organization. // -// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runners#create-a-registration-token-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#create-a-registration-token-for-an-organization +// +//meta:operation POST /orgs/{org}/actions/runners/registration-token func (s *ActionsService) CreateOrganizationRegistrationToken(ctx context.Context, owner string) (*RegistrationToken, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runners/registration-token", owner) @@ -267,7 +287,9 @@ func (s *ActionsService) CreateOrganizationRegistrationToken(ctx context.Context // ListOrganizationRunners lists all the self-hosted runners for an organization. // -// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runners#list-self-hosted-runners-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#list-self-hosted-runners-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/runners func (s *ActionsService) ListOrganizationRunners(ctx context.Context, owner string, opts *ListOptions) (*Runners, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runners", owner) u, err := addOptions(u, opts) @@ -291,7 +313,9 @@ func (s *ActionsService) ListOrganizationRunners(ctx context.Context, owner stri // GetOrganizationRunner gets a specific self-hosted runner for an organization using its runner ID. // -// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runners#get-a-self-hosted-runner-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#get-a-self-hosted-runner-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/runners/{runner_id} func (s *ActionsService) GetOrganizationRunner(ctx context.Context, owner string, runnerID int64) (*Runner, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runners/%v", owner, runnerID) req, err := s.client.NewRequest("GET", u, nil) @@ -310,7 +334,9 @@ func (s *ActionsService) GetOrganizationRunner(ctx context.Context, owner string // CreateOrganizationRemoveToken creates a token that can be used to remove a self-hosted runner from an organization. // -// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runners#create-a-remove-token-for-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#create-a-remove-token-for-an-organization +// +//meta:operation POST /orgs/{org}/actions/runners/remove-token func (s *ActionsService) CreateOrganizationRemoveToken(ctx context.Context, owner string) (*RemoveToken, *Response, error) { u := fmt.Sprintf("orgs/%v/actions/runners/remove-token", owner) @@ -330,7 +356,9 @@ func (s *ActionsService) CreateOrganizationRemoveToken(ctx context.Context, owne // RemoveOrganizationRunner forces the removal of a self-hosted runner from an organization using the runner id. // -// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runners#delete-a-self-hosted-runner-from-an-organization +// GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#delete-a-self-hosted-runner-from-an-organization +// +//meta:operation DELETE /orgs/{org}/actions/runners/{runner_id} func (s *ActionsService) RemoveOrganizationRunner(ctx context.Context, owner string, runnerID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/actions/runners/%v", owner, runnerID) diff --git a/github/actions_secrets.go b/github/actions_secrets.go index 49985e12afa..2d4ba98db30 100644 --- a/github/actions_secrets.go +++ b/github/actions_secrets.go @@ -64,7 +64,9 @@ func (s *ActionsService) getPublicKey(ctx context.Context, url string) (*PublicK // GetRepoPublicKey gets a public key that should be used for secret encryption. // -// GitHub API docs: https://docs.github.com/en/rest/actions/secrets#get-a-repository-public-key +// GitHub API docs: https://docs.github.com/rest/actions/secrets#get-a-repository-public-key +// +//meta:operation GET /repos/{owner}/{repo}/actions/secrets/public-key func (s *ActionsService) GetRepoPublicKey(ctx context.Context, owner, repo string) (*PublicKey, *Response, error) { url := fmt.Sprintf("repos/%v/%v/actions/secrets/public-key", owner, repo) return s.getPublicKey(ctx, url) @@ -72,7 +74,9 @@ func (s *ActionsService) GetRepoPublicKey(ctx context.Context, owner, repo strin // GetOrgPublicKey gets a public key that should be used for secret encryption. // -// GitHub API docs: https://docs.github.com/en/rest/actions/secrets#get-an-organization-public-key +// GitHub API docs: https://docs.github.com/rest/actions/secrets#get-an-organization-public-key +// +//meta:operation GET /orgs/{org}/actions/secrets/public-key func (s *ActionsService) GetOrgPublicKey(ctx context.Context, org string) (*PublicKey, *Response, error) { url := fmt.Sprintf("orgs/%v/actions/secrets/public-key", org) return s.getPublicKey(ctx, url) @@ -80,7 +84,9 @@ func (s *ActionsService) GetOrgPublicKey(ctx context.Context, org string) (*Publ // GetEnvPublicKey gets a public key that should be used for secret encryption. // -// GitHub API docs: https://docs.github.com/en/rest/actions/secrets#get-an-environment-public-key +// GitHub API docs: https://docs.github.com/rest/actions/secrets#get-an-environment-public-key +// +//meta:operation GET /repositories/{repository_id}/environments/{environment_name}/secrets/public-key func (s *ActionsService) GetEnvPublicKey(ctx context.Context, repoID int, env string) (*PublicKey, *Response, error) { url := fmt.Sprintf("repositories/%v/environments/%v/secrets/public-key", repoID, env) return s.getPublicKey(ctx, url) @@ -124,7 +130,9 @@ func (s *ActionsService) listSecrets(ctx context.Context, url string, opts *List // ListRepoSecrets lists all secrets available in a repository // without revealing their encrypted values. // -// GitHub API docs: https://docs.github.com/en/rest/actions/secrets#list-repository-secrets +// GitHub API docs: https://docs.github.com/rest/actions/secrets#list-repository-secrets +// +//meta:operation GET /repos/{owner}/{repo}/actions/secrets func (s *ActionsService) ListRepoSecrets(ctx context.Context, owner, repo string, opts *ListOptions) (*Secrets, *Response, error) { url := fmt.Sprintf("repos/%v/%v/actions/secrets", owner, repo) return s.listSecrets(ctx, url, opts) @@ -133,7 +141,9 @@ func (s *ActionsService) ListRepoSecrets(ctx context.Context, owner, repo string // ListOrgSecrets lists all secrets available in an organization // without revealing their encrypted values. // -// GitHub API docs: https://docs.github.com/en/rest/actions/secrets#list-organization-secrets +// GitHub API docs: https://docs.github.com/rest/actions/secrets#list-organization-secrets +// +//meta:operation GET /orgs/{org}/actions/secrets func (s *ActionsService) ListOrgSecrets(ctx context.Context, org string, opts *ListOptions) (*Secrets, *Response, error) { url := fmt.Sprintf("orgs/%v/actions/secrets", org) return s.listSecrets(ctx, url, opts) @@ -141,7 +151,9 @@ func (s *ActionsService) ListOrgSecrets(ctx context.Context, org string, opts *L // ListEnvSecrets lists all secrets available in an environment. // -// GitHub API docs: https://docs.github.com/en/rest/actions/secrets#list-environment-secrets +// GitHub API docs: https://docs.github.com/rest/actions/secrets#list-environment-secrets +// +//meta:operation GET /repositories/{repository_id}/environments/{environment_name}/secrets func (s *ActionsService) ListEnvSecrets(ctx context.Context, repoID int, env string, opts *ListOptions) (*Secrets, *Response, error) { url := fmt.Sprintf("repositories/%v/environments/%v/secrets", repoID, env) return s.listSecrets(ctx, url, opts) @@ -164,7 +176,9 @@ func (s *ActionsService) getSecret(ctx context.Context, url string) (*Secret, *R // GetRepoSecret gets a single repository secret without revealing its encrypted value. // -// GitHub API docs: https://docs.github.com/en/rest/actions/secrets#get-a-repository-secret +// GitHub API docs: https://docs.github.com/rest/actions/secrets#get-a-repository-secret +// +//meta:operation GET /repos/{owner}/{repo}/actions/secrets/{secret_name} func (s *ActionsService) GetRepoSecret(ctx context.Context, owner, repo, name string) (*Secret, *Response, error) { url := fmt.Sprintf("repos/%v/%v/actions/secrets/%v", owner, repo, name) return s.getSecret(ctx, url) @@ -172,7 +186,9 @@ func (s *ActionsService) GetRepoSecret(ctx context.Context, owner, repo, name st // GetOrgSecret gets a single organization secret without revealing its encrypted value. // -// GitHub API docs: https://docs.github.com/en/rest/actions/secrets#get-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/actions/secrets#get-an-organization-secret +// +//meta:operation GET /orgs/{org}/actions/secrets/{secret_name} func (s *ActionsService) GetOrgSecret(ctx context.Context, org, name string) (*Secret, *Response, error) { url := fmt.Sprintf("orgs/%v/actions/secrets/%v", org, name) return s.getSecret(ctx, url) @@ -180,7 +196,9 @@ func (s *ActionsService) GetOrgSecret(ctx context.Context, org, name string) (*S // GetEnvSecret gets a single environment secret without revealing its encrypted value. // -// GitHub API docs: https://docs.github.com/en/rest/actions/secrets#get-an-environment-secret +// GitHub API docs: https://docs.github.com/rest/actions/secrets#get-an-environment-secret +// +//meta:operation GET /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name} func (s *ActionsService) GetEnvSecret(ctx context.Context, repoID int, env, secretName string) (*Secret, *Response, error) { url := fmt.Sprintf("repositories/%v/environments/%v/secrets/%v", repoID, env, secretName) return s.getSecret(ctx, url) @@ -213,7 +231,9 @@ func (s *ActionsService) putSecret(ctx context.Context, url string, eSecret *Enc // CreateOrUpdateRepoSecret creates or updates a repository secret with an encrypted value. // -// GitHub API docs: https://docs.github.com/en/rest/actions/secrets#create-or-update-a-repository-secret +// GitHub API docs: https://docs.github.com/rest/actions/secrets#create-or-update-a-repository-secret +// +//meta:operation PUT /repos/{owner}/{repo}/actions/secrets/{secret_name} func (s *ActionsService) CreateOrUpdateRepoSecret(ctx context.Context, owner, repo string, eSecret *EncryptedSecret) (*Response, error) { url := fmt.Sprintf("repos/%v/%v/actions/secrets/%v", owner, repo, eSecret.Name) return s.putSecret(ctx, url, eSecret) @@ -221,7 +241,9 @@ func (s *ActionsService) CreateOrUpdateRepoSecret(ctx context.Context, owner, re // CreateOrUpdateOrgSecret creates or updates an organization secret with an encrypted value. // -// GitHub API docs: https://docs.github.com/en/rest/actions/secrets#create-or-update-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/actions/secrets#create-or-update-an-organization-secret +// +//meta:operation PUT /orgs/{org}/actions/secrets/{secret_name} func (s *ActionsService) CreateOrUpdateOrgSecret(ctx context.Context, org string, eSecret *EncryptedSecret) (*Response, error) { url := fmt.Sprintf("orgs/%v/actions/secrets/%v", org, eSecret.Name) return s.putSecret(ctx, url, eSecret) @@ -229,7 +251,9 @@ func (s *ActionsService) CreateOrUpdateOrgSecret(ctx context.Context, org string // CreateOrUpdateEnvSecret creates or updates a single environment secret with an encrypted value. // -// GitHub API docs: https://docs.github.com/en/rest/actions/secrets#create-or-update-an-environment-secret +// GitHub API docs: https://docs.github.com/rest/actions/secrets#create-or-update-an-environment-secret +// +//meta:operation PUT /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name} func (s *ActionsService) CreateOrUpdateEnvSecret(ctx context.Context, repoID int, env string, eSecret *EncryptedSecret) (*Response, error) { url := fmt.Sprintf("repositories/%v/environments/%v/secrets/%v", repoID, env, eSecret.Name) return s.putSecret(ctx, url, eSecret) @@ -246,7 +270,9 @@ func (s *ActionsService) deleteSecret(ctx context.Context, url string) (*Respons // DeleteRepoSecret deletes a secret in a repository using the secret name. // -// GitHub API docs: https://docs.github.com/en/rest/actions/secrets#delete-a-repository-secret +// GitHub API docs: https://docs.github.com/rest/actions/secrets#delete-a-repository-secret +// +//meta:operation DELETE /repos/{owner}/{repo}/actions/secrets/{secret_name} func (s *ActionsService) DeleteRepoSecret(ctx context.Context, owner, repo, name string) (*Response, error) { url := fmt.Sprintf("repos/%v/%v/actions/secrets/%v", owner, repo, name) return s.deleteSecret(ctx, url) @@ -254,7 +280,9 @@ func (s *ActionsService) DeleteRepoSecret(ctx context.Context, owner, repo, name // DeleteOrgSecret deletes a secret in an organization using the secret name. // -// GitHub API docs: https://docs.github.com/en/rest/actions/secrets#delete-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/actions/secrets#delete-an-organization-secret +// +//meta:operation DELETE /orgs/{org}/actions/secrets/{secret_name} func (s *ActionsService) DeleteOrgSecret(ctx context.Context, org, name string) (*Response, error) { url := fmt.Sprintf("orgs/%v/actions/secrets/%v", org, name) return s.deleteSecret(ctx, url) @@ -262,7 +290,9 @@ func (s *ActionsService) DeleteOrgSecret(ctx context.Context, org, name string) // DeleteEnvSecret deletes a secret in an environment using the secret name. // -// GitHub API docs: https://docs.github.com/en/rest/actions/secrets#delete-an-environment-secret +// GitHub API docs: https://docs.github.com/rest/actions/secrets#delete-an-environment-secret +// +//meta:operation DELETE /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name} func (s *ActionsService) DeleteEnvSecret(ctx context.Context, repoID int, env, secretName string) (*Response, error) { url := fmt.Sprintf("repositories/%v/environments/%v/secrets/%v", repoID, env, secretName) return s.deleteSecret(ctx, url) @@ -296,7 +326,9 @@ func (s *ActionsService) listSelectedReposForSecret(ctx context.Context, url str // ListSelectedReposForOrgSecret lists all repositories that have access to a secret. // -// GitHub API docs: https://docs.github.com/en/rest/actions/secrets#list-selected-repositories-for-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/actions/secrets#list-selected-repositories-for-an-organization-secret +// +//meta:operation GET /orgs/{org}/actions/secrets/{secret_name}/repositories func (s *ActionsService) ListSelectedReposForOrgSecret(ctx context.Context, org, name string, opts *ListOptions) (*SelectedReposList, *Response, error) { url := fmt.Sprintf("orgs/%v/actions/secrets/%v/repositories", org, name) return s.listSelectedReposForSecret(ctx, url, opts) @@ -317,7 +349,9 @@ func (s *ActionsService) setSelectedReposForSecret(ctx context.Context, url stri // SetSelectedReposForOrgSecret sets the repositories that have access to a secret. // -// GitHub API docs: https://docs.github.com/en/rest/actions/secrets#set-selected-repositories-for-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/actions/secrets#set-selected-repositories-for-an-organization-secret +// +//meta:operation PUT /orgs/{org}/actions/secrets/{secret_name}/repositories func (s *ActionsService) SetSelectedReposForOrgSecret(ctx context.Context, org, name string, ids SelectedRepoIDs) (*Response, error) { url := fmt.Sprintf("orgs/%v/actions/secrets/%v/repositories", org, name) return s.setSelectedReposForSecret(ctx, url, ids) @@ -334,7 +368,9 @@ func (s *ActionsService) addSelectedRepoToSecret(ctx context.Context, url string // AddSelectedRepoToOrgSecret adds a repository to an organization secret. // -// GitHub API docs: https://docs.github.com/en/rest/actions/secrets#add-selected-repository-to-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/actions/secrets#add-selected-repository-to-an-organization-secret +// +//meta:operation PUT /orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id} func (s *ActionsService) AddSelectedRepoToOrgSecret(ctx context.Context, org, name string, repo *Repository) (*Response, error) { url := fmt.Sprintf("orgs/%v/actions/secrets/%v/repositories/%v", org, name, *repo.ID) return s.addSelectedRepoToSecret(ctx, url) @@ -351,7 +387,9 @@ func (s *ActionsService) removeSelectedRepoFromSecret(ctx context.Context, url s // RemoveSelectedRepoFromOrgSecret removes a repository from an organization secret. // -// GitHub API docs: https://docs.github.com/en/rest/actions/secrets#remove-selected-repository-from-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/actions/secrets#remove-selected-repository-from-an-organization-secret +// +//meta:operation DELETE /orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id} func (s *ActionsService) RemoveSelectedRepoFromOrgSecret(ctx context.Context, org, name string, repo *Repository) (*Response, error) { url := fmt.Sprintf("orgs/%v/actions/secrets/%v/repositories/%v", org, name, *repo.ID) return s.removeSelectedRepoFromSecret(ctx, url) diff --git a/github/actions_variables.go b/github/actions_variables.go index 29445edd042..244d159079e 100644 --- a/github/actions_variables.go +++ b/github/actions_variables.go @@ -51,7 +51,9 @@ func (s *ActionsService) listVariables(ctx context.Context, url string, opts *Li // ListRepoVariables lists all variables available in a repository. // -// GitHub API docs: https://docs.github.com/en/rest/actions/variables#list-repository-variables +// GitHub API docs: https://docs.github.com/rest/actions/variables#list-repository-variables +// +//meta:operation GET /repos/{owner}/{repo}/actions/variables func (s *ActionsService) ListRepoVariables(ctx context.Context, owner, repo string, opts *ListOptions) (*ActionsVariables, *Response, error) { url := fmt.Sprintf("repos/%v/%v/actions/variables", owner, repo) return s.listVariables(ctx, url, opts) @@ -59,7 +61,9 @@ func (s *ActionsService) ListRepoVariables(ctx context.Context, owner, repo stri // ListOrgVariables lists all variables available in an organization. // -// GitHub API docs: https://docs.github.com/en/rest/actions/variables#list-organization-variables +// GitHub API docs: https://docs.github.com/rest/actions/variables#list-organization-variables +// +//meta:operation GET /orgs/{org}/actions/variables func (s *ActionsService) ListOrgVariables(ctx context.Context, org string, opts *ListOptions) (*ActionsVariables, *Response, error) { url := fmt.Sprintf("orgs/%v/actions/variables", org) return s.listVariables(ctx, url, opts) @@ -67,7 +71,9 @@ func (s *ActionsService) ListOrgVariables(ctx context.Context, org string, opts // ListEnvVariables lists all variables available in an environment. // -// GitHub API docs: https://docs.github.com/en/rest/actions/variables#list-environment-variables +// GitHub API docs: https://docs.github.com/rest/actions/variables#list-environment-variables +// +//meta:operation GET /repositories/{repository_id}/environments/{environment_name}/variables func (s *ActionsService) ListEnvVariables(ctx context.Context, repoID int, env string, opts *ListOptions) (*ActionsVariables, *Response, error) { url := fmt.Sprintf("repositories/%v/environments/%v/variables", repoID, env) return s.listVariables(ctx, url, opts) @@ -90,7 +96,9 @@ func (s *ActionsService) getVariable(ctx context.Context, url string) (*ActionsV // GetRepoVariable gets a single repository variable. // -// GitHub API docs: https://docs.github.com/en/rest/actions/variables#get-a-repository-variable +// GitHub API docs: https://docs.github.com/rest/actions/variables#get-a-repository-variable +// +//meta:operation GET /repos/{owner}/{repo}/actions/variables/{name} func (s *ActionsService) GetRepoVariable(ctx context.Context, owner, repo, name string) (*ActionsVariable, *Response, error) { url := fmt.Sprintf("repos/%v/%v/actions/variables/%v", owner, repo, name) return s.getVariable(ctx, url) @@ -98,7 +106,9 @@ func (s *ActionsService) GetRepoVariable(ctx context.Context, owner, repo, name // GetOrgVariable gets a single organization variable. // -// GitHub API docs: https://docs.github.com/en/rest/actions/variables#get-an-organization-variable +// GitHub API docs: https://docs.github.com/rest/actions/variables#get-an-organization-variable +// +//meta:operation GET /orgs/{org}/actions/variables/{name} func (s *ActionsService) GetOrgVariable(ctx context.Context, org, name string) (*ActionsVariable, *Response, error) { url := fmt.Sprintf("orgs/%v/actions/variables/%v", org, name) return s.getVariable(ctx, url) @@ -106,7 +116,9 @@ func (s *ActionsService) GetOrgVariable(ctx context.Context, org, name string) ( // GetEnvVariable gets a single environment variable. // -// GitHub API docs: https://docs.github.com/en/rest/actions/variables#get-an-environment-variable +// GitHub API docs: https://docs.github.com/rest/actions/variables#get-an-environment-variable +// +//meta:operation GET /repositories/{repository_id}/environments/{environment_name}/variables/{name} func (s *ActionsService) GetEnvVariable(ctx context.Context, repoID int, env, variableName string) (*ActionsVariable, *Response, error) { url := fmt.Sprintf("repositories/%v/environments/%v/variables/%v", repoID, env, variableName) return s.getVariable(ctx, url) @@ -122,7 +134,9 @@ func (s *ActionsService) postVariable(ctx context.Context, url string, variable // CreateRepoVariable creates a repository variable. // -// GitHub API docs: https://docs.github.com/en/rest/actions/variables#create-a-repository-variable +// GitHub API docs: https://docs.github.com/rest/actions/variables#create-a-repository-variable +// +//meta:operation POST /repos/{owner}/{repo}/actions/variables func (s *ActionsService) CreateRepoVariable(ctx context.Context, owner, repo string, variable *ActionsVariable) (*Response, error) { url := fmt.Sprintf("repos/%v/%v/actions/variables", owner, repo) return s.postVariable(ctx, url, variable) @@ -130,7 +144,9 @@ func (s *ActionsService) CreateRepoVariable(ctx context.Context, owner, repo str // CreateOrgVariable creates an organization variable. // -// GitHub API docs: https://docs.github.com/en/rest/actions/variables#create-an-organization-variable +// GitHub API docs: https://docs.github.com/rest/actions/variables#create-an-organization-variable +// +//meta:operation POST /orgs/{org}/actions/variables func (s *ActionsService) CreateOrgVariable(ctx context.Context, org string, variable *ActionsVariable) (*Response, error) { url := fmt.Sprintf("orgs/%v/actions/variables", org) return s.postVariable(ctx, url, variable) @@ -138,7 +154,9 @@ func (s *ActionsService) CreateOrgVariable(ctx context.Context, org string, vari // CreateEnvVariable creates an environment variable. // -// GitHub API docs: https://docs.github.com/en/rest/actions/variables#create-an-environment-variable +// GitHub API docs: https://docs.github.com/rest/actions/variables#create-an-environment-variable +// +//meta:operation POST /repositories/{repository_id}/environments/{environment_name}/variables func (s *ActionsService) CreateEnvVariable(ctx context.Context, repoID int, env string, variable *ActionsVariable) (*Response, error) { url := fmt.Sprintf("repositories/%v/environments/%v/variables", repoID, env) return s.postVariable(ctx, url, variable) @@ -154,7 +172,9 @@ func (s *ActionsService) patchVariable(ctx context.Context, url string, variable // UpdateRepoVariable updates a repository variable. // -// GitHub API docs: https://docs.github.com/en/rest/actions/variables#update-a-repository-variable +// GitHub API docs: https://docs.github.com/rest/actions/variables#update-a-repository-variable +// +//meta:operation PATCH /repos/{owner}/{repo}/actions/variables/{name} func (s *ActionsService) UpdateRepoVariable(ctx context.Context, owner, repo string, variable *ActionsVariable) (*Response, error) { url := fmt.Sprintf("repos/%v/%v/actions/variables/%v", owner, repo, variable.Name) return s.patchVariable(ctx, url, variable) @@ -162,7 +182,9 @@ func (s *ActionsService) UpdateRepoVariable(ctx context.Context, owner, repo str // UpdateOrgVariable updates an organization variable. // -// GitHub API docs: https://docs.github.com/en/rest/actions/variables#update-an-organization-variable +// GitHub API docs: https://docs.github.com/rest/actions/variables#update-an-organization-variable +// +//meta:operation PATCH /orgs/{org}/actions/variables/{name} func (s *ActionsService) UpdateOrgVariable(ctx context.Context, org string, variable *ActionsVariable) (*Response, error) { url := fmt.Sprintf("orgs/%v/actions/variables/%v", org, variable.Name) return s.patchVariable(ctx, url, variable) @@ -170,7 +192,9 @@ func (s *ActionsService) UpdateOrgVariable(ctx context.Context, org string, vari // UpdateEnvVariable updates an environment variable. // -// GitHub API docs: https://docs.github.com/en/rest/actions/variables#create-an-environment-variable +// GitHub API docs: https://docs.github.com/rest/actions/variables#update-an-environment-variable +// +//meta:operation PATCH /repositories/{repository_id}/environments/{environment_name}/variables/{name} func (s *ActionsService) UpdateEnvVariable(ctx context.Context, repoID int, env string, variable *ActionsVariable) (*Response, error) { url := fmt.Sprintf("repositories/%v/environments/%v/variables/%v", repoID, env, variable.Name) return s.patchVariable(ctx, url, variable) @@ -187,7 +211,9 @@ func (s *ActionsService) deleteVariable(ctx context.Context, url string) (*Respo // DeleteRepoVariable deletes a variable in a repository. // -// GitHub API docs: https://docs.github.com/en/rest/actions/variables#delete-a-repository-variable +// GitHub API docs: https://docs.github.com/rest/actions/variables#delete-a-repository-variable +// +//meta:operation DELETE /repos/{owner}/{repo}/actions/variables/{name} func (s *ActionsService) DeleteRepoVariable(ctx context.Context, owner, repo, name string) (*Response, error) { url := fmt.Sprintf("repos/%v/%v/actions/variables/%v", owner, repo, name) return s.deleteVariable(ctx, url) @@ -195,7 +221,9 @@ func (s *ActionsService) DeleteRepoVariable(ctx context.Context, owner, repo, na // DeleteOrgVariable deletes a variable in an organization. // -// GitHub API docs: https://docs.github.com/en/rest/actions/variables#delete-an-organization-variable +// GitHub API docs: https://docs.github.com/rest/actions/variables#delete-an-organization-variable +// +//meta:operation DELETE /orgs/{org}/actions/variables/{name} func (s *ActionsService) DeleteOrgVariable(ctx context.Context, org, name string) (*Response, error) { url := fmt.Sprintf("orgs/%v/actions/variables/%v", org, name) return s.deleteVariable(ctx, url) @@ -203,7 +231,9 @@ func (s *ActionsService) DeleteOrgVariable(ctx context.Context, org, name string // DeleteEnvVariable deletes a variable in an environment. // -// GitHub API docs: https://docs.github.com/en/rest/actions/variables#delete-an-environment-variable +// GitHub API docs: https://docs.github.com/rest/actions/variables#delete-an-environment-variable +// +//meta:operation DELETE /repositories/{repository_id}/environments/{environment_name}/variables/{name} func (s *ActionsService) DeleteEnvVariable(ctx context.Context, repoID int, env, variableName string) (*Response, error) { url := fmt.Sprintf("repositories/%v/environments/%v/variables/%v", repoID, env, variableName) return s.deleteVariable(ctx, url) @@ -231,7 +261,9 @@ func (s *ActionsService) listSelectedReposForVariable(ctx context.Context, url s // ListSelectedReposForOrgVariable lists all repositories that have access to a variable. // -// GitHub API docs: https://docs.github.com/en/rest/actions/variables#list-selected-repositories-for-an-organization-variable +// GitHub API docs: https://docs.github.com/rest/actions/variables#list-selected-repositories-for-an-organization-variable +// +//meta:operation GET /orgs/{org}/actions/variables/{name}/repositories func (s *ActionsService) ListSelectedReposForOrgVariable(ctx context.Context, org, name string, opts *ListOptions) (*SelectedReposList, *Response, error) { url := fmt.Sprintf("orgs/%v/actions/variables/%v/repositories", org, name) return s.listSelectedReposForVariable(ctx, url, opts) @@ -252,7 +284,9 @@ func (s *ActionsService) setSelectedReposForVariable(ctx context.Context, url st // SetSelectedReposForOrgVariable sets the repositories that have access to a variable. // -// GitHub API docs: https://docs.github.com/en/rest/actions/variables#set-selected-repositories-for-an-organization-variable +// GitHub API docs: https://docs.github.com/rest/actions/variables#set-selected-repositories-for-an-organization-variable +// +//meta:operation PUT /orgs/{org}/actions/variables/{name}/repositories func (s *ActionsService) SetSelectedReposForOrgVariable(ctx context.Context, org, name string, ids SelectedRepoIDs) (*Response, error) { url := fmt.Sprintf("orgs/%v/actions/variables/%v/repositories", org, name) return s.setSelectedReposForVariable(ctx, url, ids) @@ -269,7 +303,9 @@ func (s *ActionsService) addSelectedRepoToVariable(ctx context.Context, url stri // AddSelectedRepoToOrgVariable adds a repository to an organization variable. // -// GitHub API docs: https://docs.github.com/en/rest/actions/variables#add-selected-repository-to-an-organization-variable +// GitHub API docs: https://docs.github.com/rest/actions/variables#add-selected-repository-to-an-organization-variable +// +//meta:operation PUT /orgs/{org}/actions/variables/{name}/repositories/{repository_id} func (s *ActionsService) AddSelectedRepoToOrgVariable(ctx context.Context, org, name string, repo *Repository) (*Response, error) { url := fmt.Sprintf("orgs/%v/actions/variables/%v/repositories/%v", org, name, *repo.ID) return s.addSelectedRepoToVariable(ctx, url) @@ -286,7 +322,9 @@ func (s *ActionsService) removeSelectedRepoFromVariable(ctx context.Context, url // RemoveSelectedRepoFromOrgVariable removes a repository from an organization variable. // -// GitHub API docs: https://docs.github.com/en/rest/actions/variables#remove-selected-repository-from-an-organization-variable +// GitHub API docs: https://docs.github.com/rest/actions/variables#remove-selected-repository-from-an-organization-variable +// +//meta:operation DELETE /orgs/{org}/actions/variables/{name}/repositories/{repository_id} func (s *ActionsService) RemoveSelectedRepoFromOrgVariable(ctx context.Context, org, name string, repo *Repository) (*Response, error) { url := fmt.Sprintf("orgs/%v/actions/variables/%v/repositories/%v", org, name, *repo.ID) return s.removeSelectedRepoFromVariable(ctx, url) diff --git a/github/actions_workflow_jobs.go b/github/actions_workflow_jobs.go index 87d117ba9a9..0e0eb6e1146 100644 --- a/github/actions_workflow_jobs.go +++ b/github/actions_workflow_jobs.go @@ -70,7 +70,9 @@ type ListWorkflowJobsOptions struct { // ListWorkflowJobs lists all jobs for a workflow run. // -// GitHub API docs: https://docs.github.com/en/rest/actions/workflow-jobs#list-jobs-for-a-workflow-run +// GitHub API docs: https://docs.github.com/rest/actions/workflow-jobs#list-jobs-for-a-workflow-run +// +//meta:operation GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs func (s *ActionsService) ListWorkflowJobs(ctx context.Context, owner, repo string, runID int64, opts *ListWorkflowJobsOptions) (*Jobs, *Response, error) { u := fmt.Sprintf("repos/%s/%s/actions/runs/%v/jobs", owner, repo, runID) u, err := addOptions(u, opts) @@ -94,7 +96,9 @@ func (s *ActionsService) ListWorkflowJobs(ctx context.Context, owner, repo strin // GetWorkflowJobByID gets a specific job in a workflow run by ID. // -// GitHub API docs: https://docs.github.com/en/rest/actions/workflow-jobs#get-a-job-for-a-workflow-run +// GitHub API docs: https://docs.github.com/rest/actions/workflow-jobs#get-a-job-for-a-workflow-run +// +//meta:operation GET /repos/{owner}/{repo}/actions/jobs/{job_id} func (s *ActionsService) GetWorkflowJobByID(ctx context.Context, owner, repo string, jobID int64) (*WorkflowJob, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/jobs/%v", owner, repo, jobID) @@ -114,7 +118,9 @@ func (s *ActionsService) GetWorkflowJobByID(ctx context.Context, owner, repo str // GetWorkflowJobLogs gets a redirect URL to download a plain text file of logs for a workflow job. // -// GitHub API docs: https://docs.github.com/en/rest/actions/workflow-jobs#download-job-logs-for-a-workflow-run +// GitHub API docs: https://docs.github.com/rest/actions/workflow-jobs#download-job-logs-for-a-workflow-run +// +//meta:operation GET /repos/{owner}/{repo}/actions/jobs/{job_id}/logs func (s *ActionsService) GetWorkflowJobLogs(ctx context.Context, owner, repo string, jobID int64, maxRedirects int) (*url.URL, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/jobs/%v/logs", owner, repo, jobID) diff --git a/github/actions_workflow_runs.go b/github/actions_workflow_runs.go index d57e4887db1..bc7afe9e944 100644 --- a/github/actions_workflow_runs.go +++ b/github/actions_workflow_runs.go @@ -133,7 +133,9 @@ func (s *ActionsService) listWorkflowRuns(ctx context.Context, endpoint string, // ListWorkflowRunsByID lists all workflow runs by workflow ID. // -// GitHub API docs: https://docs.github.com/en/rest/actions/workflow-runs#list-workflow-runs +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#list-workflow-runs-for-a-workflow +// +//meta:operation GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs func (s *ActionsService) ListWorkflowRunsByID(ctx context.Context, owner, repo string, workflowID int64, opts *ListWorkflowRunsOptions) (*WorkflowRuns, *Response, error) { u := fmt.Sprintf("repos/%s/%s/actions/workflows/%v/runs", owner, repo, workflowID) return s.listWorkflowRuns(ctx, u, opts) @@ -141,7 +143,9 @@ func (s *ActionsService) ListWorkflowRunsByID(ctx context.Context, owner, repo s // ListWorkflowRunsByFileName lists all workflow runs by workflow file name. // -// GitHub API docs: https://docs.github.com/en/rest/actions/workflow-runs#list-workflow-runs +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#list-workflow-runs-for-a-workflow +// +//meta:operation GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs func (s *ActionsService) ListWorkflowRunsByFileName(ctx context.Context, owner, repo, workflowFileName string, opts *ListWorkflowRunsOptions) (*WorkflowRuns, *Response, error) { u := fmt.Sprintf("repos/%s/%s/actions/workflows/%v/runs", owner, repo, workflowFileName) return s.listWorkflowRuns(ctx, u, opts) @@ -149,7 +153,9 @@ func (s *ActionsService) ListWorkflowRunsByFileName(ctx context.Context, owner, // ListRepositoryWorkflowRuns lists all workflow runs for a repository. // -// GitHub API docs: https://docs.github.com/en/rest/actions/workflow-runs#list-workflow-runs-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#list-workflow-runs-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/actions/runs func (s *ActionsService) ListRepositoryWorkflowRuns(ctx context.Context, owner, repo string, opts *ListWorkflowRunsOptions) (*WorkflowRuns, *Response, error) { u := fmt.Sprintf("repos/%s/%s/actions/runs", owner, repo) u, err := addOptions(u, opts) @@ -173,7 +179,9 @@ func (s *ActionsService) ListRepositoryWorkflowRuns(ctx context.Context, owner, // GetWorkflowRunByID gets a specific workflow run by ID. // -// GitHub API docs: https://docs.github.com/en/rest/actions/workflow-runs#get-a-workflow-run +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#get-a-workflow-run +// +//meta:operation GET /repos/{owner}/{repo}/actions/runs/{run_id} func (s *ActionsService) GetWorkflowRunByID(ctx context.Context, owner, repo string, runID int64) (*WorkflowRun, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v", owner, repo, runID) @@ -193,7 +201,9 @@ func (s *ActionsService) GetWorkflowRunByID(ctx context.Context, owner, repo str // GetWorkflowRunAttempt gets a specific workflow run attempt. // -// GitHub API docs: https://docs.github.com/en/rest/actions/workflow-runs#get-a-workflow-run-attempt +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#get-a-workflow-run-attempt +// +//meta:operation GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number} func (s *ActionsService) GetWorkflowRunAttempt(ctx context.Context, owner, repo string, runID int64, attemptNumber int, opts *WorkflowRunAttemptOptions) (*WorkflowRun, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/attempts/%v", owner, repo, runID, attemptNumber) u, err := addOptions(u, opts) @@ -217,7 +227,9 @@ func (s *ActionsService) GetWorkflowRunAttempt(ctx context.Context, owner, repo // GetWorkflowRunAttemptLogs gets a redirect URL to download a plain text file of logs for a workflow run for attempt number. // -// GitHub API docs: https://docs.github.com/en/rest/actions/workflow-runs#download-workflow-run-attempt-logs +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#download-workflow-run-attempt-logs +// +//meta:operation GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/logs func (s *ActionsService) GetWorkflowRunAttemptLogs(ctx context.Context, owner, repo string, runID int64, attemptNumber int, maxRedirects int) (*url.URL, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/attempts/%v/logs", owner, repo, runID, attemptNumber) @@ -237,7 +249,9 @@ func (s *ActionsService) GetWorkflowRunAttemptLogs(ctx context.Context, owner, r // RerunWorkflowByID re-runs a workflow by ID. // -// GitHub API docs: https://docs.github.com/en/rest/actions/workflow-runs#re-run-a-workflow +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#re-run-a-workflow +// +//meta:operation POST /repos/{owner}/{repo}/actions/runs/{run_id}/rerun func (s *ActionsService) RerunWorkflowByID(ctx context.Context, owner, repo string, runID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/rerun", owner, repo, runID) @@ -251,7 +265,9 @@ func (s *ActionsService) RerunWorkflowByID(ctx context.Context, owner, repo stri // RerunFailedJobsByID re-runs all of the failed jobs and their dependent jobs in a workflow run by ID. // -// GitHub API docs: https://docs.github.com/en/rest/actions/workflow-runs#re-run-failed-jobs-from-a-workflow-run +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#re-run-failed-jobs-from-a-workflow-run +// +//meta:operation POST /repos/{owner}/{repo}/actions/runs/{run_id}/rerun-failed-jobs func (s *ActionsService) RerunFailedJobsByID(ctx context.Context, owner, repo string, runID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/rerun-failed-jobs", owner, repo, runID) @@ -265,7 +281,9 @@ func (s *ActionsService) RerunFailedJobsByID(ctx context.Context, owner, repo st // RerunJobByID re-runs a job and its dependent jobs in a workflow run by ID. // -// GitHub API docs: https://docs.github.com/en/rest/actions/workflow-runs#re-run-a-job-from-a-workflow-run +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#re-run-a-job-from-a-workflow-run +// +//meta:operation POST /repos/{owner}/{repo}/actions/jobs/{job_id}/rerun func (s *ActionsService) RerunJobByID(ctx context.Context, owner, repo string, jobID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/jobs/%v/rerun", owner, repo, jobID) @@ -279,7 +297,9 @@ func (s *ActionsService) RerunJobByID(ctx context.Context, owner, repo string, j // CancelWorkflowRunByID cancels a workflow run by ID. // -// GitHub API docs: https://docs.github.com/en/rest/actions/workflow-runs#cancel-a-workflow-run +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#cancel-a-workflow-run +// +//meta:operation POST /repos/{owner}/{repo}/actions/runs/{run_id}/cancel func (s *ActionsService) CancelWorkflowRunByID(ctx context.Context, owner, repo string, runID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/cancel", owner, repo, runID) @@ -293,7 +313,9 @@ func (s *ActionsService) CancelWorkflowRunByID(ctx context.Context, owner, repo // GetWorkflowRunLogs gets a redirect URL to download a plain text file of logs for a workflow run. // -// GitHub API docs: https://docs.github.com/en/rest/actions/workflow-runs#download-workflow-run-logs +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#download-workflow-run-logs +// +//meta:operation GET /repos/{owner}/{repo}/actions/runs/{run_id}/logs func (s *ActionsService) GetWorkflowRunLogs(ctx context.Context, owner, repo string, runID int64, maxRedirects int) (*url.URL, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/logs", owner, repo, runID) @@ -313,7 +335,9 @@ func (s *ActionsService) GetWorkflowRunLogs(ctx context.Context, owner, repo str // DeleteWorkflowRun deletes a workflow run by ID. // -// GitHub API docs: https://docs.github.com/en/rest/actions/workflow-runs#delete-a-workflow-run +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#delete-a-workflow-run +// +//meta:operation DELETE /repos/{owner}/{repo}/actions/runs/{run_id} func (s *ActionsService) DeleteWorkflowRun(ctx context.Context, owner, repo string, runID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v", owner, repo, runID) @@ -327,7 +351,9 @@ func (s *ActionsService) DeleteWorkflowRun(ctx context.Context, owner, repo stri // DeleteWorkflowRunLogs deletes all logs for a workflow run. // -// GitHub API docs: https://docs.github.com/en/rest/actions/workflow-runs#delete-workflow-run-logs +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#delete-workflow-run-logs +// +//meta:operation DELETE /repos/{owner}/{repo}/actions/runs/{run_id}/logs func (s *ActionsService) DeleteWorkflowRunLogs(ctx context.Context, owner, repo string, runID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/logs", owner, repo, runID) @@ -341,7 +367,9 @@ func (s *ActionsService) DeleteWorkflowRunLogs(ctx context.Context, owner, repo // GetWorkflowRunUsageByID gets a specific workflow usage run by run ID in the unit of billable milliseconds. // -// GitHub API docs: https://docs.github.com/en/rest/actions/workflow-runs#get-workflow-run-usage +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#get-workflow-run-usage +// +//meta:operation GET /repos/{owner}/{repo}/actions/runs/{run_id}/timing func (s *ActionsService) GetWorkflowRunUsageByID(ctx context.Context, owner, repo string, runID int64) (*WorkflowRunUsage, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/timing", owner, repo, runID) @@ -361,7 +389,9 @@ func (s *ActionsService) GetWorkflowRunUsageByID(ctx context.Context, owner, rep // PendingDeployments approve or reject pending deployments that are waiting on approval by a required reviewer. // -// GitHub API docs: https://docs.github.com/en/rest/actions/workflow-runs#review-pending-deployments-for-a-workflow-run +// GitHub API docs: https://docs.github.com/rest/actions/workflow-runs#review-pending-deployments-for-a-workflow-run +// +//meta:operation POST /repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments func (s *ActionsService) PendingDeployments(ctx context.Context, owner, repo string, runID int64, request *PendingDeploymentsRequest) ([]*Deployment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/pending_deployments", owner, repo, runID) diff --git a/github/actions_workflows.go b/github/actions_workflows.go index c9b47ed4be4..0214e6abff2 100644 --- a/github/actions_workflows.go +++ b/github/actions_workflows.go @@ -58,7 +58,9 @@ type CreateWorkflowDispatchEventRequest struct { // ListWorkflows lists all workflows in a repository. // -// GitHub API docs: https://docs.github.com/en/rest/actions/workflows#list-repository-workflows +// GitHub API docs: https://docs.github.com/rest/actions/workflows#list-repository-workflows +// +//meta:operation GET /repos/{owner}/{repo}/actions/workflows func (s *ActionsService) ListWorkflows(ctx context.Context, owner, repo string, opts *ListOptions) (*Workflows, *Response, error) { u := fmt.Sprintf("repos/%s/%s/actions/workflows", owner, repo) u, err := addOptions(u, opts) @@ -82,7 +84,9 @@ func (s *ActionsService) ListWorkflows(ctx context.Context, owner, repo string, // GetWorkflowByID gets a specific workflow by ID. // -// GitHub API docs: https://docs.github.com/en/rest/actions/workflows#get-a-workflow +// GitHub API docs: https://docs.github.com/rest/actions/workflows#get-a-workflow +// +//meta:operation GET /repos/{owner}/{repo}/actions/workflows/{workflow_id} func (s *ActionsService) GetWorkflowByID(ctx context.Context, owner, repo string, workflowID int64) (*Workflow, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v", owner, repo, workflowID) @@ -91,7 +95,9 @@ func (s *ActionsService) GetWorkflowByID(ctx context.Context, owner, repo string // GetWorkflowByFileName gets a specific workflow by file name. // -// GitHub API docs: https://docs.github.com/en/rest/actions/workflows#get-a-workflow +// GitHub API docs: https://docs.github.com/rest/actions/workflows#get-a-workflow +// +//meta:operation GET /repos/{owner}/{repo}/actions/workflows/{workflow_id} func (s *ActionsService) GetWorkflowByFileName(ctx context.Context, owner, repo, workflowFileName string) (*Workflow, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v", owner, repo, workflowFileName) @@ -115,7 +121,9 @@ func (s *ActionsService) getWorkflow(ctx context.Context, url string) (*Workflow // GetWorkflowUsageByID gets a specific workflow usage by ID in the unit of billable milliseconds. // -// GitHub API docs: https://docs.github.com/en/rest/actions/workflows#get-workflow-usage +// GitHub API docs: https://docs.github.com/rest/actions/workflows#get-workflow-usage +// +//meta:operation GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/timing func (s *ActionsService) GetWorkflowUsageByID(ctx context.Context, owner, repo string, workflowID int64) (*WorkflowUsage, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/timing", owner, repo, workflowID) @@ -124,7 +132,9 @@ func (s *ActionsService) GetWorkflowUsageByID(ctx context.Context, owner, repo s // GetWorkflowUsageByFileName gets a specific workflow usage by file name in the unit of billable milliseconds. // -// GitHub API docs: https://docs.github.com/en/rest/actions/workflows#get-workflow-usage +// GitHub API docs: https://docs.github.com/rest/actions/workflows#get-workflow-usage +// +//meta:operation GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/timing func (s *ActionsService) GetWorkflowUsageByFileName(ctx context.Context, owner, repo, workflowFileName string) (*WorkflowUsage, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/timing", owner, repo, workflowFileName) @@ -148,7 +158,9 @@ func (s *ActionsService) getWorkflowUsage(ctx context.Context, url string) (*Wor // CreateWorkflowDispatchEventByID manually triggers a GitHub Actions workflow run. // -// GitHub API docs: https://docs.github.com/en/rest/actions/workflows#create-a-workflow-dispatch-event +// GitHub API docs: https://docs.github.com/rest/actions/workflows#create-a-workflow-dispatch-event +// +//meta:operation POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches func (s *ActionsService) CreateWorkflowDispatchEventByID(ctx context.Context, owner, repo string, workflowID int64, event CreateWorkflowDispatchEventRequest) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/dispatches", owner, repo, workflowID) @@ -157,7 +169,9 @@ func (s *ActionsService) CreateWorkflowDispatchEventByID(ctx context.Context, ow // CreateWorkflowDispatchEventByFileName manually triggers a GitHub Actions workflow run. // -// GitHub API docs: https://docs.github.com/en/rest/actions/workflows#create-a-workflow-dispatch-event +// GitHub API docs: https://docs.github.com/rest/actions/workflows#create-a-workflow-dispatch-event +// +//meta:operation POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches func (s *ActionsService) CreateWorkflowDispatchEventByFileName(ctx context.Context, owner, repo, workflowFileName string, event CreateWorkflowDispatchEventRequest) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/dispatches", owner, repo, workflowFileName) @@ -175,7 +189,9 @@ func (s *ActionsService) createWorkflowDispatchEvent(ctx context.Context, url st // EnableWorkflowByID enables a workflow and sets the state of the workflow to "active". // -// GitHub API docs: https://docs.github.com/en/rest/actions/workflows#enable-a-workflow +// GitHub API docs: https://docs.github.com/rest/actions/workflows#enable-a-workflow +// +//meta:operation PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable func (s *ActionsService) EnableWorkflowByID(ctx context.Context, owner, repo string, workflowID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/enable", owner, repo, workflowID) return s.doNewPutRequest(ctx, u) @@ -183,7 +199,9 @@ func (s *ActionsService) EnableWorkflowByID(ctx context.Context, owner, repo str // EnableWorkflowByFileName enables a workflow and sets the state of the workflow to "active". // -// GitHub API docs: https://docs.github.com/en/rest/actions/workflows#enable-a-workflow +// GitHub API docs: https://docs.github.com/rest/actions/workflows#enable-a-workflow +// +//meta:operation PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable func (s *ActionsService) EnableWorkflowByFileName(ctx context.Context, owner, repo, workflowFileName string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/enable", owner, repo, workflowFileName) return s.doNewPutRequest(ctx, u) @@ -191,7 +209,9 @@ func (s *ActionsService) EnableWorkflowByFileName(ctx context.Context, owner, re // DisableWorkflowByID disables a workflow and sets the state of the workflow to "disabled_manually". // -// GitHub API docs: https://docs.github.com/en/rest/actions/workflows#disable-a-workflow +// GitHub API docs: https://docs.github.com/rest/actions/workflows#disable-a-workflow +// +//meta:operation PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable func (s *ActionsService) DisableWorkflowByID(ctx context.Context, owner, repo string, workflowID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/disable", owner, repo, workflowID) return s.doNewPutRequest(ctx, u) @@ -199,7 +219,9 @@ func (s *ActionsService) DisableWorkflowByID(ctx context.Context, owner, repo st // DisableWorkflowByFileName disables a workflow and sets the state of the workflow to "disabled_manually". // -// GitHub API docs: https://docs.github.com/en/rest/actions/workflows#disable-a-workflow +// GitHub API docs: https://docs.github.com/rest/actions/workflows#disable-a-workflow +// +//meta:operation PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable func (s *ActionsService) DisableWorkflowByFileName(ctx context.Context, owner, repo, workflowFileName string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/workflows/%v/disable", owner, repo, workflowFileName) return s.doNewPutRequest(ctx, u) diff --git a/github/activity.go b/github/activity.go index 9cd9f9b71d7..edf8cc4397c 100644 --- a/github/activity.go +++ b/github/activity.go @@ -10,7 +10,7 @@ import "context" // ActivityService handles communication with the activity related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/en/rest/activity/ +// GitHub API docs: https://docs.github.com/rest/activity/ type ActivityService service // FeedLink represents a link to a related resource. @@ -57,6 +57,10 @@ type FeedLinks struct { // // Note: Private feeds are only returned when authenticating via Basic Auth // since current feed URIs use the older, non revocable auth tokens. +// +// GitHub API docs: https://docs.github.com/rest/activity/feeds#get-feeds +// +//meta:operation GET /feeds func (s *ActivityService) ListFeeds(ctx context.Context) (*Feeds, *Response, error) { req, err := s.client.NewRequest("GET", "feeds", nil) if err != nil { diff --git a/github/activity_events.go b/github/activity_events.go index d6f0f043b08..b12baa99e67 100644 --- a/github/activity_events.go +++ b/github/activity_events.go @@ -12,7 +12,9 @@ import ( // ListEvents drinks from the firehose of all public events across GitHub. // -// GitHub API docs: https://docs.github.com/en/rest/activity/events#list-public-events +// GitHub API docs: https://docs.github.com/rest/activity/events#list-public-events +// +//meta:operation GET /events func (s *ActivityService) ListEvents(ctx context.Context, opts *ListOptions) ([]*Event, *Response, error) { u, err := addOptions("events", opts) if err != nil { @@ -35,7 +37,9 @@ func (s *ActivityService) ListEvents(ctx context.Context, opts *ListOptions) ([] // ListRepositoryEvents lists events for a repository. // -// GitHub API docs: https://docs.github.com/en/rest/activity/events#list-repository-events +// GitHub API docs: https://docs.github.com/rest/activity/events#list-repository-events +// +//meta:operation GET /repos/{owner}/{repo}/events func (s *ActivityService) ListRepositoryEvents(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Event, *Response, error) { u := fmt.Sprintf("repos/%v/%v/events", owner, repo) u, err := addOptions(u, opts) @@ -59,7 +63,9 @@ func (s *ActivityService) ListRepositoryEvents(ctx context.Context, owner, repo // ListIssueEventsForRepository lists issue events for a repository. // -// GitHub API docs: https://docs.github.com/en/rest/issues/events#list-issue-events-for-a-repository +// GitHub API docs: https://docs.github.com/rest/issues/events#list-issue-events-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/issues/events func (s *ActivityService) ListIssueEventsForRepository(ctx context.Context, owner, repo string, opts *ListOptions) ([]*IssueEvent, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/events", owner, repo) u, err := addOptions(u, opts) @@ -83,7 +89,9 @@ func (s *ActivityService) ListIssueEventsForRepository(ctx context.Context, owne // ListEventsForRepoNetwork lists public events for a network of repositories. // -// GitHub API docs: https://docs.github.com/en/rest/activity/events#list-public-events-for-a-network-of-repositories +// GitHub API docs: https://docs.github.com/rest/activity/events#list-public-events-for-a-network-of-repositories +// +//meta:operation GET /networks/{owner}/{repo}/events func (s *ActivityService) ListEventsForRepoNetwork(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Event, *Response, error) { u := fmt.Sprintf("networks/%v/%v/events", owner, repo) u, err := addOptions(u, opts) @@ -107,7 +115,9 @@ func (s *ActivityService) ListEventsForRepoNetwork(ctx context.Context, owner, r // ListEventsForOrganization lists public events for an organization. // -// GitHub API docs: https://docs.github.com/en/rest/activity/events#list-public-organization-events +// GitHub API docs: https://docs.github.com/rest/activity/events#list-public-organization-events +// +//meta:operation GET /orgs/{org}/events func (s *ActivityService) ListEventsForOrganization(ctx context.Context, org string, opts *ListOptions) ([]*Event, *Response, error) { u := fmt.Sprintf("orgs/%v/events", org) u, err := addOptions(u, opts) @@ -132,8 +142,11 @@ func (s *ActivityService) ListEventsForOrganization(ctx context.Context, org str // ListEventsPerformedByUser lists the events performed by a user. If publicOnly is // true, only public events will be returned. // -// GitHub API docs: https://docs.github.com/en/rest/activity/events#list-events-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/rest/activity/events#list-public-events-for-a-user +// GitHub API docs: https://docs.github.com/rest/activity/events#list-events-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/activity/events#list-public-events-for-a-user +// +//meta:operation GET /users/{username}/events +//meta:operation GET /users/{username}/events/public func (s *ActivityService) ListEventsPerformedByUser(ctx context.Context, user string, publicOnly bool, opts *ListOptions) ([]*Event, *Response, error) { var u string if publicOnly { @@ -163,8 +176,11 @@ func (s *ActivityService) ListEventsPerformedByUser(ctx context.Context, user st // ListEventsReceivedByUser lists the events received by a user. If publicOnly is // true, only public events will be returned. // -// GitHub API docs: https://docs.github.com/en/rest/activity/events#list-events-received-by-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/rest/activity/events#list-public-events-received-by-a-user +// GitHub API docs: https://docs.github.com/rest/activity/events#list-events-received-by-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/activity/events#list-public-events-received-by-a-user +// +//meta:operation GET /users/{username}/received_events +//meta:operation GET /users/{username}/received_events/public func (s *ActivityService) ListEventsReceivedByUser(ctx context.Context, user string, publicOnly bool, opts *ListOptions) ([]*Event, *Response, error) { var u string if publicOnly { @@ -194,7 +210,9 @@ func (s *ActivityService) ListEventsReceivedByUser(ctx context.Context, user str // ListUserEventsForOrganization provides the user’s organization dashboard. You // must be authenticated as the user to view this. // -// GitHub API docs: https://docs.github.com/en/rest/activity/events#list-organization-events-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/activity/events#list-organization-events-for-the-authenticated-user +// +//meta:operation GET /users/{username}/events/orgs/{org} func (s *ActivityService) ListUserEventsForOrganization(ctx context.Context, org, user string, opts *ListOptions) ([]*Event, *Response, error) { u := fmt.Sprintf("users/%v/events/orgs/%v", user, org) u, err := addOptions(u, opts) diff --git a/github/activity_notifications.go b/github/activity_notifications.go index 03476c2e2c3..47f22261dd2 100644 --- a/github/activity_notifications.go +++ b/github/activity_notifications.go @@ -19,7 +19,7 @@ type Notification struct { // Reason identifies the event that triggered the notification. // - // GitHub API docs: https://docs.github.com/en/rest/activity#notification-reasons + // GitHub API docs: https://docs.github.com/rest/activity#notification-reasons Reason *string `json:"reason,omitempty"` Unread *bool `json:"unread,omitempty"` @@ -49,7 +49,9 @@ type NotificationListOptions struct { // ListNotifications lists all notifications for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/activity/notifications#list-notifications-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/activity/notifications#list-notifications-for-the-authenticated-user +// +//meta:operation GET /notifications func (s *ActivityService) ListNotifications(ctx context.Context, opts *NotificationListOptions) ([]*Notification, *Response, error) { u := "notifications" u, err := addOptions(u, opts) @@ -74,7 +76,9 @@ func (s *ActivityService) ListNotifications(ctx context.Context, opts *Notificat // ListRepositoryNotifications lists all notifications in a given repository // for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/activity/notifications#list-repository-notifications-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/activity/notifications#list-repository-notifications-for-the-authenticated-user +// +//meta:operation GET /repos/{owner}/{repo}/notifications func (s *ActivityService) ListRepositoryNotifications(ctx context.Context, owner, repo string, opts *NotificationListOptions) ([]*Notification, *Response, error) { u := fmt.Sprintf("repos/%v/%v/notifications", owner, repo) u, err := addOptions(u, opts) @@ -102,7 +106,9 @@ type markReadOptions struct { // MarkNotificationsRead marks all notifications up to lastRead as read. // -// GitHub API docs: https://docs.github.com/en/rest/activity#mark-as-read +// GitHub API docs: https://docs.github.com/rest/activity/notifications#mark-notifications-as-read +// +//meta:operation PUT /notifications func (s *ActivityService) MarkNotificationsRead(ctx context.Context, lastRead Timestamp) (*Response, error) { opts := &markReadOptions{ LastReadAt: lastRead, @@ -118,7 +124,9 @@ func (s *ActivityService) MarkNotificationsRead(ctx context.Context, lastRead Ti // MarkRepositoryNotificationsRead marks all notifications up to lastRead in // the specified repository as read. // -// GitHub API docs: https://docs.github.com/en/rest/activity/notifications#mark-repository-notifications-as-read +// GitHub API docs: https://docs.github.com/rest/activity/notifications#mark-repository-notifications-as-read +// +//meta:operation PUT /repos/{owner}/{repo}/notifications func (s *ActivityService) MarkRepositoryNotificationsRead(ctx context.Context, owner, repo string, lastRead Timestamp) (*Response, error) { opts := &markReadOptions{ LastReadAt: lastRead, @@ -134,7 +142,9 @@ func (s *ActivityService) MarkRepositoryNotificationsRead(ctx context.Context, o // GetThread gets the specified notification thread. // -// GitHub API docs: https://docs.github.com/en/rest/activity/notifications#get-a-thread +// GitHub API docs: https://docs.github.com/rest/activity/notifications#get-a-thread +// +//meta:operation GET /notifications/threads/{thread_id} func (s *ActivityService) GetThread(ctx context.Context, id string) (*Notification, *Response, error) { u := fmt.Sprintf("notifications/threads/%v", id) @@ -154,7 +164,9 @@ func (s *ActivityService) GetThread(ctx context.Context, id string) (*Notificati // MarkThreadRead marks the specified thread as read. // -// GitHub API docs: https://docs.github.com/en/rest/activity/notifications#mark-a-thread-as-read +// GitHub API docs: https://docs.github.com/rest/activity/notifications#mark-a-thread-as-read +// +//meta:operation PATCH /notifications/threads/{thread_id} func (s *ActivityService) MarkThreadRead(ctx context.Context, id string) (*Response, error) { u := fmt.Sprintf("notifications/threads/%v", id) @@ -169,7 +181,9 @@ func (s *ActivityService) MarkThreadRead(ctx context.Context, id string) (*Respo // GetThreadSubscription checks to see if the authenticated user is subscribed // to a thread. // -// GitHub API docs: https://docs.github.com/en/rest/activity/notifications#get-a-thread-subscription-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/activity/notifications#get-a-thread-subscription-for-the-authenticated-user +// +//meta:operation GET /notifications/threads/{thread_id}/subscription func (s *ActivityService) GetThreadSubscription(ctx context.Context, id string) (*Subscription, *Response, error) { u := fmt.Sprintf("notifications/threads/%v/subscription", id) @@ -190,7 +204,9 @@ func (s *ActivityService) GetThreadSubscription(ctx context.Context, id string) // SetThreadSubscription sets the subscription for the specified thread for the // authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/activity/notifications#set-a-thread-subscription +// GitHub API docs: https://docs.github.com/rest/activity/notifications#set-a-thread-subscription +// +//meta:operation PUT /notifications/threads/{thread_id}/subscription func (s *ActivityService) SetThreadSubscription(ctx context.Context, id string, subscription *Subscription) (*Subscription, *Response, error) { u := fmt.Sprintf("notifications/threads/%v/subscription", id) @@ -211,7 +227,9 @@ func (s *ActivityService) SetThreadSubscription(ctx context.Context, id string, // DeleteThreadSubscription deletes the subscription for the specified thread // for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/activity/notifications#delete-a-thread-subscription +// GitHub API docs: https://docs.github.com/rest/activity/notifications#delete-a-thread-subscription +// +//meta:operation DELETE /notifications/threads/{thread_id}/subscription func (s *ActivityService) DeleteThreadSubscription(ctx context.Context, id string) (*Response, error) { u := fmt.Sprintf("notifications/threads/%v/subscription", id) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/activity_star.go b/github/activity_star.go index 65a316f5325..cebdacf76a9 100644 --- a/github/activity_star.go +++ b/github/activity_star.go @@ -25,7 +25,9 @@ type Stargazer struct { // ListStargazers lists people who have starred the specified repo. // -// GitHub API docs: https://docs.github.com/en/rest/activity/starring#list-stargazers +// GitHub API docs: https://docs.github.com/rest/activity/starring#list-stargazers +// +//meta:operation GET /repos/{owner}/{repo}/stargazers func (s *ActivityService) ListStargazers(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Stargazer, *Response, error) { u := fmt.Sprintf("repos/%s/%s/stargazers", owner, repo) u, err := addOptions(u, opts) @@ -67,8 +69,11 @@ type ActivityListStarredOptions struct { // ListStarred lists all the repos starred by a user. Passing the empty string // will list the starred repositories for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/activity/starring#list-repositories-starred-by-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/rest/activity/starring#list-repositories-starred-by-a-user +// GitHub API docs: https://docs.github.com/rest/activity/starring#list-repositories-starred-by-a-user +// GitHub API docs: https://docs.github.com/rest/activity/starring#list-repositories-starred-by-the-authenticated-user +// +//meta:operation GET /user/starred +//meta:operation GET /users/{username}/starred func (s *ActivityService) ListStarred(ctx context.Context, user string, opts *ActivityListStarredOptions) ([]*StarredRepository, *Response, error) { var u string if user != "" { @@ -101,7 +106,9 @@ func (s *ActivityService) ListStarred(ctx context.Context, user string, opts *Ac // IsStarred checks if a repository is starred by authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/activity/starring#check-if-a-repository-is-starred-by-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/activity/starring#check-if-a-repository-is-starred-by-the-authenticated-user +// +//meta:operation GET /user/starred/{owner}/{repo} func (s *ActivityService) IsStarred(ctx context.Context, owner, repo string) (bool, *Response, error) { u := fmt.Sprintf("user/starred/%v/%v", owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -116,7 +123,9 @@ func (s *ActivityService) IsStarred(ctx context.Context, owner, repo string) (bo // Star a repository as the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/activity/starring#star-a-repository-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/activity/starring#star-a-repository-for-the-authenticated-user +// +//meta:operation PUT /user/starred/{owner}/{repo} func (s *ActivityService) Star(ctx context.Context, owner, repo string) (*Response, error) { u := fmt.Sprintf("user/starred/%v/%v", owner, repo) req, err := s.client.NewRequest("PUT", u, nil) @@ -129,7 +138,9 @@ func (s *ActivityService) Star(ctx context.Context, owner, repo string) (*Respon // Unstar a repository as the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/activity/starring#unstar-a-repository-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/activity/starring#unstar-a-repository-for-the-authenticated-user +// +//meta:operation DELETE /user/starred/{owner}/{repo} func (s *ActivityService) Unstar(ctx context.Context, owner, repo string) (*Response, error) { u := fmt.Sprintf("user/starred/%v/%v", owner, repo) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/activity_watching.go b/github/activity_watching.go index 2d6fafcc793..348590057b9 100644 --- a/github/activity_watching.go +++ b/github/activity_watching.go @@ -27,7 +27,9 @@ type Subscription struct { // ListWatchers lists watchers of a particular repo. // -// GitHub API docs: https://docs.github.com/en/rest/activity/watching#list-watchers +// GitHub API docs: https://docs.github.com/rest/activity/watching#list-watchers +// +//meta:operation GET /repos/{owner}/{repo}/subscribers func (s *ActivityService) ListWatchers(ctx context.Context, owner, repo string, opts *ListOptions) ([]*User, *Response, error) { u := fmt.Sprintf("repos/%s/%s/subscribers", owner, repo) u, err := addOptions(u, opts) @@ -52,8 +54,11 @@ func (s *ActivityService) ListWatchers(ctx context.Context, owner, repo string, // ListWatched lists the repositories the specified user is watching. Passing // the empty string will fetch watched repos for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/activity/watching#list-repositories-watched-by-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/rest/activity/watching#list-repositories-watched-by-a-user +// GitHub API docs: https://docs.github.com/rest/activity/watching#list-repositories-watched-by-a-user +// GitHub API docs: https://docs.github.com/rest/activity/watching#list-repositories-watched-by-the-authenticated-user +// +//meta:operation GET /user/subscriptions +//meta:operation GET /users/{username}/subscriptions func (s *ActivityService) ListWatched(ctx context.Context, user string, opts *ListOptions) ([]*Repository, *Response, error) { var u string if user != "" { @@ -84,7 +89,9 @@ func (s *ActivityService) ListWatched(ctx context.Context, user string, opts *Li // repository for the authenticated user. If the authenticated user is not // watching the repository, a nil Subscription is returned. // -// GitHub API docs: https://docs.github.com/en/rest/activity/watching#get-a-repository-subscription +// GitHub API docs: https://docs.github.com/rest/activity/watching#get-a-repository-subscription +// +//meta:operation GET /repos/{owner}/{repo}/subscription func (s *ActivityService) GetRepositorySubscription(ctx context.Context, owner, repo string) (*Subscription, *Response, error) { u := fmt.Sprintf("repos/%s/%s/subscription", owner, repo) @@ -111,7 +118,9 @@ func (s *ActivityService) GetRepositorySubscription(ctx context.Context, owner, // To ignore notifications made within a repository, set subscription.Ignored to true. // To stop watching a repository, use DeleteRepositorySubscription. // -// GitHub API docs: https://docs.github.com/en/rest/activity/watching#set-a-repository-subscription +// GitHub API docs: https://docs.github.com/rest/activity/watching#set-a-repository-subscription +// +//meta:operation PUT /repos/{owner}/{repo}/subscription func (s *ActivityService) SetRepositorySubscription(ctx context.Context, owner, repo string, subscription *Subscription) (*Subscription, *Response, error) { u := fmt.Sprintf("repos/%s/%s/subscription", owner, repo) @@ -135,7 +144,9 @@ func (s *ActivityService) SetRepositorySubscription(ctx context.Context, owner, // This is used to stop watching a repository. To control whether or not to // receive notifications from a repository, use SetRepositorySubscription. // -// GitHub API docs: https://docs.github.com/en/rest/activity/watching#delete-a-repository-subscription +// GitHub API docs: https://docs.github.com/rest/activity/watching#delete-a-repository-subscription +// +//meta:operation DELETE /repos/{owner}/{repo}/subscription func (s *ActivityService) DeleteRepositorySubscription(ctx context.Context, owner, repo string) (*Response, error) { u := fmt.Sprintf("repos/%s/%s/subscription", owner, repo) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/admin.go b/github/admin.go index 1b28ef64c7d..8eee9854c11 100644 --- a/github/admin.go +++ b/github/admin.go @@ -14,7 +14,7 @@ import ( // GitHub API. These API routes are normally only accessible for GitHub // Enterprise installations. // -// GitHub API docs: https://docs.github.com/en/rest/enterprise-admin +// GitHub API docs: https://docs.github.com/rest/enterprise-admin type AdminService service // TeamLDAPMapping represents the mapping between a GitHub team and an LDAP group. @@ -82,7 +82,9 @@ func (m Enterprise) String() string { // UpdateUserLDAPMapping updates the mapping between a GitHub user and an LDAP user. // -// GitHub API docs: https://docs.github.com/en/enterprise-server/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-user +// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-user +// +//meta:operation PATCH /admin/ldap/users/{username}/mapping func (s *AdminService) UpdateUserLDAPMapping(ctx context.Context, user string, mapping *UserLDAPMapping) (*UserLDAPMapping, *Response, error) { u := fmt.Sprintf("admin/ldap/users/%v/mapping", user) req, err := s.client.NewRequest("PATCH", u, mapping) @@ -101,7 +103,9 @@ func (s *AdminService) UpdateUserLDAPMapping(ctx context.Context, user string, m // UpdateTeamLDAPMapping updates the mapping between a GitHub team and an LDAP group. // -// GitHub API docs: https://docs.github.com/en/rest/enterprise/ldap/#update-ldap-mapping-for-a-team +// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-team +// +//meta:operation PATCH /admin/ldap/teams/{team_id}/mapping func (s *AdminService) UpdateTeamLDAPMapping(ctx context.Context, team int64, mapping *TeamLDAPMapping) (*TeamLDAPMapping, *Response, error) { u := fmt.Sprintf("admin/ldap/teams/%v/mapping", team) req, err := s.client.NewRequest("PATCH", u, mapping) diff --git a/github/admin_orgs.go b/github/admin_orgs.go index 448e51f631e..c734d4de12f 100644 --- a/github/admin_orgs.go +++ b/github/admin_orgs.go @@ -22,7 +22,9 @@ type createOrgRequest struct { // Note that only a subset of the org fields are used and org must // not be nil. // -// GitHub Enterprise API docs: https://developer.github.com/enterprise/v3/enterprise-admin/orgs/#create-an-organization +// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/orgs#create-an-organization +// +//meta:operation POST /admin/organizations func (s *AdminService) CreateOrg(ctx context.Context, org *Organization, admin string) (*Organization, *Response, error) { u := "admin/organizations" @@ -59,14 +61,18 @@ type RenameOrgResponse struct { // RenameOrg renames an organization in GitHub Enterprise. // -// GitHub Enterprise API docs: https://developer.github.com/enterprise/v3/enterprise-admin/orgs/#rename-an-organization +// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/orgs#update-an-organization-name +// +//meta:operation PATCH /admin/organizations/{org} func (s *AdminService) RenameOrg(ctx context.Context, org *Organization, newName string) (*RenameOrgResponse, *Response, error) { return s.RenameOrgByName(ctx, *org.Login, newName) } // RenameOrgByName renames an organization in GitHub Enterprise using its current name. // -// GitHub Enterprise API docs: https://developer.github.com/enterprise/v3/enterprise-admin/orgs/#rename-an-organization +// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/orgs#update-an-organization-name +// +//meta:operation PATCH /admin/organizations/{org} func (s *AdminService) RenameOrgByName(ctx context.Context, org, newName string) (*RenameOrgResponse, *Response, error) { u := fmt.Sprintf("admin/organizations/%v", org) diff --git a/github/admin_stats.go b/github/admin_stats.go index 17e568f62b2..aa23f5d1995 100644 --- a/github/admin_stats.go +++ b/github/admin_stats.go @@ -152,7 +152,9 @@ func (s RepoStats) String() string { // Please note that this is only available to site administrators, // otherwise it will error with a 404 not found (instead of 401 or 403). // -// GitHub API docs: https://docs.github.com/en/rest/enterprise-admin/admin_stats/ +// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/admin-stats#get-all-statistics +// +//meta:operation GET /enterprise/stats/all func (s *AdminService) GetAdminStats(ctx context.Context) (*AdminStats, *Response, error) { u := "enterprise/stats/all" req, err := s.client.NewRequest("GET", u, nil) diff --git a/github/admin_users.go b/github/admin_users.go index d756a77e20d..3916a470b04 100644 --- a/github/admin_users.go +++ b/github/admin_users.go @@ -19,7 +19,9 @@ type createUserRequest struct { // CreateUser creates a new user in GitHub Enterprise. // -// GitHub Enterprise API docs: https://developer.github.com/enterprise/v3/enterprise-admin/users/#create-a-new-user +// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#create-a-user +// +//meta:operation POST /admin/users func (s *AdminService) CreateUser(ctx context.Context, login, email string) (*User, *Response, error) { u := "admin/users" @@ -44,7 +46,9 @@ func (s *AdminService) CreateUser(ctx context.Context, login, email string) (*Us // DeleteUser deletes a user in GitHub Enterprise. // -// GitHub Enterprise API docs: https://developer.github.com/enterprise/v3/enterprise-admin/users/#delete-a-user +// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#delete-a-user +// +//meta:operation DELETE /admin/users/{username} func (s *AdminService) DeleteUser(ctx context.Context, username string) (*Response, error) { u := "admin/users/" + username @@ -95,7 +99,9 @@ type UserAuthorization struct { // CreateUserImpersonation creates an impersonation OAuth token. // -// GitHub Enterprise API docs: https://developer.github.com/enterprise/v3/enterprise-admin/users/#create-an-impersonation-oauth-token +// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#create-an-impersonation-oauth-token +// +//meta:operation POST /admin/users/{username}/authorizations func (s *AdminService) CreateUserImpersonation(ctx context.Context, username string, opts *ImpersonateUserOptions) (*UserAuthorization, *Response, error) { u := fmt.Sprintf("admin/users/%s/authorizations", username) @@ -115,7 +121,9 @@ func (s *AdminService) CreateUserImpersonation(ctx context.Context, username str // DeleteUserImpersonation deletes an impersonation OAuth token. // -// GitHub Enterprise API docs: https://developer.github.com/enterprise/v3/enterprise-admin/users/#delete-an-impersonation-oauth-token +// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#delete-an-impersonation-oauth-token +// +//meta:operation DELETE /admin/users/{username}/authorizations func (s *AdminService) DeleteUserImpersonation(ctx context.Context, username string) (*Response, error) { u := fmt.Sprintf("admin/users/%s/authorizations", username) diff --git a/github/apps.go b/github/apps.go index 8965e66815c..f0392f2d706 100644 --- a/github/apps.go +++ b/github/apps.go @@ -13,7 +13,7 @@ import ( // AppsService provides access to the installation related functions // in the GitHub API. // -// GitHub API docs: https://docs.github.com/en/rest/apps/ +// GitHub API docs: https://docs.github.com/rest/apps/ type AppsService service // App represents a GitHub App. @@ -60,8 +60,8 @@ type InstallationTokenOptions struct { // // Permission names taken from: // -// https://docs.github.com/en/enterprise-server@3.0/rest/apps#create-an-installation-access-token-for-an-app -// https://docs.github.com/en/rest/apps#create-an-installation-access-token-for-an-app +// https://docs.github.com/enterprise-server@3.0/rest/apps#create-an-installation-access-token-for-an-app +// https://docs.github.com/rest/apps#create-an-installation-access-token-for-an-app type InstallationPermissions struct { Actions *string `json:"actions,omitempty"` Administration *string `json:"administration,omitempty"` @@ -160,8 +160,11 @@ func (i Installation) String() string { // You can find this on the settings page for your GitHub App // (e.g., https://github.com/settings/apps/:app_slug). // -// GitHub API docs: https://docs.github.com/en/rest/apps/apps#get-the-authenticated-app -// GitHub API docs: https://docs.github.com/en/rest/apps/apps#get-an-app +// GitHub API docs: https://docs.github.com/rest/apps/apps#get-an-app +// GitHub API docs: https://docs.github.com/rest/apps/apps#get-the-authenticated-app +// +//meta:operation GET /app +//meta:operation GET /apps/{app_slug} func (s *AppsService) Get(ctx context.Context, appSlug string) (*App, *Response, error) { var u string if appSlug != "" { @@ -186,7 +189,9 @@ func (s *AppsService) Get(ctx context.Context, appSlug string) (*App, *Response, // ListInstallationRequests lists the pending installation requests that the current GitHub App has. // -// GitHub API docs: https://docs.github.com/en/rest/apps/apps#list-installation-requests-for-the-authenticated-app +// GitHub API docs: https://docs.github.com/rest/apps/apps#list-installation-requests-for-the-authenticated-app +// +//meta:operation GET /app/installation-requests func (s *AppsService) ListInstallationRequests(ctx context.Context, opts *ListOptions) ([]*InstallationRequest, *Response, error) { u, err := addOptions("app/installation-requests", opts) if err != nil { @@ -209,7 +214,9 @@ func (s *AppsService) ListInstallationRequests(ctx context.Context, opts *ListOp // ListInstallations lists the installations that the current GitHub App has. // -// GitHub API docs: https://docs.github.com/en/rest/apps/apps#list-installations-for-the-authenticated-app +// GitHub API docs: https://docs.github.com/rest/apps/apps#list-installations-for-the-authenticated-app +// +//meta:operation GET /app/installations func (s *AppsService) ListInstallations(ctx context.Context, opts *ListOptions) ([]*Installation, *Response, error) { u, err := addOptions("app/installations", opts) if err != nil { @@ -232,14 +239,18 @@ func (s *AppsService) ListInstallations(ctx context.Context, opts *ListOptions) // GetInstallation returns the specified installation. // -// GitHub API docs: https://docs.github.com/en/rest/apps/apps#get-an-installation-for-the-authenticated-app +// GitHub API docs: https://docs.github.com/rest/apps/apps#get-an-installation-for-the-authenticated-app +// +//meta:operation GET /app/installations/{installation_id} func (s *AppsService) GetInstallation(ctx context.Context, id int64) (*Installation, *Response, error) { return s.getInstallation(ctx, fmt.Sprintf("app/installations/%v", id)) } // ListUserInstallations lists installations that are accessible to the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/apps/installations#list-app-installations-accessible-to-the-user-access-token +// GitHub API docs: https://docs.github.com/rest/apps/installations#list-app-installations-accessible-to-the-user-access-token +// +//meta:operation GET /user/installations func (s *AppsService) ListUserInstallations(ctx context.Context, opts *ListOptions) ([]*Installation, *Response, error) { u, err := addOptions("user/installations", opts) if err != nil { @@ -264,7 +275,9 @@ func (s *AppsService) ListUserInstallations(ctx context.Context, opts *ListOptio // SuspendInstallation suspends the specified installation. // -// GitHub API docs: https://docs.github.com/en/rest/apps/apps#suspend-an-app-installation +// GitHub API docs: https://docs.github.com/rest/apps/apps#suspend-an-app-installation +// +//meta:operation PUT /app/installations/{installation_id}/suspended func (s *AppsService) SuspendInstallation(ctx context.Context, id int64) (*Response, error) { u := fmt.Sprintf("app/installations/%v/suspended", id) @@ -278,7 +291,9 @@ func (s *AppsService) SuspendInstallation(ctx context.Context, id int64) (*Respo // UnsuspendInstallation unsuspends the specified installation. // -// GitHub API docs: https://docs.github.com/en/rest/apps/apps#unsuspend-an-app-installation +// GitHub API docs: https://docs.github.com/rest/apps/apps#unsuspend-an-app-installation +// +//meta:operation DELETE /app/installations/{installation_id}/suspended func (s *AppsService) UnsuspendInstallation(ctx context.Context, id int64) (*Response, error) { u := fmt.Sprintf("app/installations/%v/suspended", id) @@ -292,7 +307,9 @@ func (s *AppsService) UnsuspendInstallation(ctx context.Context, id int64) (*Res // DeleteInstallation deletes the specified installation. // -// GitHub API docs: https://docs.github.com/en/rest/apps/apps#delete-an-installation-for-the-authenticated-app +// GitHub API docs: https://docs.github.com/rest/apps/apps#delete-an-installation-for-the-authenticated-app +// +//meta:operation DELETE /app/installations/{installation_id} func (s *AppsService) DeleteInstallation(ctx context.Context, id int64) (*Response, error) { u := fmt.Sprintf("app/installations/%v", id) @@ -306,7 +323,9 @@ func (s *AppsService) DeleteInstallation(ctx context.Context, id int64) (*Respon // CreateInstallationToken creates a new installation token. // -// GitHub API docs: https://docs.github.com/en/rest/apps/apps#create-an-installation-access-token-for-an-app +// GitHub API docs: https://docs.github.com/rest/apps/apps#create-an-installation-access-token-for-an-app +// +//meta:operation POST /app/installations/{installation_id}/access_tokens func (s *AppsService) CreateInstallationToken(ctx context.Context, id int64, opts *InstallationTokenOptions) (*InstallationToken, *Response, error) { u := fmt.Sprintf("app/installations/%v/access_tokens", id) @@ -326,7 +345,9 @@ func (s *AppsService) CreateInstallationToken(ctx context.Context, id int64, opt // CreateAttachment creates a new attachment on user comment containing a url. // -// TODO: Find GitHub API docs. +// GitHub API docs: https://docs.github.com/enterprise-server@3.3/rest/reference/apps#create-a-content-attachment +// +//meta:operation POST /repos/{owner}/{repo}/content_references/{content_reference_id}/attachments func (s *AppsService) CreateAttachment(ctx context.Context, contentReferenceID int64, title, body string) (*Attachment, *Response, error) { u := fmt.Sprintf("content_references/%v/attachments", contentReferenceID) payload := &Attachment{Title: String(title), Body: String(body)} @@ -349,28 +370,36 @@ func (s *AppsService) CreateAttachment(ctx context.Context, contentReferenceID i // FindOrganizationInstallation finds the organization's installation information. // -// GitHub API docs: https://docs.github.com/en/rest/apps/apps#get-an-organization-installation-for-the-authenticated-app +// GitHub API docs: https://docs.github.com/rest/apps/apps#get-an-organization-installation-for-the-authenticated-app +// +//meta:operation GET /orgs/{org}/installation func (s *AppsService) FindOrganizationInstallation(ctx context.Context, org string) (*Installation, *Response, error) { return s.getInstallation(ctx, fmt.Sprintf("orgs/%v/installation", org)) } // FindRepositoryInstallation finds the repository's installation information. // -// GitHub API docs: https://docs.github.com/en/rest/apps/apps#get-a-repository-installation-for-the-authenticated-app +// GitHub API docs: https://docs.github.com/rest/apps/apps#get-a-repository-installation-for-the-authenticated-app +// +//meta:operation GET /repos/{owner}/{repo}/installation func (s *AppsService) FindRepositoryInstallation(ctx context.Context, owner, repo string) (*Installation, *Response, error) { return s.getInstallation(ctx, fmt.Sprintf("repos/%v/%v/installation", owner, repo)) } // FindRepositoryInstallationByID finds the repository's installation information. // -// Note: FindRepositoryInstallationByID uses the undocumented GitHub API endpoint /repositories/:id/installation. +// Note: FindRepositoryInstallationByID uses the undocumented GitHub API endpoint "GET /repositories/{repository_id}/installation". +// +//meta:operation GET /repositories/{repository_id}/installation func (s *AppsService) FindRepositoryInstallationByID(ctx context.Context, id int64) (*Installation, *Response, error) { return s.getInstallation(ctx, fmt.Sprintf("repositories/%d/installation", id)) } // FindUserInstallation finds the user's installation information. // -// GitHub API docs: https://docs.github.com/en/rest/apps/apps#get-a-user-installation-for-the-authenticated-app +// GitHub API docs: https://docs.github.com/rest/apps/apps#get-a-user-installation-for-the-authenticated-app +// +//meta:operation GET /users/{username}/installation func (s *AppsService) FindUserInstallation(ctx context.Context, user string) (*Installation, *Response, error) { return s.getInstallation(ctx, fmt.Sprintf("users/%v/installation", user)) } diff --git a/github/apps_hooks.go b/github/apps_hooks.go index e3bd2afc032..6046827ef06 100644 --- a/github/apps_hooks.go +++ b/github/apps_hooks.go @@ -12,7 +12,9 @@ import ( // GetHookConfig returns the webhook configuration for a GitHub App. // The underlying transport must be authenticated as an app. // -// GitHub API docs: https://docs.github.com/en/rest/apps#get-a-webhook-configuration-for-an-app +// GitHub API docs: https://docs.github.com/rest/apps/webhooks#get-a-webhook-configuration-for-an-app +// +//meta:operation GET /app/hook/config func (s *AppsService) GetHookConfig(ctx context.Context) (*HookConfig, *Response, error) { req, err := s.client.NewRequest("GET", "app/hook/config", nil) if err != nil { @@ -31,7 +33,9 @@ func (s *AppsService) GetHookConfig(ctx context.Context) (*HookConfig, *Response // UpdateHookConfig updates the webhook configuration for a GitHub App. // The underlying transport must be authenticated as an app. // -// GitHub API docs: https://docs.github.com/en/rest/apps#update-a-webhook-configuration-for-an-app +// GitHub API docs: https://docs.github.com/rest/apps/webhooks#update-a-webhook-configuration-for-an-app +// +//meta:operation PATCH /app/hook/config func (s *AppsService) UpdateHookConfig(ctx context.Context, config *HookConfig) (*HookConfig, *Response, error) { req, err := s.client.NewRequest("PATCH", "app/hook/config", config) if err != nil { diff --git a/github/apps_hooks_deliveries.go b/github/apps_hooks_deliveries.go index 33102f36d2b..59800a0ae43 100644 --- a/github/apps_hooks_deliveries.go +++ b/github/apps_hooks_deliveries.go @@ -12,7 +12,9 @@ import ( // ListHookDeliveries lists deliveries of an App webhook. // -// GitHub API docs: https://docs.github.com/en/rest/apps/webhooks#list-deliveries-for-an-app-webhook +// GitHub API docs: https://docs.github.com/rest/apps/webhooks#list-deliveries-for-an-app-webhook +// +//meta:operation GET /app/hook/deliveries func (s *AppsService) ListHookDeliveries(ctx context.Context, opts *ListCursorOptions) ([]*HookDelivery, *Response, error) { u, err := addOptions("app/hook/deliveries", opts) if err != nil { @@ -35,7 +37,9 @@ func (s *AppsService) ListHookDeliveries(ctx context.Context, opts *ListCursorOp // GetHookDelivery returns the App webhook delivery with the specified ID. // -// GitHub API docs: https://docs.github.com/en/rest/apps/webhooks#get-a-delivery-for-an-app-webhook +// GitHub API docs: https://docs.github.com/rest/apps/webhooks#get-a-delivery-for-an-app-webhook +// +//meta:operation GET /app/hook/deliveries/{delivery_id} func (s *AppsService) GetHookDelivery(ctx context.Context, deliveryID int64) (*HookDelivery, *Response, error) { u := fmt.Sprintf("app/hook/deliveries/%v", deliveryID) req, err := s.client.NewRequest("GET", u, nil) @@ -54,7 +58,9 @@ func (s *AppsService) GetHookDelivery(ctx context.Context, deliveryID int64) (*H // RedeliverHookDelivery redelivers a delivery for an App webhook. // -// GitHub API docs: https://docs.github.com/en/rest/apps/webhooks#redeliver-a-delivery-for-an-app-webhook +// GitHub API docs: https://docs.github.com/rest/apps/webhooks#redeliver-a-delivery-for-an-app-webhook +// +//meta:operation POST /app/hook/deliveries/{delivery_id}/attempts func (s *AppsService) RedeliverHookDelivery(ctx context.Context, deliveryID int64) (*HookDelivery, *Response, error) { u := fmt.Sprintf("app/hook/deliveries/%v/attempts", deliveryID) req, err := s.client.NewRequest("POST", u, nil) diff --git a/github/apps_installation.go b/github/apps_installation.go index b619080713f..d430511d074 100644 --- a/github/apps_installation.go +++ b/github/apps_installation.go @@ -19,7 +19,9 @@ type ListRepositories struct { // ListRepos lists the repositories that are accessible to the authenticated installation. // -// GitHub API docs: https://docs.github.com/en/rest/apps/installations#list-repositories-accessible-to-the-app-installation +// GitHub API docs: https://docs.github.com/rest/apps/installations#list-repositories-accessible-to-the-app-installation +// +//meta:operation GET /installation/repositories func (s *AppsService) ListRepos(ctx context.Context, opts *ListOptions) (*ListRepositories, *Response, error) { u, err := addOptions("installation/repositories", opts) if err != nil { @@ -52,7 +54,9 @@ func (s *AppsService) ListRepos(ctx context.Context, opts *ListOptions) (*ListRe // ListUserRepos lists repositories that are accessible // to the authenticated user for an installation. // -// GitHub API docs: https://docs.github.com/en/rest/apps/installations#list-repositories-accessible-to-the-user-access-token +// GitHub API docs: https://docs.github.com/rest/apps/installations#list-repositories-accessible-to-the-user-access-token +// +//meta:operation GET /user/installations/{installation_id}/repositories func (s *AppsService) ListUserRepos(ctx context.Context, id int64, opts *ListOptions) (*ListRepositories, *Response, error) { u := fmt.Sprintf("user/installations/%v/repositories", id) u, err := addOptions(u, opts) @@ -84,7 +88,9 @@ func (s *AppsService) ListUserRepos(ctx context.Context, id int64, opts *ListOpt // AddRepository adds a single repository to an installation. // -// GitHub API docs: https://docs.github.com/en/rest/apps/installations#add-a-repository-to-an-app-installation +// GitHub API docs: https://docs.github.com/rest/apps/installations#add-a-repository-to-an-app-installation +// +//meta:operation PUT /user/installations/{installation_id}/repositories/{repository_id} func (s *AppsService) AddRepository(ctx context.Context, instID, repoID int64) (*Repository, *Response, error) { u := fmt.Sprintf("user/installations/%v/repositories/%v", instID, repoID) req, err := s.client.NewRequest("PUT", u, nil) @@ -103,7 +109,9 @@ func (s *AppsService) AddRepository(ctx context.Context, instID, repoID int64) ( // RemoveRepository removes a single repository from an installation. // -// GitHub API docs: https://docs.github.com/en/rest/apps/installations#remove-a-repository-from-an-app-installation +// GitHub API docs: https://docs.github.com/rest/apps/installations#remove-a-repository-from-an-app-installation +// +//meta:operation DELETE /user/installations/{installation_id}/repositories/{repository_id} func (s *AppsService) RemoveRepository(ctx context.Context, instID, repoID int64) (*Response, error) { u := fmt.Sprintf("user/installations/%v/repositories/%v", instID, repoID) req, err := s.client.NewRequest("DELETE", u, nil) @@ -116,7 +124,9 @@ func (s *AppsService) RemoveRepository(ctx context.Context, instID, repoID int64 // RevokeInstallationToken revokes an installation token. // -// GitHub API docs: https://docs.github.com/en/rest/apps/installations#revoke-an-installation-access-token +// GitHub API docs: https://docs.github.com/rest/apps/installations#revoke-an-installation-access-token +// +//meta:operation DELETE /installation/token func (s *AppsService) RevokeInstallationToken(ctx context.Context) (*Response, error) { u := "installation/token" req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/apps_manifest.go b/github/apps_manifest.go index fa4c85379ca..5b6ff9af414 100644 --- a/github/apps_manifest.go +++ b/github/apps_manifest.go @@ -31,7 +31,9 @@ type AppConfig struct { // CompleteAppManifest completes the App manifest handshake flow for the given // code. // -// GitHub API docs: https://docs.github.com/en/rest/apps/apps#create-a-github-app-from-a-manifest +// GitHub API docs: https://docs.github.com/rest/apps/apps#create-a-github-app-from-a-manifest +// +//meta:operation POST /app-manifests/{code}/conversions func (s *AppsService) CompleteAppManifest(ctx context.Context, code string) (*AppConfig, *Response, error) { u := fmt.Sprintf("app-manifests/%s/conversions", code) req, err := s.client.NewRequest("POST", u, nil) diff --git a/github/apps_marketplace.go b/github/apps_marketplace.go index 32889abd240..976775a79a0 100644 --- a/github/apps_marketplace.go +++ b/github/apps_marketplace.go @@ -13,7 +13,7 @@ import ( // MarketplaceService handles communication with the marketplace related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/en/rest/apps#marketplace +// GitHub API docs: https://docs.github.com/rest/apps#marketplace type MarketplaceService struct { client *Client // Stubbed controls whether endpoints that return stubbed data are used @@ -21,7 +21,7 @@ type MarketplaceService struct { // for testing your GitHub Apps. Stubbed data is hard-coded and will not // change based on actual subscriptions. // - // GitHub API docs: https://docs.github.com/en/rest/apps#testing-with-stubbed-endpoints + // GitHub API docs: https://docs.github.com/rest/apps#testing-with-stubbed-endpoints Stubbed bool } @@ -89,7 +89,11 @@ type MarketplacePurchaseAccount struct { // ListPlans lists all plans for your Marketplace listing. // -// GitHub API docs: https://docs.github.com/en/rest/apps#list-plans +// GitHub API docs: https://docs.github.com/rest/apps/marketplace#list-plans +// GitHub API docs: https://docs.github.com/rest/apps/marketplace#list-plans-stubbed +// +//meta:operation GET /marketplace_listing/plans +//meta:operation GET /marketplace_listing/stubbed/plans func (s *MarketplaceService) ListPlans(ctx context.Context, opts *ListOptions) ([]*MarketplacePlan, *Response, error) { uri := s.marketplaceURI("plans") u, err := addOptions(uri, opts) @@ -113,7 +117,11 @@ func (s *MarketplaceService) ListPlans(ctx context.Context, opts *ListOptions) ( // ListPlanAccountsForPlan lists all GitHub accounts (user or organization) on a specific plan. // -// GitHub API docs: https://docs.github.com/en/rest/apps#list-accounts-for-a-plan +// GitHub API docs: https://docs.github.com/rest/apps/marketplace#list-accounts-for-a-plan +// GitHub API docs: https://docs.github.com/rest/apps/marketplace#list-accounts-for-a-plan-stubbed +// +//meta:operation GET /marketplace_listing/plans/{plan_id}/accounts +//meta:operation GET /marketplace_listing/stubbed/plans/{plan_id}/accounts func (s *MarketplaceService) ListPlanAccountsForPlan(ctx context.Context, planID int64, opts *ListOptions) ([]*MarketplacePlanAccount, *Response, error) { uri := s.marketplaceURI(fmt.Sprintf("plans/%v/accounts", planID)) u, err := addOptions(uri, opts) @@ -137,7 +145,11 @@ func (s *MarketplaceService) ListPlanAccountsForPlan(ctx context.Context, planID // GetPlanAccountForAccount get GitHub account (user or organization) associated with an account. // -// GitHub API docs: https://docs.github.com/en/rest/apps#get-a-subscription-plan-for-an-account +// GitHub API docs: https://docs.github.com/rest/apps/marketplace#get-a-subscription-plan-for-an-account +// GitHub API docs: https://docs.github.com/rest/apps/marketplace#get-a-subscription-plan-for-an-account-stubbed +// +//meta:operation GET /marketplace_listing/accounts/{account_id} +//meta:operation GET /marketplace_listing/stubbed/accounts/{account_id} func (s *MarketplaceService) GetPlanAccountForAccount(ctx context.Context, accountID int64) (*MarketplacePlanAccount, *Response, error) { uri := s.marketplaceURI(fmt.Sprintf("accounts/%v", accountID)) @@ -157,8 +169,11 @@ func (s *MarketplaceService) GetPlanAccountForAccount(ctx context.Context, accou // ListMarketplacePurchasesForUser lists all GitHub marketplace purchases made by a user. // -// GitHub API docs: https://docs.github.com/en/rest/apps/marketplace#list-subscriptions-for-the-authenticated-user-stubbed -// GitHub API docs: https://docs.github.com/en/rest/apps/marketplace#list-subscriptions-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/apps/marketplace#list-subscriptions-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/apps/marketplace#list-subscriptions-for-the-authenticated-user-stubbed +// +//meta:operation GET /user/marketplace_purchases +//meta:operation GET /user/marketplace_purchases/stubbed func (s *MarketplaceService) ListMarketplacePurchasesForUser(ctx context.Context, opts *ListOptions) ([]*MarketplacePurchase, *Response, error) { uri := "user/marketplace_purchases" if s.Stubbed { diff --git a/github/authorizations.go b/github/authorizations.go index ea0897e3627..7adc5323678 100644 --- a/github/authorizations.go +++ b/github/authorizations.go @@ -12,7 +12,7 @@ import ( // Scope models a GitHub authorization scope. // -// GitHub API docs: https://docs.github.com/en/rest/oauth/#scopes +// GitHub API docs: https://docs.github.com/rest/oauth/#scopes type Scope string // This is the set of scopes for GitHub API V3 @@ -50,7 +50,7 @@ const ( // This service requires HTTP Basic Authentication; it cannot be accessed using // an OAuth token. // -// GitHub API docs: https://docs.github.com/en/rest/oauth-authorizations +// GitHub API docs: https://docs.github.com/rest/oauth-authorizations type AuthorizationsService service // Authorization represents an individual GitHub authorization. @@ -121,7 +121,7 @@ func (a AuthorizationRequest) String() string { // fields. That is, you may provide only one of "Scopes", or "AddScopes", or // "RemoveScopes". // -// GitHub API docs: https://docs.github.com/en/rest/oauth-authorizations#update-an-existing-authorization +// GitHub API docs: https://docs.github.com/rest/oauth-authorizations#update-an-existing-authorization type AuthorizationUpdateRequest struct { Scopes []string `json:"scopes,omitempty"` AddScopes []string `json:"add_scopes,omitempty"` @@ -143,7 +143,9 @@ func (a AuthorizationUpdateRequest) String() string { // // The returned Authorization.User field will be populated. // -// GitHub API docs: https://docs.github.com/en/rest/apps/oauth-applications#check-a-token +// GitHub API docs: https://docs.github.com/rest/apps/oauth-applications#check-a-token +// +//meta:operation POST /applications/{client_id}/token func (s *AuthorizationsService) Check(ctx context.Context, clientID, accessToken string) (*Authorization, *Response, error) { u := fmt.Sprintf("applications/%v/token", clientID) @@ -176,7 +178,9 @@ func (s *AuthorizationsService) Check(ctx context.Context, clientID, accessToken // // The returned Authorization.User field will be populated. // -// GitHub API docs: https://docs.github.com/en/rest/apps/oauth-applications#reset-a-token +// GitHub API docs: https://docs.github.com/rest/apps/oauth-applications#reset-a-token +// +//meta:operation PATCH /applications/{client_id}/token func (s *AuthorizationsService) Reset(ctx context.Context, clientID, accessToken string) (*Authorization, *Response, error) { u := fmt.Sprintf("applications/%v/token", clientID) @@ -205,7 +209,9 @@ func (s *AuthorizationsService) Reset(ctx context.Context, clientID, accessToken // username is the OAuth application clientID, and the password is its // clientSecret. Invalid tokens will return a 404 Not Found. // -// GitHub API docs: https://docs.github.com/en/rest/apps/oauth-applications#delete-an-app-token +// GitHub API docs: https://docs.github.com/rest/apps/oauth-applications#delete-an-app-token +// +//meta:operation DELETE /applications/{client_id}/token func (s *AuthorizationsService) Revoke(ctx context.Context, clientID, accessToken string) (*Response, error) { u := fmt.Sprintf("applications/%v/token", clientID) @@ -226,7 +232,9 @@ func (s *AuthorizationsService) Revoke(ctx context.Context, clientID, accessToke // grant will also delete all OAuth tokens associated with the application for // the user. // -// GitHub API docs: https://docs.github.com/en/rest/apps/oauth-applications#delete-an-app-authorization +// GitHub API docs: https://docs.github.com/rest/apps/oauth-applications#delete-an-app-authorization +// +//meta:operation DELETE /applications/{client_id}/grant func (s *AuthorizationsService) DeleteGrant(ctx context.Context, clientID, accessToken string) (*Response, error) { u := fmt.Sprintf("applications/%v/grant", clientID) @@ -249,7 +257,9 @@ func (s *AuthorizationsService) DeleteGrant(ctx context.Context, clientID, acces // you can e.g. create or delete a user's public SSH key. NOTE: creating a // new token automatically revokes an existing one. // -// GitHub API docs: https://developer.github.com/enterprise/v3/enterprise-admin/users/#create-an-impersonation-oauth-token +// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#create-an-impersonation-oauth-token +// +//meta:operation POST /admin/users/{username}/authorizations func (s *AuthorizationsService) CreateImpersonation(ctx context.Context, username string, authReq *AuthorizationRequest) (*Authorization, *Response, error) { u := fmt.Sprintf("admin/users/%v/authorizations", username) req, err := s.client.NewRequest("POST", u, authReq) @@ -269,7 +279,9 @@ func (s *AuthorizationsService) CreateImpersonation(ctx context.Context, usernam // // NOTE: there can be only one at a time. // -// GitHub API docs: https://developer.github.com/enterprise/v3/enterprise-admin/users/#delete-an-impersonation-oauth-token +// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#delete-an-impersonation-oauth-token +// +//meta:operation DELETE /admin/users/{username}/authorizations func (s *AuthorizationsService) DeleteImpersonation(ctx context.Context, username string) (*Response, error) { u := fmt.Sprintf("admin/users/%v/authorizations", username) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/billing.go b/github/billing.go index 7a76bf86fda..6d7579b884d 100644 --- a/github/billing.go +++ b/github/billing.go @@ -13,7 +13,7 @@ import ( // BillingService provides access to the billing related functions // in the GitHub API. // -// GitHub API docs: https://docs.github.com/en/rest/billing +// GitHub API docs: https://docs.github.com/rest/billing type BillingService service // ActionBilling represents a GitHub Action billing. @@ -62,7 +62,9 @@ type AdvancedSecurityCommittersBreakdown struct { // GetActionsBillingOrg returns the summary of the free and paid GitHub Actions minutes used for an Org. // -// GitHub API docs: https://docs.github.com/en/rest/billing#get-github-actions-billing-for-an-organization +// GitHub API docs: https://docs.github.com/rest/billing/billing#get-github-actions-billing-for-an-organization +// +//meta:operation GET /orgs/{org}/settings/billing/actions func (s *BillingService) GetActionsBillingOrg(ctx context.Context, org string) (*ActionBilling, *Response, error) { u := fmt.Sprintf("orgs/%v/settings/billing/actions", org) req, err := s.client.NewRequest("GET", u, nil) @@ -81,7 +83,9 @@ func (s *BillingService) GetActionsBillingOrg(ctx context.Context, org string) ( // GetPackagesBillingOrg returns the free and paid storage used for GitHub Packages in gigabytes for an Org. // -// GitHub API docs: https://docs.github.com/en/rest/billing#get-github-packages-billing-for-an-organization +// GitHub API docs: https://docs.github.com/rest/billing/billing#get-github-packages-billing-for-an-organization +// +//meta:operation GET /orgs/{org}/settings/billing/packages func (s *BillingService) GetPackagesBillingOrg(ctx context.Context, org string) (*PackageBilling, *Response, error) { u := fmt.Sprintf("orgs/%v/settings/billing/packages", org) req, err := s.client.NewRequest("GET", u, nil) @@ -101,7 +105,9 @@ func (s *BillingService) GetPackagesBillingOrg(ctx context.Context, org string) // GetStorageBillingOrg returns the estimated paid and estimated total storage used for GitHub Actions // and GitHub Packages in gigabytes for an Org. // -// GitHub API docs: https://docs.github.com/en/rest/billing#get-shared-storage-billing-for-an-organization +// GitHub API docs: https://docs.github.com/rest/billing/billing#get-shared-storage-billing-for-an-organization +// +//meta:operation GET /orgs/{org}/settings/billing/shared-storage func (s *BillingService) GetStorageBillingOrg(ctx context.Context, org string) (*StorageBilling, *Response, error) { u := fmt.Sprintf("orgs/%v/settings/billing/shared-storage", org) req, err := s.client.NewRequest("GET", u, nil) @@ -120,7 +126,9 @@ func (s *BillingService) GetStorageBillingOrg(ctx context.Context, org string) ( // GetAdvancedSecurityActiveCommittersOrg returns the GitHub Advanced Security active committers for an organization per repository. // -// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/billing?apiVersion=2022-11-28#get-github-advanced-security-active-committers-for-an-organization +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/billing/billing#get-github-advanced-security-active-committers-for-an-organization +// +//meta:operation GET /orgs/{org}/settings/billing/advanced-security func (s *BillingService) GetAdvancedSecurityActiveCommittersOrg(ctx context.Context, org string, opts *ListOptions) (*ActiveCommitters, *Response, error) { u := fmt.Sprintf("orgs/%v/settings/billing/advanced-security", org) u, err := addOptions(u, opts) @@ -144,7 +152,9 @@ func (s *BillingService) GetAdvancedSecurityActiveCommittersOrg(ctx context.Cont // GetActionsBillingUser returns the summary of the free and paid GitHub Actions minutes used for a user. // -// GitHub API docs: https://docs.github.com/en/rest/billing#get-github-actions-billing-for-a-user +// GitHub API docs: https://docs.github.com/rest/billing/billing#get-github-actions-billing-for-a-user +// +//meta:operation GET /users/{username}/settings/billing/actions func (s *BillingService) GetActionsBillingUser(ctx context.Context, user string) (*ActionBilling, *Response, error) { u := fmt.Sprintf("users/%v/settings/billing/actions", user) req, err := s.client.NewRequest("GET", u, nil) @@ -163,7 +173,9 @@ func (s *BillingService) GetActionsBillingUser(ctx context.Context, user string) // GetPackagesBillingUser returns the free and paid storage used for GitHub Packages in gigabytes for a user. // -// GitHub API docs: https://docs.github.com/en/rest/billing#get-github-packages-billing-for-a-user +// GitHub API docs: https://docs.github.com/rest/billing/billing#get-github-packages-billing-for-a-user +// +//meta:operation GET /users/{username}/settings/billing/packages func (s *BillingService) GetPackagesBillingUser(ctx context.Context, user string) (*PackageBilling, *Response, error) { u := fmt.Sprintf("users/%v/settings/billing/packages", user) req, err := s.client.NewRequest("GET", u, nil) @@ -183,7 +195,9 @@ func (s *BillingService) GetPackagesBillingUser(ctx context.Context, user string // GetStorageBillingUser returns the estimated paid and estimated total storage used for GitHub Actions // and GitHub Packages in gigabytes for a user. // -// GitHub API docs: https://docs.github.com/en/rest/billing#get-shared-storage-billing-for-a-user +// GitHub API docs: https://docs.github.com/rest/billing/billing#get-shared-storage-billing-for-a-user +// +//meta:operation GET /users/{username}/settings/billing/shared-storage func (s *BillingService) GetStorageBillingUser(ctx context.Context, user string) (*StorageBilling, *Response, error) { u := fmt.Sprintf("users/%v/settings/billing/shared-storage", user) req, err := s.client.NewRequest("GET", u, nil) diff --git a/github/checks.go b/github/checks.go index 12d08530ca0..a8618944532 100644 --- a/github/checks.go +++ b/github/checks.go @@ -13,7 +13,7 @@ import ( // ChecksService provides access to the Checks API in the // GitHub API. // -// GitHub API docs: https://docs.github.com/en/rest/checks/ +// GitHub API docs: https://docs.github.com/rest/checks/ type ChecksService service // CheckRun represents a GitHub check run on a repository associated with a GitHub app. @@ -98,7 +98,9 @@ func (c CheckSuite) String() string { // GetCheckRun gets a check-run for a repository. // -// GitHub API docs: https://docs.github.com/en/rest/checks/runs#get-a-check-run +// GitHub API docs: https://docs.github.com/rest/checks/runs#get-a-check-run +// +//meta:operation GET /repos/{owner}/{repo}/check-runs/{check_run_id} func (s *ChecksService) GetCheckRun(ctx context.Context, owner, repo string, checkRunID int64) (*CheckRun, *Response, error) { u := fmt.Sprintf("repos/%v/%v/check-runs/%v", owner, repo, checkRunID) req, err := s.client.NewRequest("GET", u, nil) @@ -119,7 +121,9 @@ func (s *ChecksService) GetCheckRun(ctx context.Context, owner, repo string, che // GetCheckSuite gets a single check suite. // -// GitHub API docs: https://docs.github.com/en/rest/checks/suites#get-a-check-suite +// GitHub API docs: https://docs.github.com/rest/checks/suites#get-a-check-suite +// +//meta:operation GET /repos/{owner}/{repo}/check-suites/{check_suite_id} func (s *ChecksService) GetCheckSuite(ctx context.Context, owner, repo string, checkSuiteID int64) (*CheckSuite, *Response, error) { u := fmt.Sprintf("repos/%v/%v/check-suites/%v", owner, repo, checkSuiteID) req, err := s.client.NewRequest("GET", u, nil) @@ -161,7 +165,9 @@ type CheckRunAction struct { // CreateCheckRun creates a check run for repository. // -// GitHub API docs: https://docs.github.com/en/rest/checks/runs#create-a-check-run +// GitHub API docs: https://docs.github.com/rest/checks/runs#create-a-check-run +// +//meta:operation POST /repos/{owner}/{repo}/check-runs func (s *ChecksService) CreateCheckRun(ctx context.Context, owner, repo string, opts CreateCheckRunOptions) (*CheckRun, *Response, error) { u := fmt.Sprintf("repos/%v/%v/check-runs", owner, repo) req, err := s.client.NewRequest("POST", u, opts) @@ -194,7 +200,9 @@ type UpdateCheckRunOptions struct { // UpdateCheckRun updates a check run for a specific commit in a repository. // -// GitHub API docs: https://docs.github.com/en/rest/checks/runs#update-a-check-run +// GitHub API docs: https://docs.github.com/rest/checks/runs#update-a-check-run +// +//meta:operation PATCH /repos/{owner}/{repo}/check-runs/{check_run_id} func (s *ChecksService) UpdateCheckRun(ctx context.Context, owner, repo string, checkRunID int64, opts UpdateCheckRunOptions) (*CheckRun, *Response, error) { u := fmt.Sprintf("repos/%v/%v/check-runs/%v", owner, repo, checkRunID) req, err := s.client.NewRequest("PATCH", u, opts) @@ -215,7 +223,9 @@ func (s *ChecksService) UpdateCheckRun(ctx context.Context, owner, repo string, // ListCheckRunAnnotations lists the annotations for a check run. // -// GitHub API docs: https://docs.github.com/en/rest/checks/runs#list-check-run-annotations +// GitHub API docs: https://docs.github.com/rest/checks/runs#list-check-run-annotations +// +//meta:operation GET /repos/{owner}/{repo}/check-runs/{check_run_id}/annotations func (s *ChecksService) ListCheckRunAnnotations(ctx context.Context, owner, repo string, checkRunID int64, opts *ListOptions) ([]*CheckRunAnnotation, *Response, error) { u := fmt.Sprintf("repos/%v/%v/check-runs/%v/annotations", owner, repo, checkRunID) u, err := addOptions(u, opts) @@ -257,7 +267,9 @@ type ListCheckRunsResults struct { // ListCheckRunsForRef lists check runs for a specific ref. // -// GitHub API docs: https://docs.github.com/en/rest/checks/runs#list-check-runs-for-a-git-reference +// GitHub API docs: https://docs.github.com/rest/checks/runs#list-check-runs-for-a-git-reference +// +//meta:operation GET /repos/{owner}/{repo}/commits/{ref}/check-runs func (s *ChecksService) ListCheckRunsForRef(ctx context.Context, owner, repo, ref string, opts *ListCheckRunsOptions) (*ListCheckRunsResults, *Response, error) { u := fmt.Sprintf("repos/%v/%v/commits/%v/check-runs", owner, repo, refURLEscape(ref)) u, err := addOptions(u, opts) @@ -283,7 +295,9 @@ func (s *ChecksService) ListCheckRunsForRef(ctx context.Context, owner, repo, re // ListCheckRunsCheckSuite lists check runs for a check suite. // -// GitHub API docs: https://docs.github.com/en/rest/checks/runs#list-check-runs-in-a-check-suite +// GitHub API docs: https://docs.github.com/rest/checks/runs#list-check-runs-in-a-check-suite +// +//meta:operation GET /repos/{owner}/{repo}/check-suites/{check_suite_id}/check-runs func (s *ChecksService) ListCheckRunsCheckSuite(ctx context.Context, owner, repo string, checkSuiteID int64, opts *ListCheckRunsOptions) (*ListCheckRunsResults, *Response, error) { u := fmt.Sprintf("repos/%v/%v/check-suites/%v/check-runs", owner, repo, checkSuiteID) u, err := addOptions(u, opts) @@ -309,7 +323,9 @@ func (s *ChecksService) ListCheckRunsCheckSuite(ctx context.Context, owner, repo // ReRequestCheckRun triggers GitHub to rerequest an existing check run. // -// GitHub API docs: https://docs.github.com/en/rest/checks/runs#rerequest-a-check-run +// GitHub API docs: https://docs.github.com/rest/checks/runs#rerequest-a-check-run +// +//meta:operation POST /repos/{owner}/{repo}/check-runs/{check_run_id}/rerequest func (s *ChecksService) ReRequestCheckRun(ctx context.Context, owner, repo string, checkRunID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/check-runs/%v/rerequest", owner, repo, checkRunID) @@ -339,7 +355,9 @@ type ListCheckSuiteResults struct { // ListCheckSuitesForRef lists check suite for a specific ref. // -// GitHub API docs: https://docs.github.com/en/rest/checks/suites#list-check-suites-for-a-git-reference +// GitHub API docs: https://docs.github.com/rest/checks/suites#list-check-suites-for-a-git-reference +// +//meta:operation GET /repos/{owner}/{repo}/commits/{ref}/check-suites func (s *ChecksService) ListCheckSuitesForRef(ctx context.Context, owner, repo, ref string, opts *ListCheckSuiteOptions) (*ListCheckSuiteResults, *Response, error) { u := fmt.Sprintf("repos/%v/%v/commits/%v/check-suites", owner, repo, refURLEscape(ref)) u, err := addOptions(u, opts) @@ -387,7 +405,9 @@ type PreferenceList struct { // SetCheckSuitePreferences changes the default automatic flow when creating check suites. // -// GitHub API docs: https://docs.github.com/en/rest/checks/suites#update-repository-preferences-for-check-suites +// GitHub API docs: https://docs.github.com/rest/checks/suites#update-repository-preferences-for-check-suites +// +//meta:operation PATCH /repos/{owner}/{repo}/check-suites/preferences func (s *ChecksService) SetCheckSuitePreferences(ctx context.Context, owner, repo string, opts CheckSuitePreferenceOptions) (*CheckSuitePreferenceResults, *Response, error) { u := fmt.Sprintf("repos/%v/%v/check-suites/preferences", owner, repo) req, err := s.client.NewRequest("PATCH", u, opts) @@ -414,7 +434,9 @@ type CreateCheckSuiteOptions struct { // CreateCheckSuite manually creates a check suite for a repository. // -// GitHub API docs: https://docs.github.com/en/rest/checks/suites#create-a-check-suite +// GitHub API docs: https://docs.github.com/rest/checks/suites#create-a-check-suite +// +//meta:operation POST /repos/{owner}/{repo}/check-suites func (s *ChecksService) CreateCheckSuite(ctx context.Context, owner, repo string, opts CreateCheckSuiteOptions) (*CheckSuite, *Response, error) { u := fmt.Sprintf("repos/%v/%v/check-suites", owner, repo) req, err := s.client.NewRequest("POST", u, opts) @@ -435,7 +457,9 @@ func (s *ChecksService) CreateCheckSuite(ctx context.Context, owner, repo string // ReRequestCheckSuite triggers GitHub to rerequest an existing check suite, without pushing new code to a repository. // -// GitHub API docs: https://docs.github.com/en/rest/checks/suites#rerequest-a-check-suite +// GitHub API docs: https://docs.github.com/rest/checks/suites#rerequest-a-check-suite +// +//meta:operation POST /repos/{owner}/{repo}/check-suites/{check_suite_id}/rerequest func (s *ChecksService) ReRequestCheckSuite(ctx context.Context, owner, repo string, checkSuiteID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/check-suites/%v/rerequest", owner, repo, checkSuiteID) diff --git a/github/code-scanning.go b/github/code-scanning.go index 0ae269be676..74a7b6c9b47 100644 --- a/github/code-scanning.go +++ b/github/code-scanning.go @@ -15,7 +15,7 @@ import ( // CodeScanningService handles communication with the code scanning related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/en/rest/code-scanning +// GitHub API docs: https://docs.github.com/rest/code-scanning type CodeScanningService service // Rule represents the complete details of GitHub Code Scanning alert type. @@ -67,7 +67,7 @@ type Tool struct { // Alert represents an individual GitHub Code Scanning Alert on a single repository. // -// GitHub API docs: https://docs.github.com/en/rest/code-scanning +// GitHub API docs: https://docs.github.com/rest/code-scanning type Alert struct { Number *int `json:"number,omitempty"` Repository *Repository `json:"repository,omitempty"` @@ -160,7 +160,7 @@ type AnalysesListOptions struct { // CodeQLDatabase represents a metadata about the CodeQL database. // -// GitHub API docs: https://docs.github.com/en/rest/code-scanning +// GitHub API docs: https://docs.github.com/rest/code-scanning type CodeQLDatabase struct { ID *int64 `json:"id,omitempty"` Name *string `json:"name,omitempty"` @@ -175,7 +175,7 @@ type CodeQLDatabase struct { // ScanningAnalysis represents an individual GitHub Code Scanning ScanningAnalysis on a single repository. // -// GitHub API docs: https://docs.github.com/en/rest/code-scanning +// GitHub API docs: https://docs.github.com/rest/code-scanning type ScanningAnalysis struct { ID *int64 `json:"id,omitempty"` Ref *string `json:"ref,omitempty"` @@ -196,7 +196,7 @@ type ScanningAnalysis struct { // SarifAnalysis specifies the results of a code scanning job. // -// GitHub API docs: https://docs.github.com/en/rest/code-scanning +// GitHub API docs: https://docs.github.com/rest/code-scanning type SarifAnalysis struct { CommitSHA *string `json:"commit_sha,omitempty"` Ref *string `json:"ref,omitempty"` @@ -208,7 +208,7 @@ type SarifAnalysis struct { // CodeScanningAlertState specifies the state of a code scanning alert. // -// GitHub API docs: https://docs.github.com/en/rest/code-scanning +// GitHub API docs: https://docs.github.com/rest/code-scanning type CodeScanningAlertState struct { // State sets the state of the code scanning alert and is a required field. // You must also provide DismissedReason when you set the state to "dismissed". @@ -224,7 +224,7 @@ type CodeScanningAlertState struct { // SarifID identifies a sarif analysis upload. // -// GitHub API docs: https://docs.github.com/en/rest/code-scanning +// GitHub API docs: https://docs.github.com/rest/code-scanning type SarifID struct { ID *string `json:"id,omitempty"` URL *string `json:"url,omitempty"` @@ -235,7 +235,9 @@ type SarifID struct { // You must use an access token with the security_events scope to use this endpoint. GitHub Apps must have the security_events // read permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/code-scanning/code-scanning#list-code-scanning-alerts-for-an-organization +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#list-code-scanning-alerts-for-an-organization +// +//meta:operation GET /orgs/{org}/code-scanning/alerts func (s *CodeScanningService) ListAlertsForOrg(ctx context.Context, org string, opts *AlertListOptions) ([]*Alert, *Response, error) { u := fmt.Sprintf("orgs/%v/code-scanning/alerts", org) u, err := addOptions(u, opts) @@ -263,7 +265,9 @@ func (s *CodeScanningService) ListAlertsForOrg(ctx context.Context, org string, // You must use an access token with the security_events scope to use this endpoint. GitHub Apps must have the security_events // read permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/code-scanning/code-scanning#list-code-scanning-alerts-for-a-repository +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#list-code-scanning-alerts-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/code-scanning/alerts func (s *CodeScanningService) ListAlertsForRepo(ctx context.Context, owner, repo string, opts *AlertListOptions) ([]*Alert, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/alerts", owner, repo) u, err := addOptions(u, opts) @@ -292,7 +296,9 @@ func (s *CodeScanningService) ListAlertsForRepo(ctx context.Context, owner, repo // // The security alert_id is the number at the end of the security alert's URL. // -// GitHub API docs: https://docs.github.com/en/rest/code-scanning/code-scanning#get-a-code-scanning-alert +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#get-a-code-scanning-alert +// +//meta:operation GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number} func (s *CodeScanningService) GetAlert(ctx context.Context, owner, repo string, id int64) (*Alert, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/alerts/%v", owner, repo, id) @@ -317,7 +323,9 @@ func (s *CodeScanningService) GetAlert(ctx context.Context, owner, repo string, // // The security alert_id is the number at the end of the security alert's URL. // -// GitHub API docs: https://docs.github.com/en/rest/code-scanning?apiVersion=2022-11-28#update-a-code-scanning-alert +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#update-a-code-scanning-alert +// +//meta:operation PATCH /repos/{owner}/{repo}/code-scanning/alerts/{alert_number} func (s *CodeScanningService) UpdateAlert(ctx context.Context, owner, repo string, id int64, stateInfo *CodeScanningAlertState) (*Alert, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/alerts/%v", owner, repo, id) @@ -340,7 +348,9 @@ func (s *CodeScanningService) UpdateAlert(ctx context.Context, owner, repo strin // You must use an access token with the security_events scope to use this endpoint. // GitHub Apps must have the security_events read permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/code-scanning/code-scanning#list-instances-of-a-code-scanning-alert +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#list-instances-of-a-code-scanning-alert +// +//meta:operation GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances func (s *CodeScanningService) ListAlertInstances(ctx context.Context, owner, repo string, id int64, opts *AlertInstancesListOptions) ([]*MostRecentInstance, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/alerts/%v/instances", owner, repo, id) u, err := addOptions(u, opts) @@ -368,7 +378,9 @@ func (s *CodeScanningService) ListAlertInstances(ctx context.Context, owner, rep // You must use an access token with the security_events scope to use this endpoint. GitHub Apps must have the security_events // write permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/code-scanning/code-scanning#upload-an-analysis-as-sarif-data +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#upload-an-analysis-as-sarif-data +// +//meta:operation POST /repos/{owner}/{repo}/code-scanning/sarifs func (s *CodeScanningService) UploadSarif(ctx context.Context, owner, repo string, sarif *SarifAnalysis) (*SarifID, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/sarifs", owner, repo) @@ -400,7 +412,9 @@ type SARIFUpload struct { // You must use an access token with the security_events scope to use this endpoint. // GitHub Apps must have the security_events read permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/code-scanning/code-scanning#get-information-about-a-sarif-upload +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#get-information-about-a-sarif-upload +// +//meta:operation GET /repos/{owner}/{repo}/code-scanning/sarifs/{sarif_id} func (s *CodeScanningService) GetSARIF(ctx context.Context, owner, repo, sarifID string) (*SARIFUpload, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/sarifs/%v", owner, repo, sarifID) @@ -424,7 +438,9 @@ func (s *CodeScanningService) GetSARIF(ctx context.Context, owner, repo, sarifID // You must use an access token with the security_events scope to use this endpoint. // GitHub Apps must have the security_events read permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/code-scanning/code-scanning#list-code-scanning-analyses-for-a-repository +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#list-code-scanning-analyses-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/code-scanning/analyses func (s *CodeScanningService) ListAnalysesForRepo(ctx context.Context, owner, repo string, opts *AnalysesListOptions) ([]*ScanningAnalysis, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/analyses", owner, repo) u, err := addOptions(u, opts) @@ -453,7 +469,9 @@ func (s *CodeScanningService) ListAnalysesForRepo(ctx context.Context, owner, re // // The security analysis_id is the ID of the analysis, as returned from the ListAnalysesForRepo operation. // -// GitHub API docs: https://docs.github.com/en/rest/code-scanning/code-scanning#get-a-code-scanning-analysis-for-a-repository +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#get-a-code-scanning-analysis-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/code-scanning/analyses/{analysis_id} func (s *CodeScanningService) GetAnalysis(ctx context.Context, owner, repo string, id int64) (*ScanningAnalysis, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/analyses/%v", owner, repo, id) @@ -486,7 +504,9 @@ type DeleteAnalysis struct { // // The security analysis_id is the ID of the analysis, as returned from the ListAnalysesForRepo operation. // -// GitHub API docs: https://docs.github.com/en/rest/code-scanning/code-scanning#delete-a-code-scanning-analysis-from-a-repository +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#delete-a-code-scanning-analysis-from-a-repository +// +//meta:operation DELETE /repos/{owner}/{repo}/code-scanning/analyses/{analysis_id} func (s *CodeScanningService) DeleteAnalysis(ctx context.Context, owner, repo string, id int64) (*DeleteAnalysis, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/analyses/%v", owner, repo, id) @@ -509,7 +529,9 @@ func (s *CodeScanningService) DeleteAnalysis(ctx context.Context, owner, repo st // You must use an access token with the security_events scope to use this endpoint. // GitHub Apps must have the contents read permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/code-scanning/code-scanning#list-codeql-databases-for-a-repository +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#list-codeql-databases-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/code-scanning/codeql/databases func (s *CodeScanningService) ListCodeQLDatabases(ctx context.Context, owner, repo string) ([]*CodeQLDatabase, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/codeql/databases", owner, repo) @@ -532,7 +554,9 @@ func (s *CodeScanningService) ListCodeQLDatabases(ctx context.Context, owner, re // You must use an access token with the security_events scope to use this endpoint. // GitHub Apps must have the contents read permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/code-scanning/code-scanning#get-a-codeql-database-for-a-repository +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#get-a-codeql-database-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/code-scanning/codeql/databases/{language} func (s *CodeScanningService) GetCodeQLDatabase(ctx context.Context, owner, repo, language string) (*CodeQLDatabase, *Response, error) { u := fmt.Sprintf("repos/%v/%v/code-scanning/codeql/databases/%v", owner, repo, language) @@ -564,7 +588,9 @@ type DefaultSetupConfiguration struct { // endpoint with private repos or the public_repo scope for public repos. GitHub Apps must have the repo write // permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/code-scanning/code-scanning#get-a-code-scanning-default-setup-configuration +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#get-a-code-scanning-default-setup-configuration +// +//meta:operation GET /repos/{owner}/{repo}/code-scanning/default-setup func (s *CodeScanningService) GetDefaultSetupConfiguration(ctx context.Context, owner, repo string) (*DefaultSetupConfiguration, *Response, error) { u := fmt.Sprintf("repos/%s/%s/code-scanning/default-setup", owner, repo) @@ -605,7 +631,9 @@ type UpdateDefaultSetupConfigurationResponse struct { // This method might return an AcceptedError and a status code of 202. This is because this is the status that GitHub // returns to signify that it has now scheduled the update of the pull request branch in a background task. // -// GitHub API docs: https://docs.github.com/en/rest/code-scanning/code-scanning#update-a-code-scanning-default-setup-configuration +// GitHub API docs: https://docs.github.com/rest/code-scanning/code-scanning#update-a-code-scanning-default-setup-configuration +// +//meta:operation PATCH /repos/{owner}/{repo}/code-scanning/default-setup func (s *CodeScanningService) UpdateDefaultSetupConfiguration(ctx context.Context, owner, repo string, options *UpdateDefaultSetupConfigurationOptions) (*UpdateDefaultSetupConfigurationResponse, *Response, error) { u := fmt.Sprintf("repos/%s/%s/code-scanning/default-setup", owner, repo) diff --git a/github/codesofconduct.go b/github/codesofconduct.go index 11e1fb38df0..7d7f9ef8188 100644 --- a/github/codesofconduct.go +++ b/github/codesofconduct.go @@ -28,6 +28,8 @@ func (c *CodeOfConduct) String() string { // List returns all codes of conduct. // // GitHub API docs: https://docs.github.com/rest/codes-of-conduct/codes-of-conduct#get-all-codes-of-conduct +// +//meta:operation GET /codes_of_conduct func (s *CodesOfConductService) List(ctx context.Context) ([]*CodeOfConduct, *Response, error) { req, err := s.client.NewRequest("GET", "codes_of_conduct", nil) if err != nil { @@ -56,6 +58,8 @@ func (c *Client) ListCodesOfConduct(ctx context.Context) ([]*CodeOfConduct, *Res // Get returns an individual code of conduct. // // GitHub API docs: https://docs.github.com/rest/codes-of-conduct/codes-of-conduct#get-a-code-of-conduct +// +//meta:operation GET /codes_of_conduct/{key} func (s *CodesOfConductService) Get(ctx context.Context, key string) (*CodeOfConduct, *Response, error) { u := fmt.Sprintf("codes_of_conduct/%s", key) req, err := s.client.NewRequest("GET", u, nil) diff --git a/github/codespaces.go b/github/codespaces.go index f2e6a284cf0..608370503f6 100644 --- a/github/codespaces.go +++ b/github/codespaces.go @@ -13,12 +13,12 @@ import ( // CodespacesService handles communication with the Codespaces related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/en/rest/codespaces/ +// GitHub API docs: https://docs.github.com/rest/codespaces/ type CodespacesService service // Codespace represents a codespace. // -// GitHub API docs: https://docs.github.com/en/rest/codespaces +// GitHub API docs: https://docs.github.com/rest/codespaces type Codespace struct { ID *int64 `json:"id,omitempty"` Name *string `json:"name,omitempty"` @@ -90,7 +90,9 @@ type ListCodespaces struct { // You must authenticate using an access token with the codespace scope to use this endpoint. // GitHub Apps must have read access to the codespaces repository permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/codespaces/codespaces?apiVersion=2022-11-28#list-codespaces-in-a-repository-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces#list-codespaces-in-a-repository-for-the-authenticated-user +// +//meta:operation GET /repos/{owner}/{repo}/codespaces func (s *CodespacesService) ListInRepo(ctx context.Context, owner, repo string, opts *ListOptions) (*ListCodespaces, *Response, error) { u := fmt.Sprintf("repos/%v/%v/codespaces", owner, repo) u, err := addOptions(u, opts) @@ -124,7 +126,9 @@ type ListCodespacesOptions struct { // You must authenticate using an access token with the codespace scope to use this endpoint. // GitHub Apps must have read access to the codespaces repository permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/codespaces/codespaces?apiVersion=2022-11-28#list-codespaces-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces#list-codespaces-for-the-authenticated-user +// +//meta:operation GET /user/codespaces func (s *CodespacesService) List(ctx context.Context, opts *ListCodespacesOptions) (*ListCodespaces, *Response, error) { u := "user/codespaces" u, err := addOptions(u, opts) @@ -172,7 +176,9 @@ type CreateCodespaceOptions struct { // You must authenticate using an access token with the codespace scope to use this endpoint. // GitHub Apps must have write access to the codespaces repository permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/codespaces/codespaces?apiVersion=2022-11-28#create-a-codespace-in-a-repository +// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces#create-a-codespace-in-a-repository +// +//meta:operation POST /repos/{owner}/{repo}/codespaces func (s *CodespacesService) CreateInRepo(ctx context.Context, owner, repo string, request *CreateCodespaceOptions) (*Codespace, *Response, error) { u := fmt.Sprintf("repos/%v/%v/codespaces", owner, repo) @@ -195,7 +201,9 @@ func (s *CodespacesService) CreateInRepo(ctx context.Context, owner, repo string // You must authenticate using an access token with the codespace scope to use this endpoint. // GitHub Apps must have write access to the codespaces_lifecycle_admin repository permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/codespaces/codespaces?apiVersion=2022-11-28#start-a-codespace-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces#start-a-codespace-for-the-authenticated-user +// +//meta:operation POST /user/codespaces/{codespace_name}/start func (s *CodespacesService) Start(ctx context.Context, codespaceName string) (*Codespace, *Response, error) { u := fmt.Sprintf("user/codespaces/%v/start", codespaceName) @@ -218,7 +226,9 @@ func (s *CodespacesService) Start(ctx context.Context, codespaceName string) (*C // You must authenticate using an access token with the codespace scope to use this endpoint. // GitHub Apps must have write access to the codespaces_lifecycle_admin repository permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/codespaces/codespaces?apiVersion=2022-11-28#stop-a-codespace-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces#stop-a-codespace-for-the-authenticated-user +// +//meta:operation POST /user/codespaces/{codespace_name}/stop func (s *CodespacesService) Stop(ctx context.Context, codespaceName string) (*Codespace, *Response, error) { u := fmt.Sprintf("user/codespaces/%v/stop", codespaceName) @@ -241,7 +251,9 @@ func (s *CodespacesService) Stop(ctx context.Context, codespaceName string) (*Co // You must authenticate using an access token with the codespace scope to use this endpoint. // GitHub Apps must have write access to the codespaces repository permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/codespaces/codespaces?apiVersion=2022-11-28#delete-a-codespace-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/codespaces/codespaces#delete-a-codespace-for-the-authenticated-user +// +//meta:operation DELETE /user/codespaces/{codespace_name} func (s *CodespacesService) Delete(ctx context.Context, codespaceName string) (*Response, error) { u := fmt.Sprintf("user/codespaces/%v", codespaceName) diff --git a/github/codespaces_secrets.go b/github/codespaces_secrets.go index e11c679c668..438c27f8ffe 100644 --- a/github/codespaces_secrets.go +++ b/github/codespaces_secrets.go @@ -16,7 +16,9 @@ import ( // You must authenticate using an access token with the codespace or codespace:secrets scope to use this endpoint. User must have Codespaces access to use this endpoint // GitHub Apps must have read access to the codespaces_user_secrets user permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/codespaces/secrets?apiVersion=2022-11-28#list-secrets-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/codespaces/secrets#list-secrets-for-the-authenticated-user +// +//meta:operation GET /user/codespaces/secrets func (s *CodespacesService) ListUserSecrets(ctx context.Context, opts *ListOptions) (*Secrets, *Response, error) { u, err := addOptions("user/codespaces/secrets", opts) if err != nil { @@ -29,7 +31,9 @@ func (s *CodespacesService) ListUserSecrets(ctx context.Context, opts *ListOptio // // Lists all Codespaces secrets available at the organization-level without revealing their encrypted values. You must authenticate using an access token with the admin:org scope to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/codespaces/organization-secrets?apiVersion=2022-11-28#list-organization-secrets +// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets#list-organization-secrets +// +//meta:operation GET /orgs/{org}/codespaces/secrets func (s *CodespacesService) ListOrgSecrets(ctx context.Context, org string, opts *ListOptions) (*Secrets, *Response, error) { u := fmt.Sprintf("orgs/%v/codespaces/secrets", org) u, err := addOptions(u, opts) @@ -43,7 +47,9 @@ func (s *CodespacesService) ListOrgSecrets(ctx context.Context, org string, opts // // Lists all secrets available in a repository without revealing their encrypted values. You must authenticate using an access token with the repo scope to use this endpoint. GitHub Apps must have write access to the codespaces_secrets repository permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/codespaces/repository-secrets?apiVersion=2022-11-28#list-repository-secrets +// GitHub API docs: https://docs.github.com/rest/codespaces/repository-secrets#list-repository-secrets +// +//meta:operation GET /repos/{owner}/{repo}/codespaces/secrets func (s *CodespacesService) ListRepoSecrets(ctx context.Context, owner, repo string, opts *ListOptions) (*Secrets, *Response, error) { u := fmt.Sprintf("repos/%v/%v/codespaces/secrets", owner, repo) u, err := addOptions(u, opts) @@ -74,7 +80,9 @@ func (s *CodespacesService) listSecrets(ctx context.Context, url string) (*Secre // You must authenticate using an access token with the codespace or codespace:secrets scope to use this endpoint. User must have Codespaces access to use this endpoint. // GitHub Apps must have read access to the codespaces_user_secrets user permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/codespaces/secrets?apiVersion=2022-11-28#get-public-key-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/codespaces/secrets#get-public-key-for-the-authenticated-user +// +//meta:operation GET /user/codespaces/secrets/public-key func (s *CodespacesService) GetUserPublicKey(ctx context.Context) (*PublicKey, *Response, error) { return s.getPublicKey(ctx, "user/codespaces/secrets/public-key") } @@ -83,7 +91,9 @@ func (s *CodespacesService) GetUserPublicKey(ctx context.Context) (*PublicKey, * // // Gets a public key for an organization, which is required in order to encrypt secrets. You need to encrypt the value of a secret before you can create or update secrets. You must authenticate using an access token with the admin:org scope to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/codespaces/organization-secrets?apiVersion=2022-11-28#get-an-organization-public-key +// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets#get-an-organization-public-key +// +//meta:operation GET /orgs/{org}/codespaces/secrets/public-key func (s *CodespacesService) GetOrgPublicKey(ctx context.Context, org string) (*PublicKey, *Response, error) { return s.getPublicKey(ctx, fmt.Sprintf("orgs/%v/codespaces/secrets/public-key", org)) } @@ -92,7 +102,9 @@ func (s *CodespacesService) GetOrgPublicKey(ctx context.Context, org string) (*P // // Gets your public key, which you need to encrypt secrets. You need to encrypt a secret before you can create or update secrets. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the repo scope. GitHub Apps must have write access to the codespaces_secrets repository permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/codespaces/repository-secrets?apiVersion=2022-11-28#get-a-repository-public-key +// GitHub API docs: https://docs.github.com/rest/codespaces/repository-secrets#get-a-repository-public-key +// +//meta:operation GET /repos/{owner}/{repo}/codespaces/secrets/public-key func (s *CodespacesService) GetRepoPublicKey(ctx context.Context, owner, repo string) (*PublicKey, *Response, error) { return s.getPublicKey(ctx, fmt.Sprintf("repos/%v/%v/codespaces/secrets/public-key", owner, repo)) } @@ -118,7 +130,9 @@ func (s *CodespacesService) getPublicKey(ctx context.Context, url string) (*Publ // You must authenticate using an access token with the codespace or codespace:secrets scope to use this endpoint. User must have Codespaces access to use this endpoint. // GitHub Apps must have read access to the codespaces_user_secrets user permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/codespaces/secrets?apiVersion=2022-11-28#get-a-secret-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/codespaces/secrets#get-a-secret-for-the-authenticated-user +// +//meta:operation GET /user/codespaces/secrets/{secret_name} func (s *CodespacesService) GetUserSecret(ctx context.Context, name string) (*Secret, *Response, error) { u := fmt.Sprintf("user/codespaces/secrets/%v", name) return s.getSecret(ctx, u) @@ -128,7 +142,9 @@ func (s *CodespacesService) GetUserSecret(ctx context.Context, name string) (*Se // // Gets an organization secret without revealing its encrypted value. You must authenticate using an access token with the admin:org scope to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/codespaces/organization-secrets?apiVersion=2022-11-28#get-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets#get-an-organization-secret +// +//meta:operation GET /orgs/{org}/codespaces/secrets/{secret_name} func (s *CodespacesService) GetOrgSecret(ctx context.Context, org, name string) (*Secret, *Response, error) { u := fmt.Sprintf("orgs/%v/codespaces/secrets/%v", org, name) return s.getSecret(ctx, u) @@ -138,7 +154,9 @@ func (s *CodespacesService) GetOrgSecret(ctx context.Context, org, name string) // // Gets a single repository secret without revealing its encrypted value. You must authenticate using an access token with the repo scope to use this endpoint. GitHub Apps must have write access to the codespaces_secrets repository permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/codespaces/repository-secrets?apiVersion=2022-11-28#get-a-repository-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/repository-secrets#get-a-repository-secret +// +//meta:operation GET /repos/{owner}/{repo}/codespaces/secrets/{secret_name} func (s *CodespacesService) GetRepoSecret(ctx context.Context, owner, repo, name string) (*Secret, *Response, error) { u := fmt.Sprintf("repos/%v/%v/codespaces/secrets/%v", owner, repo, name) return s.getSecret(ctx, u) @@ -165,7 +183,9 @@ func (s *CodespacesService) getSecret(ctx context.Context, url string) (*Secret, // You must authenticate using an access token with the codespace or codespace:secrets scope to use this endpoint. User must also have Codespaces access to use this endpoint. // GitHub Apps must have write access to the codespaces_user_secrets user permission and codespaces_secrets repository permission on all referenced repositories to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/codespaces/secrets?apiVersion=2022-11-28#create-or-update-a-secret-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/codespaces/secrets#create-or-update-a-secret-for-the-authenticated-user +// +//meta:operation PUT /user/codespaces/secrets/{secret_name} func (s *CodespacesService) CreateOrUpdateUserSecret(ctx context.Context, eSecret *EncryptedSecret) (*Response, error) { u := fmt.Sprintf("user/codespaces/secrets/%v", eSecret.Name) return s.createOrUpdateSecret(ctx, u, eSecret) @@ -175,7 +195,9 @@ func (s *CodespacesService) CreateOrUpdateUserSecret(ctx context.Context, eSecre // // Creates or updates an organization secret with an encrypted value. Encrypt your secret using LibSodium. You must authenticate using an access token with the admin:org scope to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/codespaces/organization-secrets?apiVersion=2022-11-28#create-or-update-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets#create-or-update-an-organization-secret +// +//meta:operation PUT /orgs/{org}/codespaces/secrets/{secret_name} func (s *CodespacesService) CreateOrUpdateOrgSecret(ctx context.Context, org string, eSecret *EncryptedSecret) (*Response, error) { u := fmt.Sprintf("orgs/%v/codespaces/secrets/%v", org, eSecret.Name) return s.createOrUpdateSecret(ctx, u, eSecret) @@ -185,7 +207,9 @@ func (s *CodespacesService) CreateOrUpdateOrgSecret(ctx context.Context, org str // // Creates or updates a repository secret with an encrypted value. Encrypt your secret using LibSodium. You must authenticate using an access token with the repo scope to use this endpoint. GitHub Apps must have write access to the codespaces_secrets repository permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/codespaces/repository-secrets?apiVersion=2022-11-28#create-or-update-a-repository-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/repository-secrets#create-or-update-a-repository-secret +// +//meta:operation PUT /repos/{owner}/{repo}/codespaces/secrets/{secret_name} func (s *CodespacesService) CreateOrUpdateRepoSecret(ctx context.Context, owner, repo string, eSecret *EncryptedSecret) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/codespaces/secrets/%v", owner, repo, eSecret.Name) return s.createOrUpdateSecret(ctx, u, eSecret) @@ -211,7 +235,9 @@ func (s *CodespacesService) createOrUpdateSecret(ctx context.Context, url string // You must authenticate using an access token with the codespace or codespace:secrets scope to use this endpoint. User must have Codespaces access to use this endpoint. // GitHub Apps must have write access to the codespaces_user_secrets user permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/codespaces/secrets?apiVersion=2022-11-28#delete-a-secret-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/codespaces/secrets#delete-a-secret-for-the-authenticated-user +// +//meta:operation DELETE /user/codespaces/secrets/{secret_name} func (s *CodespacesService) DeleteUserSecret(ctx context.Context, name string) (*Response, error) { u := fmt.Sprintf("user/codespaces/secrets/%v", name) return s.deleteSecret(ctx, u) @@ -221,7 +247,9 @@ func (s *CodespacesService) DeleteUserSecret(ctx context.Context, name string) ( // // Deletes an organization secret using the secret name. You must authenticate using an access token with the admin:org scope to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/codespaces/organization-secrets?apiVersion=2022-11-28#delete-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets#delete-an-organization-secret +// +//meta:operation DELETE /orgs/{org}/codespaces/secrets/{secret_name} func (s *CodespacesService) DeleteOrgSecret(ctx context.Context, org, name string) (*Response, error) { u := fmt.Sprintf("orgs/%v/codespaces/secrets/%v", org, name) return s.deleteSecret(ctx, u) @@ -231,7 +259,9 @@ func (s *CodespacesService) DeleteOrgSecret(ctx context.Context, org, name strin // // Deletes a secret in a repository using the secret name. You must authenticate using an access token with the repo scope to use this endpoint. GitHub Apps must have write access to the codespaces_secrets repository permission to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/codespaces/repository-secrets?apiVersion=2022-11-28#delete-a-repository-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/repository-secrets#delete-a-repository-secret +// +//meta:operation DELETE /repos/{owner}/{repo}/codespaces/secrets/{secret_name} func (s *CodespacesService) DeleteRepoSecret(ctx context.Context, owner, repo, name string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/codespaces/secrets/%v", owner, repo, name) return s.deleteSecret(ctx, u) @@ -256,7 +286,9 @@ func (s *CodespacesService) deleteSecret(ctx context.Context, url string) (*Resp // You must authenticate using an access token with the codespace or codespace:secrets scope to use this endpoint. User must have Codespaces access to use this endpoint. // GitHub Apps must have read access to the codespaces_user_secrets user permission and write access to the codespaces_secrets repository permission on all referenced repositories to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/codespaces/secrets?apiVersion=2022-11-28#list-selected-repositories-for-a-user-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/secrets#list-selected-repositories-for-a-user-secret +// +//meta:operation GET /user/codespaces/secrets/{secret_name}/repositories func (s *CodespacesService) ListSelectedReposForUserSecret(ctx context.Context, name string, opts *ListOptions) (*SelectedReposList, *Response, error) { u := fmt.Sprintf("user/codespaces/secrets/%v/repositories", name) u, err := addOptions(u, opts) @@ -271,7 +303,9 @@ func (s *CodespacesService) ListSelectedReposForUserSecret(ctx context.Context, // // Lists all repositories that have been selected when the visibility for repository access to a secret is set to selected. You must authenticate using an access token with the admin:org scope to use this endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/codespaces/organization-secrets?apiVersion=2022-11-28#list-selected-repositories-for-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets#list-selected-repositories-for-an-organization-secret +// +//meta:operation GET /orgs/{org}/codespaces/secrets/{secret_name}/repositories func (s *CodespacesService) ListSelectedReposForOrgSecret(ctx context.Context, org, name string, opts *ListOptions) (*SelectedReposList, *Response, error) { u := fmt.Sprintf("orgs/%v/codespaces/secrets/%v/repositories", org, name) u, err := addOptions(u, opts) @@ -302,7 +336,9 @@ func (s *CodespacesService) listSelectedReposForSecret(ctx context.Context, url // You must authenticate using an access token with the codespace or codespace:secrets scope to use this endpoint. User must have Codespaces access to use this endpoint. // GitHub Apps must have write access to the codespaces_user_secrets user permission and write access to the codespaces_secrets repository permission on all referenced repositories to use this endpoint. // -// Github API docs: https://docs.github.com/en/rest/codespaces/secrets?apiVersion=2022-11-28#set-selected-repositories-for-a-user-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/secrets#set-selected-repositories-for-a-user-secret +// +//meta:operation PUT /user/codespaces/secrets/{secret_name}/repositories func (s *CodespacesService) SetSelectedReposForUserSecret(ctx context.Context, name string, ids SelectedRepoIDs) (*Response, error) { u := fmt.Sprintf("user/codespaces/secrets/%v/repositories", name) return s.setSelectedRepoForSecret(ctx, u, ids) @@ -312,7 +348,9 @@ func (s *CodespacesService) SetSelectedReposForUserSecret(ctx context.Context, n // // Replaces all repositories for an organization secret when the visibility for repository access is set to selected. The visibility is set when you Create or update an organization secret. You must authenticate using an access token with the admin:org scope to use this endpoint. // -// Github API docs: https://docs.github.com/en/rest/codespaces/secrets?apiVersion=2022-11-28#set-selected-repositories-for-a-user-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets#set-selected-repositories-for-an-organization-secret +// +//meta:operation PUT /orgs/{org}/codespaces/secrets/{secret_name}/repositories func (s *CodespacesService) SetSelectedReposForOrgSecret(ctx context.Context, org, name string, ids SelectedRepoIDs) (*Response, error) { u := fmt.Sprintf("orgs/%v/codespaces/secrets/%v/repositories", org, name) return s.setSelectedRepoForSecret(ctx, u, ids) @@ -340,7 +378,9 @@ func (s *CodespacesService) setSelectedRepoForSecret(ctx context.Context, url st // // Adds a repository to the selected repositories for a user's codespace secret. You must authenticate using an access token with the codespace or codespace:secrets scope to use this endpoint. User must have Codespaces access to use this endpoint. GitHub Apps must have write access to the codespaces_user_secrets user permission and write access to the codespaces_secrets repository permission on the referenced repository to use this endpoint. // -// Github API docs: https://docs.github.com/en/rest/codespaces/secrets?apiVersion=2022-11-28#add-a-selected-repository-to-a-user-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/secrets#add-a-selected-repository-to-a-user-secret +// +//meta:operation PUT /user/codespaces/secrets/{secret_name}/repositories/{repository_id} func (s *CodespacesService) AddSelectedRepoToUserSecret(ctx context.Context, name string, repo *Repository) (*Response, error) { u := fmt.Sprintf("user/codespaces/secrets/%v/repositories/%v", name, *repo.ID) return s.addSelectedRepoToSecret(ctx, u) @@ -350,7 +390,9 @@ func (s *CodespacesService) AddSelectedRepoToUserSecret(ctx context.Context, nam // // Adds a repository to an organization secret when the visibility for repository access is set to selected. The visibility is set when you Create or update an organization secret. You must authenticate using an access token with the admin:org scope to use this endpoint. // -// Github API docs: https://docs.github.com/en/rest/codespaces/organization-secrets?apiVersion=2022-11-28#add-selected-repository-to-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets#add-selected-repository-to-an-organization-secret +// +//meta:operation PUT /orgs/{org}/codespaces/secrets/{secret_name}/repositories/{repository_id} func (s *CodespacesService) AddSelectedRepoToOrgSecret(ctx context.Context, org, name string, repo *Repository) (*Response, error) { u := fmt.Sprintf("orgs/%v/codespaces/secrets/%v/repositories/%v", org, name, *repo.ID) return s.addSelectedRepoToSecret(ctx, u) @@ -374,7 +416,9 @@ func (s *CodespacesService) addSelectedRepoToSecret(ctx context.Context, url str // // Removes a repository from the selected repositories for a user's codespace secret. You must authenticate using an access token with the codespace or codespace:secrets scope to use this endpoint. User must have Codespaces access to use this endpoint. GitHub Apps must have write access to the codespaces_user_secrets user permission to use this endpoint. // -// Github API docs: https://docs.github.com/en/rest/codespaces/secrets?apiVersion=2022-11-28#remove-a-selected-repository-from-a-user-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/secrets#remove-a-selected-repository-from-a-user-secret +// +//meta:operation DELETE /user/codespaces/secrets/{secret_name}/repositories/{repository_id} func (s *CodespacesService) RemoveSelectedRepoFromUserSecret(ctx context.Context, name string, repo *Repository) (*Response, error) { u := fmt.Sprintf("user/codespaces/secrets/%v/repositories/%v", name, *repo.ID) return s.removeSelectedRepoFromSecret(ctx, u) @@ -384,7 +428,9 @@ func (s *CodespacesService) RemoveSelectedRepoFromUserSecret(ctx context.Context // // Removes a repository from an organization secret when the visibility for repository access is set to selected. The visibility is set when you Create or update an organization secret. You must authenticate using an access token with the admin:org scope to use this endpoint. // -// Github API docs: https://docs.github.com/en/rest/codespaces/organization-secrets?apiVersion=2022-11-28#remove-selected-repository-from-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/codespaces/organization-secrets#remove-selected-repository-from-an-organization-secret +// +//meta:operation DELETE /orgs/{org}/codespaces/secrets/{secret_name}/repositories/{repository_id} func (s *CodespacesService) RemoveSelectedRepoFromOrgSecret(ctx context.Context, org, name string, repo *Repository) (*Response, error) { u := fmt.Sprintf("orgs/%v/codespaces/secrets/%v/repositories/%v", org, name, *repo.ID) return s.removeSelectedRepoFromSecret(ctx, u) diff --git a/github/dependabot.go b/github/dependabot.go index 07e68b506af..2a11a9c9563 100644 --- a/github/dependabot.go +++ b/github/dependabot.go @@ -8,5 +8,5 @@ package github // DependabotService handles communication with the Dependabot related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/en/rest/dependabot/ +// GitHub API docs: https://docs.github.com/rest/dependabot/ type DependabotService service diff --git a/github/dependabot_alerts.go b/github/dependabot_alerts.go index 177316b1dc8..94be610c53d 100644 --- a/github/dependabot_alerts.go +++ b/github/dependabot_alerts.go @@ -104,7 +104,9 @@ func (s *DependabotService) listAlerts(ctx context.Context, url string, opts *Li // ListRepoAlerts lists all Dependabot alerts of a repository. // -// GitHub API docs: https://docs.github.com/en/rest/dependabot/alerts#list-dependabot-alerts-for-a-repository +// GitHub API docs: https://docs.github.com/rest/dependabot/alerts#list-dependabot-alerts-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/dependabot/alerts func (s *DependabotService) ListRepoAlerts(ctx context.Context, owner, repo string, opts *ListAlertsOptions) ([]*DependabotAlert, *Response, error) { url := fmt.Sprintf("repos/%v/%v/dependabot/alerts", owner, repo) return s.listAlerts(ctx, url, opts) @@ -112,7 +114,9 @@ func (s *DependabotService) ListRepoAlerts(ctx context.Context, owner, repo stri // ListOrgAlerts lists all Dependabot alerts of an organization. // -// GitHub API docs: https://docs.github.com/en/rest/dependabot/alerts#list-dependabot-alerts-for-an-organization +// GitHub API docs: https://docs.github.com/rest/dependabot/alerts#list-dependabot-alerts-for-an-organization +// +//meta:operation GET /orgs/{org}/dependabot/alerts func (s *DependabotService) ListOrgAlerts(ctx context.Context, org string, opts *ListAlertsOptions) ([]*DependabotAlert, *Response, error) { url := fmt.Sprintf("orgs/%v/dependabot/alerts", org) return s.listAlerts(ctx, url, opts) @@ -120,7 +124,9 @@ func (s *DependabotService) ListOrgAlerts(ctx context.Context, org string, opts // GetRepoAlert gets a single repository Dependabot alert. // -// GitHub API docs: https://docs.github.com/en/rest/dependabot/alerts#get-a-dependabot-alert +// GitHub API docs: https://docs.github.com/rest/dependabot/alerts#get-a-dependabot-alert +// +//meta:operation GET /repos/{owner}/{repo}/dependabot/alerts/{alert_number} func (s *DependabotService) GetRepoAlert(ctx context.Context, owner, repo string, number int) (*DependabotAlert, *Response, error) { url := fmt.Sprintf("repos/%v/%v/dependabot/alerts/%v", owner, repo, number) req, err := s.client.NewRequest("GET", url, nil) diff --git a/github/dependabot_secrets.go b/github/dependabot_secrets.go index 685f7bea8ea..e85c805a63f 100644 --- a/github/dependabot_secrets.go +++ b/github/dependabot_secrets.go @@ -27,7 +27,9 @@ func (s *DependabotService) getPublicKey(ctx context.Context, url string) (*Publ // GetRepoPublicKey gets a public key that should be used for Dependabot secret encryption. // -// GitHub API docs: https://docs.github.com/en/rest/dependabot/secrets#get-a-repository-public-key +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#get-a-repository-public-key +// +//meta:operation GET /repos/{owner}/{repo}/dependabot/secrets/public-key func (s *DependabotService) GetRepoPublicKey(ctx context.Context, owner, repo string) (*PublicKey, *Response, error) { url := fmt.Sprintf("repos/%v/%v/dependabot/secrets/public-key", owner, repo) return s.getPublicKey(ctx, url) @@ -35,7 +37,9 @@ func (s *DependabotService) GetRepoPublicKey(ctx context.Context, owner, repo st // GetOrgPublicKey gets a public key that should be used for Dependabot secret encryption. // -// GitHub API docs: https://docs.github.com/en/rest/dependabot/secrets#get-an-organization-public-key +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#get-an-organization-public-key +// +//meta:operation GET /orgs/{org}/dependabot/secrets/public-key func (s *DependabotService) GetOrgPublicKey(ctx context.Context, org string) (*PublicKey, *Response, error) { url := fmt.Sprintf("orgs/%v/dependabot/secrets/public-key", org) return s.getPublicKey(ctx, url) @@ -64,7 +68,9 @@ func (s *DependabotService) listSecrets(ctx context.Context, url string, opts *L // ListRepoSecrets lists all Dependabot secrets available in a repository // without revealing their encrypted values. // -// GitHub API docs: https://docs.github.com/en/rest/dependabot/secrets#list-repository-secrets +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#list-repository-secrets +// +//meta:operation GET /repos/{owner}/{repo}/dependabot/secrets func (s *DependabotService) ListRepoSecrets(ctx context.Context, owner, repo string, opts *ListOptions) (*Secrets, *Response, error) { url := fmt.Sprintf("repos/%v/%v/dependabot/secrets", owner, repo) return s.listSecrets(ctx, url, opts) @@ -73,7 +79,9 @@ func (s *DependabotService) ListRepoSecrets(ctx context.Context, owner, repo str // ListOrgSecrets lists all Dependabot secrets available in an organization // without revealing their encrypted values. // -// GitHub API docs: https://docs.github.com/en/rest/dependabot/secrets#list-organization-secrets +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#list-organization-secrets +// +//meta:operation GET /orgs/{org}/dependabot/secrets func (s *DependabotService) ListOrgSecrets(ctx context.Context, org string, opts *ListOptions) (*Secrets, *Response, error) { url := fmt.Sprintf("orgs/%v/dependabot/secrets", org) return s.listSecrets(ctx, url, opts) @@ -96,7 +104,9 @@ func (s *DependabotService) getSecret(ctx context.Context, url string) (*Secret, // GetRepoSecret gets a single repository Dependabot secret without revealing its encrypted value. // -// GitHub API docs: https://docs.github.com/en/rest/dependabot/secrets#get-a-repository-secret +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#get-a-repository-secret +// +//meta:operation GET /repos/{owner}/{repo}/dependabot/secrets/{secret_name} func (s *DependabotService) GetRepoSecret(ctx context.Context, owner, repo, name string) (*Secret, *Response, error) { url := fmt.Sprintf("repos/%v/%v/dependabot/secrets/%v", owner, repo, name) return s.getSecret(ctx, url) @@ -104,7 +114,9 @@ func (s *DependabotService) GetRepoSecret(ctx context.Context, owner, repo, name // GetOrgSecret gets a single organization Dependabot secret without revealing its encrypted value. // -// GitHub API docs: https://docs.github.com/en/rest/dependabot/secrets#get-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#get-an-organization-secret +// +//meta:operation GET /orgs/{org}/dependabot/secrets/{secret_name} func (s *DependabotService) GetOrgSecret(ctx context.Context, org, name string) (*Secret, *Response, error) { url := fmt.Sprintf("orgs/%v/dependabot/secrets/%v", org, name) return s.getSecret(ctx, url) @@ -134,7 +146,9 @@ func (s *DependabotService) putSecret(ctx context.Context, url string, eSecret * // CreateOrUpdateRepoSecret creates or updates a repository Dependabot secret with an encrypted value. // -// GitHub API docs: https://docs.github.com/en/rest/dependabot/secrets#create-or-update-a-repository-secret +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#create-or-update-a-repository-secret +// +//meta:operation PUT /repos/{owner}/{repo}/dependabot/secrets/{secret_name} func (s *DependabotService) CreateOrUpdateRepoSecret(ctx context.Context, owner, repo string, eSecret *DependabotEncryptedSecret) (*Response, error) { url := fmt.Sprintf("repos/%v/%v/dependabot/secrets/%v", owner, repo, eSecret.Name) return s.putSecret(ctx, url, eSecret) @@ -142,7 +156,9 @@ func (s *DependabotService) CreateOrUpdateRepoSecret(ctx context.Context, owner, // CreateOrUpdateOrgSecret creates or updates an organization Dependabot secret with an encrypted value. // -// GitHub API docs: https://docs.github.com/en/rest/dependabot/secrets#create-or-update-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#create-or-update-an-organization-secret +// +//meta:operation PUT /orgs/{org}/dependabot/secrets/{secret_name} func (s *DependabotService) CreateOrUpdateOrgSecret(ctx context.Context, org string, eSecret *DependabotEncryptedSecret) (*Response, error) { repoIDs := make([]string, len(eSecret.SelectedRepositoryIDs)) for i, secret := range eSecret.SelectedRepositoryIDs { @@ -176,7 +192,9 @@ func (s *DependabotService) deleteSecret(ctx context.Context, url string) (*Resp // DeleteRepoSecret deletes a Dependabot secret in a repository using the secret name. // -// GitHub API docs: https://docs.github.com/en/rest/dependabot/secrets#delete-a-repository-secret +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#delete-a-repository-secret +// +//meta:operation DELETE /repos/{owner}/{repo}/dependabot/secrets/{secret_name} func (s *DependabotService) DeleteRepoSecret(ctx context.Context, owner, repo, name string) (*Response, error) { url := fmt.Sprintf("repos/%v/%v/dependabot/secrets/%v", owner, repo, name) return s.deleteSecret(ctx, url) @@ -184,7 +202,9 @@ func (s *DependabotService) DeleteRepoSecret(ctx context.Context, owner, repo, n // DeleteOrgSecret deletes a Dependabot secret in an organization using the secret name. // -// GitHub API docs: https://docs.github.com/en/rest/dependabot/secrets#delete-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#delete-an-organization-secret +// +//meta:operation DELETE /orgs/{org}/dependabot/secrets/{secret_name} func (s *DependabotService) DeleteOrgSecret(ctx context.Context, org, name string) (*Response, error) { url := fmt.Sprintf("orgs/%v/dependabot/secrets/%v", org, name) return s.deleteSecret(ctx, url) @@ -192,7 +212,9 @@ func (s *DependabotService) DeleteOrgSecret(ctx context.Context, org, name strin // ListSelectedReposForOrgSecret lists all repositories that have access to a Dependabot secret. // -// GitHub API docs: https://docs.github.com/en/rest/dependabot/secrets#list-selected-repositories-for-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#list-selected-repositories-for-an-organization-secret +// +//meta:operation GET /orgs/{org}/dependabot/secrets/{secret_name}/repositories func (s *DependabotService) ListSelectedReposForOrgSecret(ctx context.Context, org, name string, opts *ListOptions) (*SelectedReposList, *Response, error) { url := fmt.Sprintf("orgs/%v/dependabot/secrets/%v/repositories", org, name) u, err := addOptions(url, opts) @@ -219,7 +241,9 @@ type DependabotSecretsSelectedRepoIDs []int64 // SetSelectedReposForOrgSecret sets the repositories that have access to a Dependabot secret. // -// GitHub API docs: https://docs.github.com/en/rest/dependabot/secrets#set-selected-repositories-for-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#set-selected-repositories-for-an-organization-secret +// +//meta:operation PUT /orgs/{org}/dependabot/secrets/{secret_name}/repositories func (s *DependabotService) SetSelectedReposForOrgSecret(ctx context.Context, org, name string, ids DependabotSecretsSelectedRepoIDs) (*Response, error) { url := fmt.Sprintf("orgs/%v/dependabot/secrets/%v/repositories", org, name) type repoIDs struct { @@ -236,7 +260,9 @@ func (s *DependabotService) SetSelectedReposForOrgSecret(ctx context.Context, or // AddSelectedRepoToOrgSecret adds a repository to an organization Dependabot secret. // -// GitHub API docs: https://docs.github.com/en/rest/dependabot/secrets#add-selected-repository-to-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#add-selected-repository-to-an-organization-secret +// +//meta:operation PUT /orgs/{org}/dependabot/secrets/{secret_name}/repositories/{repository_id} func (s *DependabotService) AddSelectedRepoToOrgSecret(ctx context.Context, org, name string, repo *Repository) (*Response, error) { url := fmt.Sprintf("orgs/%v/dependabot/secrets/%v/repositories/%v", org, name, *repo.ID) req, err := s.client.NewRequest("PUT", url, nil) @@ -249,7 +275,9 @@ func (s *DependabotService) AddSelectedRepoToOrgSecret(ctx context.Context, org, // RemoveSelectedRepoFromOrgSecret removes a repository from an organization Dependabot secret. // -// GitHub API docs: https://docs.github.com/en/rest/dependabot/secrets#remove-selected-repository-from-an-organization-secret +// GitHub API docs: https://docs.github.com/rest/dependabot/secrets#remove-selected-repository-from-an-organization-secret +// +//meta:operation DELETE /orgs/{org}/dependabot/secrets/{secret_name}/repositories/{repository_id} func (s *DependabotService) RemoveSelectedRepoFromOrgSecret(ctx context.Context, org, name string, repo *Repository) (*Response, error) { url := fmt.Sprintf("orgs/%v/dependabot/secrets/%v/repositories/%v", org, name, *repo.ID) req, err := s.client.NewRequest("DELETE", url, nil) diff --git a/github/dependency_graph.go b/github/dependency_graph.go index e578965cc12..86a1fe48b98 100644 --- a/github/dependency_graph.go +++ b/github/dependency_graph.go @@ -61,7 +61,9 @@ func (s SBOM) String() string { // GetSBOM fetches the software bill of materials for a repository. // -// GitHub API docs: https://docs.github.com/en/rest/dependency-graph/sboms +// GitHub API docs: https://docs.github.com/rest/dependency-graph/sboms#export-a-software-bill-of-materials-sbom-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/dependency-graph/sbom func (s *DependencyGraphService) GetSBOM(ctx context.Context, owner, repo string) (*SBOM, *Response, error) { u := fmt.Sprintf("repos/%v/%v/dependency-graph/sbom", owner, repo) diff --git a/github/doc.go b/github/doc.go index 4a9aa95c3af..b10810d5338 100644 --- a/github/doc.go +++ b/github/doc.go @@ -29,7 +29,7 @@ Some API methods have optional parameters that can be passed. For example: The services of a client divide the API into logical chunks and correspond to the structure of the GitHub API documentation at -https://docs.github.com/en/rest . +https://docs.github.com/rest . NOTE: Using the https://godoc.org/context package, one can easily pass cancelation signals and deadlines to various services of the client for @@ -119,7 +119,7 @@ For secondary rate limits, you can check if its type is *github.AbuseRateLimitEr } Learn more about GitHub rate limiting at -https://docs.github.com/en/rest/rate-limit . +https://docs.github.com/rest/rate-limit . # Accepted Status @@ -145,7 +145,7 @@ instead designed to work with a caching http.Transport. We recommend using https://github.com/gregjones/httpcache for that. Learn more about GitHub conditional requests at -https://docs.github.com/en/rest/overview/resources-in-the-rest-api#conditional-requests. +https://docs.github.com/rest/overview/resources-in-the-rest-api#conditional-requests. # Creating and Updating Resources diff --git a/github/emojis.go b/github/emojis.go index 5a2c86baa38..93ef232f6c7 100644 --- a/github/emojis.go +++ b/github/emojis.go @@ -15,6 +15,8 @@ type EmojisService service // List returns the emojis available to use on GitHub. // // GitHub API docs: https://docs.github.com/rest/emojis/emojis#get-emojis +// +//meta:operation GET /emojis func (s *EmojisService) List(ctx context.Context) (map[string]string, *Response, error) { req, err := s.client.NewRequest("GET", "emojis", nil) if err != nil { diff --git a/github/enterprise.go b/github/enterprise.go index 1c9b0695669..2036f8bc75d 100644 --- a/github/enterprise.go +++ b/github/enterprise.go @@ -8,5 +8,5 @@ package github // EnterpriseService provides access to the enterprise related functions // in the GitHub API. // -// GitHub API docs: https://docs.github.com/en/rest/enterprise-admin/ +// GitHub API docs: https://docs.github.com/rest/enterprise-admin/ type EnterpriseService service diff --git a/github/enterprise_actions_runner_groups.go b/github/enterprise_actions_runner_groups.go index b6bb70dae40..f171df75734 100644 --- a/github/enterprise_actions_runner_groups.go +++ b/github/enterprise_actions_runner_groups.go @@ -79,7 +79,9 @@ type ListEnterpriseRunnerGroupOptions struct { // ListRunnerGroups lists all self-hosted runner groups configured in an enterprise. // -// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#list-self-hosted-runner-groups-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#list-self-hosted-runner-groups-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/runner-groups func (s *EnterpriseService) ListRunnerGroups(ctx context.Context, enterprise string, opts *ListEnterpriseRunnerGroupOptions) (*EnterpriseRunnerGroups, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runner-groups", enterprise) u, err := addOptions(u, opts) @@ -103,7 +105,9 @@ func (s *EnterpriseService) ListRunnerGroups(ctx context.Context, enterprise str // GetEnterpriseRunnerGroup gets a specific self-hosted runner group for an enterprise using its RunnerGroup ID. // -// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#get-a-self-hosted-runner-group-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#get-a-self-hosted-runner-group-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/runner-groups/{runner_group_id} func (s *EnterpriseService) GetEnterpriseRunnerGroup(ctx context.Context, enterprise string, groupID int64) (*EnterpriseRunnerGroup, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v", enterprise, groupID) req, err := s.client.NewRequest("GET", u, nil) @@ -122,7 +126,9 @@ func (s *EnterpriseService) GetEnterpriseRunnerGroup(ctx context.Context, enterp // DeleteEnterpriseRunnerGroup deletes a self-hosted runner group from an enterprise. // -// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#delete-a-self-hosted-runner-group-from-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#delete-a-self-hosted-runner-group-from-an-enterprise +// +//meta:operation DELETE /enterprises/{enterprise}/actions/runner-groups/{runner_group_id} func (s *EnterpriseService) DeleteEnterpriseRunnerGroup(ctx context.Context, enterprise string, groupID int64) (*Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v", enterprise, groupID) @@ -136,7 +142,9 @@ func (s *EnterpriseService) DeleteEnterpriseRunnerGroup(ctx context.Context, ent // CreateEnterpriseRunnerGroup creates a new self-hosted runner group for an enterprise. // -// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#create-a-self-hosted-runner-group-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#create-a-self-hosted-runner-group-for-an-enterprise +// +//meta:operation POST /enterprises/{enterprise}/actions/runner-groups func (s *EnterpriseService) CreateEnterpriseRunnerGroup(ctx context.Context, enterprise string, createReq CreateEnterpriseRunnerGroupRequest) (*EnterpriseRunnerGroup, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runner-groups", enterprise) req, err := s.client.NewRequest("POST", u, createReq) @@ -155,7 +163,9 @@ func (s *EnterpriseService) CreateEnterpriseRunnerGroup(ctx context.Context, ent // UpdateEnterpriseRunnerGroup updates a self-hosted runner group for an enterprise. // -// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#update-a-self-hosted-runner-group-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#update-a-self-hosted-runner-group-for-an-enterprise +// +//meta:operation PATCH /enterprises/{enterprise}/actions/runner-groups/{runner_group_id} func (s *EnterpriseService) UpdateEnterpriseRunnerGroup(ctx context.Context, enterprise string, groupID int64, updateReq UpdateEnterpriseRunnerGroupRequest) (*EnterpriseRunnerGroup, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v", enterprise, groupID) req, err := s.client.NewRequest("PATCH", u, updateReq) @@ -174,7 +184,9 @@ func (s *EnterpriseService) UpdateEnterpriseRunnerGroup(ctx context.Context, ent // ListOrganizationAccessRunnerGroup lists the organizations with access to a self-hosted runner group configured in an enterprise. // -// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#list-organization-access-to-a-self-hosted-runner-group-in-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#list-organization-access-to-a-self-hosted-runner-group-in-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations func (s *EnterpriseService) ListOrganizationAccessRunnerGroup(ctx context.Context, enterprise string, groupID int64, opts *ListOptions) (*ListOrganizations, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v/organizations", enterprise, groupID) u, err := addOptions(u, opts) @@ -199,7 +211,9 @@ func (s *EnterpriseService) ListOrganizationAccessRunnerGroup(ctx context.Contex // SetOrganizationAccessRunnerGroup replaces the list of organizations that have access to a self-hosted runner group configured in an enterprise // with a new List of organizations. // -// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#set-organization-access-for-a-self-hosted-runner-group-in-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#set-organization-access-for-a-self-hosted-runner-group-in-an-enterprise +// +//meta:operation PUT /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations func (s *EnterpriseService) SetOrganizationAccessRunnerGroup(ctx context.Context, enterprise string, groupID int64, ids SetOrgAccessRunnerGroupRequest) (*Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v/organizations", enterprise, groupID) @@ -214,7 +228,9 @@ func (s *EnterpriseService) SetOrganizationAccessRunnerGroup(ctx context.Context // AddOrganizationAccessRunnerGroup adds an organization to the list of selected organizations that can access a self-hosted runner group. // The runner group must have visibility set to 'selected'. // -// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#add-organization-access-to-a-self-hosted-runner-group-in-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#add-organization-access-to-a-self-hosted-runner-group-in-an-enterprise +// +//meta:operation PUT /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations/{org_id} func (s *EnterpriseService) AddOrganizationAccessRunnerGroup(ctx context.Context, enterprise string, groupID, orgID int64) (*Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v/organizations/%v", enterprise, groupID, orgID) @@ -229,7 +245,9 @@ func (s *EnterpriseService) AddOrganizationAccessRunnerGroup(ctx context.Context // RemoveOrganizationAccessRunnerGroup removes an organization from the list of selected organizations that can access a self-hosted runner group. // The runner group must have visibility set to 'selected'. // -// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#remove-organization-access-to-a-self-hosted-runner-group-in-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#remove-organization-access-to-a-self-hosted-runner-group-in-an-enterprise +// +//meta:operation DELETE /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations/{org_id} func (s *EnterpriseService) RemoveOrganizationAccessRunnerGroup(ctx context.Context, enterprise string, groupID, orgID int64) (*Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v/organizations/%v", enterprise, groupID, orgID) @@ -243,7 +261,9 @@ func (s *EnterpriseService) RemoveOrganizationAccessRunnerGroup(ctx context.Cont // ListRunnerGroupRunners lists self-hosted runners that are in a specific enterprise group. // -// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#list-self-hosted-runners-in-a-group-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#list-self-hosted-runners-in-a-group-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners func (s *EnterpriseService) ListRunnerGroupRunners(ctx context.Context, enterprise string, groupID int64, opts *ListOptions) (*Runners, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v/runners", enterprise, groupID) u, err := addOptions(u, opts) @@ -268,7 +288,9 @@ func (s *EnterpriseService) ListRunnerGroupRunners(ctx context.Context, enterpri // SetRunnerGroupRunners replaces the list of self-hosted runners that are part of an enterprise runner group // with a new list of runners. // -// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#set-self-hosted-runners-in-a-group-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#set-self-hosted-runners-in-a-group-for-an-enterprise +// +//meta:operation PUT /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners func (s *EnterpriseService) SetRunnerGroupRunners(ctx context.Context, enterprise string, groupID int64, ids SetRunnerGroupRunnersRequest) (*Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v/runners", enterprise, groupID) @@ -282,7 +304,9 @@ func (s *EnterpriseService) SetRunnerGroupRunners(ctx context.Context, enterpris // AddRunnerGroupRunners adds a self-hosted runner to a runner group configured in an enterprise. // -// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#add-a-self-hosted-runner-to-a-group-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#add-a-self-hosted-runner-to-a-group-for-an-enterprise +// +//meta:operation PUT /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners/{runner_id} func (s *EnterpriseService) AddRunnerGroupRunners(ctx context.Context, enterprise string, groupID, runnerID int64) (*Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v/runners/%v", enterprise, groupID, runnerID) @@ -297,7 +321,9 @@ func (s *EnterpriseService) AddRunnerGroupRunners(ctx context.Context, enterpris // RemoveRunnerGroupRunners removes a self-hosted runner from a group configured in an enterprise. // The runner is then returned to the default group. // -// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#remove-a-self-hosted-runner-from-a-group-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups#remove-a-self-hosted-runner-from-a-group-for-an-enterprise +// +//meta:operation DELETE /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners/{runner_id} func (s *EnterpriseService) RemoveRunnerGroupRunners(ctx context.Context, enterprise string, groupID, runnerID int64) (*Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runner-groups/%v/runners/%v", enterprise, groupID, runnerID) diff --git a/github/enterprise_actions_runners.go b/github/enterprise_actions_runners.go index 6fc30d50258..4a6e6b52c10 100644 --- a/github/enterprise_actions_runners.go +++ b/github/enterprise_actions_runners.go @@ -12,7 +12,9 @@ import ( // ListRunnerApplicationDownloads lists self-hosted runner application binaries that can be downloaded and run. // -// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runners#list-runner-applications-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runners#list-runner-applications-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/runners/downloads func (s *EnterpriseService) ListRunnerApplicationDownloads(ctx context.Context, enterprise string) ([]*RunnerApplicationDownload, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runners/downloads", enterprise) req, err := s.client.NewRequest("GET", u, nil) @@ -31,7 +33,9 @@ func (s *EnterpriseService) ListRunnerApplicationDownloads(ctx context.Context, // GenerateEnterpriseJITConfig generates a just-in-time configuration for an enterprise. // -// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runners?apiVersion=2022-11-28#create-configuration-for-a-just-in-time-runner-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runners#create-configuration-for-a-just-in-time-runner-for-an-enterprise +// +//meta:operation POST /enterprises/{enterprise}/actions/runners/generate-jitconfig func (s *EnterpriseService) GenerateEnterpriseJITConfig(ctx context.Context, enterprise string, request *GenerateJITConfigRequest) (*JITRunnerConfig, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runners/generate-jitconfig", enterprise) @@ -51,7 +55,9 @@ func (s *EnterpriseService) GenerateEnterpriseJITConfig(ctx context.Context, ent // CreateRegistrationToken creates a token that can be used to add a self-hosted runner. // -// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runners#create-a-registration-token-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runners#create-a-registration-token-for-an-enterprise +// +//meta:operation POST /enterprises/{enterprise}/actions/runners/registration-token func (s *EnterpriseService) CreateRegistrationToken(ctx context.Context, enterprise string) (*RegistrationToken, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runners/registration-token", enterprise) @@ -71,7 +77,9 @@ func (s *EnterpriseService) CreateRegistrationToken(ctx context.Context, enterpr // ListRunners lists all the self-hosted runners for a enterprise. // -// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runners#list-self-hosted-runners-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runners#list-self-hosted-runners-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/runners func (s *EnterpriseService) ListRunners(ctx context.Context, enterprise string, opts *ListOptions) (*Runners, *Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runners", enterprise) u, err := addOptions(u, opts) @@ -95,7 +103,9 @@ func (s *EnterpriseService) ListRunners(ctx context.Context, enterprise string, // RemoveRunner forces the removal of a self-hosted runner from an enterprise using the runner id. // -// GitHub API docs: https://docs.github.com/en/rest/actions/self-hosted-runners#delete-a-self-hosted-runner-from-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/self-hosted-runners#delete-a-self-hosted-runner-from-an-enterprise +// +//meta:operation DELETE /enterprises/{enterprise}/actions/runners/{runner_id} func (s *EnterpriseService) RemoveRunner(ctx context.Context, enterprise string, runnerID int64) (*Response, error) { u := fmt.Sprintf("enterprises/%v/actions/runners/%v", enterprise, runnerID) diff --git a/github/enterprise_audit_log.go b/github/enterprise_audit_log.go index 40648673385..058a7d17786 100644 --- a/github/enterprise_audit_log.go +++ b/github/enterprise_audit_log.go @@ -12,7 +12,9 @@ import ( // GetAuditLog gets the audit-log entries for an organization. // -// GitHub API docs: https://docs.github.com/en/rest/enterprise-admin/audit-log#get-the-audit-log-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/audit-log#get-the-audit-log-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/audit-log func (s *EnterpriseService) GetAuditLog(ctx context.Context, enterprise string, opts *GetAuditLogOptions) ([]*AuditEntry, *Response, error) { u := fmt.Sprintf("enterprises/%v/audit-log", enterprise) u, err := addOptions(u, opts) diff --git a/github/enterprise_code_security_and_analysis.go b/github/enterprise_code_security_and_analysis.go index 3980a86aa4b..af8eb0ffb2f 100644 --- a/github/enterprise_code_security_and_analysis.go +++ b/github/enterprise_code_security_and_analysis.go @@ -20,7 +20,9 @@ type EnterpriseSecurityAnalysisSettings struct { // GetCodeSecurityAndAnalysis gets code security and analysis features for an enterprise. // -// GitHub API docs: https://docs.github.com/en/rest/enterprise-admin/code-security-and-analysis?apiVersion=2022-11-28#get-code-security-and-analysis-features-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/code-security-and-analysis#get-code-security-and-analysis-features-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/code_security_and_analysis func (s *EnterpriseService) GetCodeSecurityAndAnalysis(ctx context.Context, enterprise string) (*EnterpriseSecurityAnalysisSettings, *Response, error) { u := fmt.Sprintf("enterprises/%v/code_security_and_analysis", enterprise) @@ -40,7 +42,9 @@ func (s *EnterpriseService) GetCodeSecurityAndAnalysis(ctx context.Context, ente // UpdateCodeSecurityAndAnalysis updates code security and analysis features for new repositories in an enterprise. // -// GitHub API docs: https://docs.github.com/en/rest/enterprise-admin/code-security-and-analysis?apiVersion=2022-11-28#update-code-security-and-analysis-features-for-an-enterprise +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/code-security-and-analysis#update-code-security-and-analysis-features-for-an-enterprise +// +//meta:operation PATCH /enterprises/{enterprise}/code_security_and_analysis func (s *EnterpriseService) UpdateCodeSecurityAndAnalysis(ctx context.Context, enterprise string, settings *EnterpriseSecurityAnalysisSettings) (*Response, error) { u := fmt.Sprintf("enterprises/%v/code_security_and_analysis", enterprise) req, err := s.client.NewRequest("PATCH", u, settings) @@ -61,7 +65,9 @@ func (s *EnterpriseService) UpdateCodeSecurityAndAnalysis(ctx context.Context, e // Valid values for securityProduct: "advanced_security", "secret_scanning", "secret_scanning_push_protection". // Valid values for enablement: "enable_all", "disable_all". // -// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/enterprise-admin/code-security-and-analysis?apiVersion=2022-11-28#enable-or-disable-a-security-feature +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/code-security-and-analysis#enable-or-disable-a-security-feature +// +//meta:operation POST /enterprises/{enterprise}/{security_product}/{enablement} func (s *EnterpriseService) EnableDisableSecurityFeature(ctx context.Context, enterprise, securityProduct, enablement string) (*Response, error) { u := fmt.Sprintf("enterprises/%v/%v/%v", enterprise, securityProduct, enablement) req, err := s.client.NewRequest("POST", u, nil) diff --git a/github/event_types.go b/github/event_types.go index c270f6bcf0a..6ff1eb84851 100644 --- a/github/event_types.go +++ b/github/event_types.go @@ -18,7 +18,7 @@ type RequestedAction struct { // BranchProtectionRuleEvent triggered when a check suite is "created", "edited", or "deleted". // The Webhook event name is "branch_protection_rule". // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#branch_protection_rule +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#branch_protection_rule type BranchProtectionRuleEvent struct { Action *string `json:"action,omitempty"` Rule *BranchProtectionRule `json:"rule,omitempty"` @@ -32,7 +32,7 @@ type BranchProtectionRuleEvent struct { // CheckRunEvent is triggered when a check run is "created", "completed", or "rerequested". // The Webhook event name is "check_run". // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#check_run +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#check_run type CheckRunEvent struct { CheckRun *CheckRun `json:"check_run,omitempty"` // The action performed. Possible values are: "created", "completed", "rerequested" or "requested_action". @@ -51,7 +51,7 @@ type CheckRunEvent struct { // CheckSuiteEvent is triggered when a check suite is "completed", "requested", or "rerequested". // The Webhook event name is "check_suite". // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#check_suite +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#check_suite type CheckSuiteEvent struct { CheckSuite *CheckSuite `json:"check_suite,omitempty"` // The action performed. Possible values are: "completed", "requested" or "rerequested". @@ -67,7 +67,7 @@ type CheckSuiteEvent struct { // CommitCommentEvent is triggered when a commit comment is created. // The Webhook event name is "commit_comment". // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#commit_comment +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#commit_comment type CommitCommentEvent struct { Comment *RepositoryComment `json:"comment,omitempty"` @@ -103,7 +103,7 @@ type ContentReferenceEvent struct { // Additionally, webhooks will not receive this event for tags if more // than three tags are pushed at once. // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/github-event-types#createevent +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/github-event-types#createevent type CreateEvent struct { Ref *string `json:"ref,omitempty"` // RefType is the object that was created. Possible values are: "repository", "branch", "tag". @@ -125,7 +125,7 @@ type CreateEvent struct { // Note: webhooks will not receive this event for tags if more than three tags // are deleted at once. // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/github-event-types#deleteevent +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/github-event-types#deleteevent type DeleteEvent struct { Ref *string `json:"ref,omitempty"` // RefType is the object that was deleted. Possible values are: "branch", "tag". @@ -145,7 +145,7 @@ type DeleteEvent struct { // DependabotAlertEvent is triggered when there is activity relating to Dependabot alerts. // The Webhook event name is "dependabot_alert". // -// GitHub API docs: https://docs.github.com/en/webhooks-and-events/webhooks/webhook-events-and-payloads#dependabot_alert +// GitHub API docs: https://docs.github.com/webhooks-and-events/webhooks/webhook-events-and-payloads#dependabot_alert type DependabotAlertEvent struct { Action *string `json:"action,omitempty"` Alert *DependabotAlert `json:"alert,omitempty"` @@ -164,7 +164,7 @@ type DependabotAlertEvent struct { // DeployKeyEvent is triggered when a deploy key is added or removed from a repository. // The Webhook event name is "deploy_key". // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#deploy_key +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#deploy_key type DeployKeyEvent struct { // Action is the action that was performed. Possible values are: // "created" or "deleted". @@ -190,7 +190,7 @@ type DeployKeyEvent struct { // // Events of this type are not visible in timelines, they are only used to trigger hooks. // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#deployment +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#deployment type DeploymentEvent struct { Deployment *Deployment `json:"deployment,omitempty"` Repo *Repository `json:"repository,omitempty"` @@ -230,7 +230,7 @@ type DeploymentProtectionRuleEvent struct { // // Events of this type are not visible in timelines, they are only used to trigger hooks. // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#deployment_status +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#deployment_status type DeploymentStatusEvent struct { Deployment *Deployment `json:"deployment,omitempty"` DeploymentStatus *DeploymentStatus `json:"deployment_status,omitempty"` @@ -281,7 +281,7 @@ type CommentDiscussion struct { // DiscussionEvent represents a webhook event for a discussion. // The Webhook event name is "discussion". // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#discussion +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#discussion type DiscussionEvent struct { // Action is the action that was performed. Possible values are: // created, edited, deleted, pinned, unpinned, locked, unlocked, @@ -334,7 +334,7 @@ type DiscussionCategory struct { // ForkEvent is triggered when a user forks a repository. // The Webhook event name is "fork". // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#fork +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#fork type ForkEvent struct { // Forkee is the created repository. Forkee *Repository `json:"forkee,omitempty"` @@ -348,7 +348,7 @@ type ForkEvent struct { // GitHubAppAuthorizationEvent is triggered when a user's authorization for a // GitHub Application is revoked. // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#github_app_authorization +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#github_app_authorization type GitHubAppAuthorizationEvent struct { // The action performed. Possible value is: "revoked". Action *string `json:"action,omitempty"` @@ -371,7 +371,7 @@ type Page struct { // GollumEvent is triggered when a Wiki page is created or updated. // The Webhook event name is "gollum". // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#gollum +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#gollum type GollumEvent struct { Pages []*Page `json:"pages,omitempty"` @@ -522,7 +522,7 @@ type TeamPermissionsFrom struct { // or new permissions have been accepted. // The Webhook event name is "installation". // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#installation +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#installation type InstallationEvent struct { // The action that was performed. Can be either "created", "deleted", "suspend", "unsuspend" or "new_permissions_accepted". Action *string `json:"action,omitempty"` @@ -539,7 +539,7 @@ type InstallationEvent struct { // InstallationRepositoriesEvent is triggered when a repository is added or // removed from an installation. The Webhook event name is "installation_repositories". // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#installation_repositories +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#installation_repositories type InstallationRepositoriesEvent struct { // The action that was performed. Can be either "added" or "removed". Action *string `json:"action,omitempty"` @@ -573,7 +573,7 @@ type InstallationChanges struct { // InstallationTargetEvent is triggered when there is activity on an installation from a user or organization account. // The Webhook event name is "installation_target". // -// GitHub API docs: https://docs.github.com/en/webhooks-and-events/webhooks/webhook-events-and-payloads#installation_target +// GitHub API docs: https://docs.github.com/webhooks-and-events/webhooks/webhook-events-and-payloads#installation_target type InstallationTargetEvent struct { Account *User `json:"account,omitempty"` Action *string `json:"action,omitempty"` @@ -590,7 +590,7 @@ type InstallationTargetEvent struct { // or pull request. // The Webhook event name is "issue_comment". // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#issue_comment +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#issue_comment type IssueCommentEvent struct { // Action is the action that was performed on the comment. // Possible values are: "created", "edited", "deleted". @@ -614,7 +614,7 @@ type IssueCommentEvent struct { // locked, unlocked, milestoned, or demilestoned. // The Webhook event name is "issues". // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#issues +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#issues type IssuesEvent struct { // Action is the action that was performed. Possible values are: "opened", // "edited", "deleted", "transferred", "pinned", "unpinned", "closed", "reopened", @@ -640,7 +640,7 @@ type IssuesEvent struct { // LabelEvent is triggered when a repository's label is created, edited, or deleted. // The Webhook event name is "label" // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#label +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#label type LabelEvent struct { // Action is the action that was performed. Possible values are: // "created", "edited", "deleted" @@ -659,7 +659,7 @@ type LabelEvent struct { // their GitHub Marketplace plan. // Webhook event name "marketplace_purchase". // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#marketplace_purchase +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#marketplace_purchase type MarketplacePurchaseEvent struct { // Action is the action that was performed. Possible values are: // "purchased", "cancelled", "pending_change", "pending_change_cancelled", "changed". @@ -680,7 +680,7 @@ type MarketplacePurchaseEvent struct { // MemberEvent is triggered when a user is added as a collaborator to a repository. // The Webhook event name is "member". // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#member +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#member type MemberEvent struct { // Action is the action that was performed. Possible value is: "added". Action *string `json:"action,omitempty"` @@ -702,7 +702,7 @@ type MemberEvent struct { // Events of this type are not visible in timelines, they are only used to // trigger organization webhooks. // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#membership +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#membership type MembershipEvent struct { // Action is the action that was performed. Possible values are: "added", "removed". Action *string `json:"action,omitempty"` @@ -734,7 +734,7 @@ type MergeGroup struct { // MergeGroupEvent represents activity related to merge groups in a merge queue. The type of activity is specified // in the action property of the payload object. // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#merge_group +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#merge_group type MergeGroupEvent struct { // The action that was performed. Currently, can only be checks_requested. Action *string `json:"action,omitempty"` @@ -753,7 +753,7 @@ type MergeGroupEvent struct { // Therefore, it must be selected for each hook that you'd like to receive meta events for. // The Webhook event name is "meta". // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#meta +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#meta type MetaEvent struct { // Action is the action that was performed. Possible value is: "deleted". Action *string `json:"action,omitempty"` @@ -774,7 +774,7 @@ type MetaEvent struct { // MilestoneEvent is triggered when a milestone is created, closed, opened, edited, or deleted. // The Webhook event name is "milestone". // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#milestone +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#milestone type MilestoneEvent struct { // Action is the action that was performed. Possible values are: // "created", "closed", "opened", "edited", "deleted" @@ -794,7 +794,7 @@ type MilestoneEvent struct { // Events of this type are not visible in timelines. These events are only used to trigger organization hooks. // Webhook event name is "organization". // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#organization +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#organization type OrganizationEvent struct { // Action is the action that was performed. // Possible values are: "deleted", "renamed", "member_added", "member_removed", or "member_invited". @@ -815,7 +815,7 @@ type OrganizationEvent struct { // OrgBlockEvent is triggered when an organization blocks or unblocks a user. // The Webhook event name is "org_block". // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#org_block +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#org_block type OrgBlockEvent struct { // Action is the action that was performed. // Can be "blocked" or "unblocked". @@ -856,7 +856,7 @@ type PackageEvent struct { // // Events of this type are not visible in timelines, they are only used to trigger hooks. // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#page_build +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#page_build type PageBuildEvent struct { Build *PagesBuild `json:"build,omitempty"` @@ -876,7 +876,7 @@ type PageBuildEvent struct { // belong to a resource owner that requires approval for token access. // The webhook event name is "personal_access_token_request". // -// GitHub API docs: https://docs.github.com/en/webhooks-and-events/webhooks/webhook-events-and-payloads#personal_access_token_request +// GitHub API docs: https://docs.github.com/webhooks-and-events/webhooks/webhook-events-and-payloads#personal_access_token_request type PersonalAccessTokenRequestEvent struct { // Action is the action that was performed. Possible values are: // "approved", "cancelled", "created" or "denied" @@ -964,7 +964,7 @@ type PingEvent struct { // ProjectEvent is triggered when project is created, modified or deleted. // The webhook event name is "project". // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#project +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#project type ProjectEvent struct { Action *string `json:"action,omitempty"` Changes *ProjectChange `json:"changes,omitempty"` @@ -980,7 +980,7 @@ type ProjectEvent struct { // ProjectCardEvent is triggered when a project card is created, updated, moved, converted to an issue, or deleted. // The webhook event name is "project_card". // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#project_card +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#project_card type ProjectCardEvent struct { Action *string `json:"action,omitempty"` Changes *ProjectCardChange `json:"changes,omitempty"` @@ -997,7 +997,7 @@ type ProjectCardEvent struct { // ProjectColumnEvent is triggered when a project column is created, updated, moved, or deleted. // The webhook event name is "project_column". // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#project_column +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#project_column type ProjectColumnEvent struct { Action *string `json:"action,omitempty"` Changes *ProjectColumnChange `json:"changes,omitempty"` @@ -1014,7 +1014,7 @@ type ProjectColumnEvent struct { // ProjectV2Event is triggered when there is activity relating to an organization-level project. // The Webhook event name is "projects_v2". // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#projects_v2 +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#projects_v2 type ProjectV2Event struct { Action *string `json:"action,omitempty"` ProjectsV2 *ProjectsV2 `json:"projects_v2,omitempty"` @@ -1046,7 +1046,7 @@ type ProjectsV2 struct { // ProjectV2ItemEvent is triggered when there is activity relating to an item on an organization-level project. // The Webhook event name is "projects_v2_item". // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#projects_v2_item +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#projects_v2_item type ProjectV2ItemEvent struct { Action *string `json:"action,omitempty"` Changes *ProjectV2ItemChange `json:"changes,omitempty"` @@ -1086,7 +1086,7 @@ type ProjectV2Item struct { // According to GitHub: "Without a doubt: the best GitHub event." // The Webhook event name is "public". // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#public +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#public type PublicEvent struct { // The following fields are only populated by Webhook events. Repo *Repository `json:"repository,omitempty"` @@ -1103,7 +1103,7 @@ type PublicEvent struct { // locked, unlocked, a pull request review is requested, or a review request is removed. // The Webhook event name is "pull_request". // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/github-event-types#pullrequestevent +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/github-event-types#pullrequestevent type PullRequestEvent struct { // Action is the action that was performed. Possible values are: // "assigned", "unassigned", "review_requested", "review_request_removed", "labeled", "unlabeled", @@ -1147,7 +1147,7 @@ type PullRequestEvent struct { // request. // The Webhook event name is "pull_request_review". // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#pull_request_review +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#pull_request_review type PullRequestReviewEvent struct { // Action is always "submitted". Action *string `json:"action,omitempty"` @@ -1168,7 +1168,7 @@ type PullRequestReviewEvent struct { // portion of the unified diff of a pull request. // The Webhook event name is "pull_request_review_comment". // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#pull_request_review_comment +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#pull_request_review_comment type PullRequestReviewCommentEvent struct { // Action is the action that was performed on the comment. // Possible values are: "created", "edited", "deleted". @@ -1191,7 +1191,7 @@ type PullRequestReviewCommentEvent struct { // review of a pull request is marked resolved or unresolved. // The Webhook event name is "pull_request_review_thread". // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#pull_request_review_thread +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#pull_request_review_thread type PullRequestReviewThreadEvent struct { // Action is the action that was performed on the comment. // Possible values are: "resolved", "unresolved". @@ -1214,7 +1214,7 @@ type PullRequestReviewThreadEvent struct { // locked, unlocked, a pull request review is requested, or a review request is removed. // The Webhook event name is "pull_request_target". // -// GitHub API docs: https://docs.github.com/en/actions/events-that-trigger-workflows#pull_request_target +// GitHub API docs: https://docs.github.com/actions/events-that-trigger-workflows#pull_request_target type PullRequestTargetEvent struct { // Action is the action that was performed. Possible values are: // "assigned", "unassigned", "labeled", "unlabeled", "opened", "edited", "closed", "reopened", @@ -1256,7 +1256,7 @@ type PullRequestTargetEvent struct { // PushEvent represents a git push to a GitHub repository. // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#push +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#push type PushEvent struct { PushID *int64 `json:"push_id,omitempty"` Head *string `json:"head,omitempty"` @@ -1364,7 +1364,7 @@ type PushEventRepoOwner struct { // edited, deleted, or prereleased. // The Webhook event name is "release". // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#release +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#release type ReleaseEvent struct { // Action is the action that was performed. Possible values are: "published", "unpublished", // "created", "edited", "deleted", or "prereleased". @@ -1389,7 +1389,7 @@ type ReleaseEvent struct { // Events of this type are not visible in timelines, they are only used to // trigger organization webhooks. // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#repository +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#repository type RepositoryEvent struct { // Action is the action that was performed. Possible values are: "created", // "deleted" (organization hooks only), "archived", "unarchived", "edited", "renamed", @@ -1406,7 +1406,7 @@ type RepositoryEvent struct { // RepositoryDispatchEvent is triggered when a client sends a POST request to the repository dispatch event endpoint. // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#repository_dispatch +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#repository_dispatch type RepositoryDispatchEvent struct { // Action is the event_type that submitted with the repository dispatch payload. Value can be any string. Action *string `json:"action,omitempty"` @@ -1422,7 +1422,7 @@ type RepositoryDispatchEvent struct { // RepositoryImportEvent represents the activity related to a repository being imported to GitHub. // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#repository_import +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#repository_import type RepositoryImportEvent struct { // Status represents the final state of the import. This can be one of "success", "cancelled", or "failure". Status *string `json:"status,omitempty"` @@ -1433,7 +1433,7 @@ type RepositoryImportEvent struct { // RepositoryVulnerabilityAlertEvent is triggered when a security alert is created, dismissed, or resolved. // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#repository_vulnerability_alert +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#repository_vulnerability_alert type RepositoryVulnerabilityAlertEvent struct { // Action is the action that was performed. Possible values are: "create", "dismiss", "resolve". Action *string `json:"action,omitempty"` @@ -1474,7 +1474,7 @@ type RepositoryVulnerabilityAlert struct { // SecretScanningAlertEvent is triggered when a secret scanning alert occurs in a repository. // The Webhook name is secret_scanning_alert. // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#secret_scanning_alert +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#secret_scanning_alert type SecretScanningAlertEvent struct { // Action is the action that was performed. Possible values are: "created", "resolved", or "reopened". Action *string `json:"action,omitempty"` @@ -1494,7 +1494,7 @@ type SecretScanningAlertEvent struct { // SecurityAndAnalysisEvent is triggered when code security and analysis features // are enabled or disabled for a repository. // -// GitHub API docs: https://docs.github.com/en/webhooks-and-events/webhooks/webhook-events-and-payloads#security_and_analysis +// GitHub API docs: https://docs.github.com/webhooks-and-events/webhooks/webhook-events-and-payloads#security_and_analysis type SecurityAndAnalysisEvent struct { Changes *SecurityAndAnalysisChange `json:"changes,omitempty"` Enterprise *Enterprise `json:"enterprise,omitempty"` @@ -1519,7 +1519,7 @@ type SecurityAndAnalysisChangeFrom struct { // StarEvent is triggered when a star is added or removed from a repository. // The Webhook event name is "star". // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#star +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#star type StarEvent struct { // Action is the action that was performed. Possible values are: "created" or "deleted". Action *string `json:"action,omitempty"` @@ -1540,7 +1540,7 @@ type StarEvent struct { // Events of this type are not visible in timelines, they are only used to // trigger hooks. // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#status +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#status type StatusEvent struct { SHA *string `json:"sha,omitempty"` // State is the new state. Possible values are: "pending", "success", "failure", "error". @@ -1571,7 +1571,7 @@ type StatusEvent struct { // Events of this type are not visible in timelines. These events are only used // to trigger hooks. // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#team +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#team type TeamEvent struct { Action *string `json:"action,omitempty"` Team *Team `json:"team,omitempty"` @@ -1590,7 +1590,7 @@ type TeamEvent struct { // Events of this type are not visible in timelines. These events are only used // to trigger hooks. // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#team_add +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#team_add type TeamAddEvent struct { Team *Team `json:"team,omitempty"` Repo *Repository `json:"repository,omitempty"` @@ -1624,7 +1624,7 @@ type UserEvent struct { // The event’s actor is the user who starred a repository, and the event’s // repository is the repository that was starred. // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#watch +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#watch type WatchEvent struct { // Action is the action that was performed. Possible value is: "started". Action *string `json:"action,omitempty"` @@ -1642,7 +1642,7 @@ type WatchEvent struct { // WorkflowDispatchEvent is triggered when someone triggers a workflow run on GitHub or // sends a POST request to the create a workflow dispatch event endpoint. // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#workflow_dispatch +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#workflow_dispatch type WorkflowDispatchEvent struct { Inputs json.RawMessage `json:"inputs,omitempty"` Ref *string `json:"ref,omitempty"` @@ -1657,7 +1657,7 @@ type WorkflowDispatchEvent struct { // WorkflowJobEvent is triggered when a job is queued, started or completed. // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#workflow_job +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#workflow_job type WorkflowJobEvent struct { WorkflowJob *WorkflowJob `json:"workflow_job,omitempty"` @@ -1675,7 +1675,7 @@ type WorkflowJobEvent struct { // WorkflowRunEvent is triggered when a GitHub Actions workflow run is requested or completed. // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#workflow_run +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#workflow_run type WorkflowRunEvent struct { Action *string `json:"action,omitempty"` Workflow *Workflow `json:"workflow,omitempty"` @@ -1690,7 +1690,7 @@ type WorkflowRunEvent struct { // SecurityAdvisory represents the advisory object in SecurityAdvisoryEvent payload. // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#security_advisory +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#security_advisory type SecurityAdvisory struct { CVSS *AdvisoryCVSS `json:"cvss,omitempty"` CWEs []*AdvisoryCWEs `json:"cwes,omitempty"` @@ -1740,8 +1740,8 @@ type AdvisoryVulnerability struct { FirstPatchedVersion *FirstPatchedVersion `json:"first_patched_version,omitempty"` // PatchedVersions and VulnerableFunctions are used in the following APIs: - // - https://docs.github.com/en/rest/security-advisories/repository-advisories?apiVersion=2022-11-28#list-repository-security-advisories-for-an-organization - // - https://docs.github.com/en/rest/security-advisories/repository-advisories?apiVersion=2022-11-28#list-repository-security-advisories + // - https://docs.github.com/rest/security-advisories/repository-advisories#list-repository-security-advisories-for-an-organization + // - https://docs.github.com/rest/security-advisories/repository-advisories#list-repository-security-advisories PatchedVersions *string `json:"patched_versions,omitempty"` VulnerableFunctions []string `json:"vulnerable_functions,omitempty"` } @@ -1759,7 +1759,7 @@ type FirstPatchedVersion struct { // SecurityAdvisoryEvent is triggered when a security-related vulnerability is found in software on GitHub. // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#security_advisory +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#security_advisory type SecurityAdvisoryEvent struct { Action *string `json:"action,omitempty"` SecurityAdvisory *SecurityAdvisory `json:"security_advisory,omitempty"` @@ -1774,7 +1774,7 @@ type SecurityAdvisoryEvent struct { // CodeScanningAlertEvent is triggered when a code scanning finds a potential vulnerability or error in your code. // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#code_scanning_alert +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#code_scanning_alert type CodeScanningAlertEvent struct { Action *string `json:"action,omitempty"` Alert *Alert `json:"alert,omitempty"` diff --git a/github/gists.go b/github/gists.go index 80961fcb908..08180c6d301 100644 --- a/github/gists.go +++ b/github/gists.go @@ -14,7 +14,7 @@ import ( // GistsService handles communication with the Gist related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/en/rest/gists +// GitHub API docs: https://docs.github.com/rest/gists type GistsService service // Gist represents a GitHub's gist. @@ -96,8 +96,11 @@ type GistListOptions struct { // is authenticated, it will returns all gists for the authenticated // user. // -// GitHub API docs: https://docs.github.com/en/rest/gists/gists#list-gists-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/rest/gists/gists#list-gists-for-a-user +// GitHub API docs: https://docs.github.com/rest/gists/gists#list-gists-for-a-user +// GitHub API docs: https://docs.github.com/rest/gists/gists#list-gists-for-the-authenticated-user +// +//meta:operation GET /gists +//meta:operation GET /users/{username}/gists func (s *GistsService) List(ctx context.Context, user string, opts *GistListOptions) ([]*Gist, *Response, error) { var u string if user != "" { @@ -126,7 +129,9 @@ func (s *GistsService) List(ctx context.Context, user string, opts *GistListOpti // ListAll lists all public gists. // -// GitHub API docs: https://docs.github.com/en/rest/gists/gists#list-public-gists +// GitHub API docs: https://docs.github.com/rest/gists/gists#list-public-gists +// +//meta:operation GET /gists/public func (s *GistsService) ListAll(ctx context.Context, opts *GistListOptions) ([]*Gist, *Response, error) { u, err := addOptions("gists/public", opts) if err != nil { @@ -149,7 +154,9 @@ func (s *GistsService) ListAll(ctx context.Context, opts *GistListOptions) ([]*G // ListStarred lists starred gists of authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/gists/gists#list-starred-gists +// GitHub API docs: https://docs.github.com/rest/gists/gists#list-starred-gists +// +//meta:operation GET /gists/starred func (s *GistsService) ListStarred(ctx context.Context, opts *GistListOptions) ([]*Gist, *Response, error) { u, err := addOptions("gists/starred", opts) if err != nil { @@ -172,7 +179,9 @@ func (s *GistsService) ListStarred(ctx context.Context, opts *GistListOptions) ( // Get a single gist. // -// GitHub API docs: https://docs.github.com/en/rest/gists/gists#get-a-gist +// GitHub API docs: https://docs.github.com/rest/gists/gists#get-a-gist +// +//meta:operation GET /gists/{gist_id} func (s *GistsService) Get(ctx context.Context, id string) (*Gist, *Response, error) { u := fmt.Sprintf("gists/%v", id) req, err := s.client.NewRequest("GET", u, nil) @@ -191,7 +200,9 @@ func (s *GistsService) Get(ctx context.Context, id string) (*Gist, *Response, er // GetRevision gets a specific revision of a gist. // -// GitHub API docs: https://docs.github.com/en/rest/gists/gists#get-a-gist-revision +// GitHub API docs: https://docs.github.com/rest/gists/gists#get-a-gist-revision +// +//meta:operation GET /gists/{gist_id}/{sha} func (s *GistsService) GetRevision(ctx context.Context, id, sha string) (*Gist, *Response, error) { u := fmt.Sprintf("gists/%v/%v", id, sha) req, err := s.client.NewRequest("GET", u, nil) @@ -210,7 +221,9 @@ func (s *GistsService) GetRevision(ctx context.Context, id, sha string) (*Gist, // Create a gist for authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/gists/gists#create-a-gist +// GitHub API docs: https://docs.github.com/rest/gists/gists#create-a-gist +// +//meta:operation POST /gists func (s *GistsService) Create(ctx context.Context, gist *Gist) (*Gist, *Response, error) { u := "gists" req, err := s.client.NewRequest("POST", u, gist) @@ -229,7 +242,9 @@ func (s *GistsService) Create(ctx context.Context, gist *Gist) (*Gist, *Response // Edit a gist. // -// GitHub API docs: https://docs.github.com/en/rest/gists/gists#update-a-gist +// GitHub API docs: https://docs.github.com/rest/gists/gists#update-a-gist +// +//meta:operation PATCH /gists/{gist_id} func (s *GistsService) Edit(ctx context.Context, id string, gist *Gist) (*Gist, *Response, error) { u := fmt.Sprintf("gists/%v", id) req, err := s.client.NewRequest("PATCH", u, gist) @@ -248,7 +263,9 @@ func (s *GistsService) Edit(ctx context.Context, id string, gist *Gist) (*Gist, // ListCommits lists commits of a gist. // -// GitHub API docs: https://docs.github.com/en/rest/gists/gists#list-gist-commits +// GitHub API docs: https://docs.github.com/rest/gists/gists#list-gist-commits +// +//meta:operation GET /gists/{gist_id}/commits func (s *GistsService) ListCommits(ctx context.Context, id string, opts *ListOptions) ([]*GistCommit, *Response, error) { u := fmt.Sprintf("gists/%v/commits", id) u, err := addOptions(u, opts) @@ -272,7 +289,9 @@ func (s *GistsService) ListCommits(ctx context.Context, id string, opts *ListOpt // Delete a gist. // -// GitHub API docs: https://docs.github.com/en/rest/gists/gists#delete-a-gist +// GitHub API docs: https://docs.github.com/rest/gists/gists#delete-a-gist +// +//meta:operation DELETE /gists/{gist_id} func (s *GistsService) Delete(ctx context.Context, id string) (*Response, error) { u := fmt.Sprintf("gists/%v", id) req, err := s.client.NewRequest("DELETE", u, nil) @@ -285,7 +304,9 @@ func (s *GistsService) Delete(ctx context.Context, id string) (*Response, error) // Star a gist on behalf of authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/gists/gists#star-a-gist +// GitHub API docs: https://docs.github.com/rest/gists/gists#star-a-gist +// +//meta:operation PUT /gists/{gist_id}/star func (s *GistsService) Star(ctx context.Context, id string) (*Response, error) { u := fmt.Sprintf("gists/%v/star", id) req, err := s.client.NewRequest("PUT", u, nil) @@ -298,7 +319,9 @@ func (s *GistsService) Star(ctx context.Context, id string) (*Response, error) { // Unstar a gist on a behalf of authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/gists/gists#unstar-a-gist +// GitHub API docs: https://docs.github.com/rest/gists/gists#unstar-a-gist +// +//meta:operation DELETE /gists/{gist_id}/star func (s *GistsService) Unstar(ctx context.Context, id string) (*Response, error) { u := fmt.Sprintf("gists/%v/star", id) req, err := s.client.NewRequest("DELETE", u, nil) @@ -311,7 +334,9 @@ func (s *GistsService) Unstar(ctx context.Context, id string) (*Response, error) // IsStarred checks if a gist is starred by authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/gists/gists#check-if-a-gist-is-starred +// GitHub API docs: https://docs.github.com/rest/gists/gists#check-if-a-gist-is-starred +// +//meta:operation GET /gists/{gist_id}/star func (s *GistsService) IsStarred(ctx context.Context, id string) (bool, *Response, error) { u := fmt.Sprintf("gists/%v/star", id) req, err := s.client.NewRequest("GET", u, nil) @@ -326,7 +351,9 @@ func (s *GistsService) IsStarred(ctx context.Context, id string) (bool, *Respons // Fork a gist. // -// GitHub API docs: https://docs.github.com/en/rest/gists/gists#fork-a-gist +// GitHub API docs: https://docs.github.com/rest/gists/gists#fork-a-gist +// +//meta:operation POST /gists/{gist_id}/forks func (s *GistsService) Fork(ctx context.Context, id string) (*Gist, *Response, error) { u := fmt.Sprintf("gists/%v/forks", id) req, err := s.client.NewRequest("POST", u, nil) @@ -345,7 +372,9 @@ func (s *GistsService) Fork(ctx context.Context, id string) (*Gist, *Response, e // ListForks lists forks of a gist. // -// GitHub API docs: https://docs.github.com/en/rest/gists/gists#list-gist-forks +// GitHub API docs: https://docs.github.com/rest/gists/gists#list-gist-forks +// +//meta:operation GET /gists/{gist_id}/forks func (s *GistsService) ListForks(ctx context.Context, id string, opts *ListOptions) ([]*GistFork, *Response, error) { u := fmt.Sprintf("gists/%v/forks", id) u, err := addOptions(u, opts) diff --git a/github/gists_comments.go b/github/gists_comments.go index ee0fbfa45f8..5e0614231b8 100644 --- a/github/gists_comments.go +++ b/github/gists_comments.go @@ -25,7 +25,9 @@ func (g GistComment) String() string { // ListComments lists all comments for a gist. // -// GitHub API docs: https://docs.github.com/en/rest/gists/comments#list-gist-comments +// GitHub API docs: https://docs.github.com/rest/gists/comments#list-gist-comments +// +//meta:operation GET /gists/{gist_id}/comments func (s *GistsService) ListComments(ctx context.Context, gistID string, opts *ListOptions) ([]*GistComment, *Response, error) { u := fmt.Sprintf("gists/%v/comments", gistID) u, err := addOptions(u, opts) @@ -49,7 +51,9 @@ func (s *GistsService) ListComments(ctx context.Context, gistID string, opts *Li // GetComment retrieves a single comment from a gist. // -// GitHub API docs: https://docs.github.com/en/rest/gists/comments#get-a-gist-comment +// GitHub API docs: https://docs.github.com/rest/gists/comments#get-a-gist-comment +// +//meta:operation GET /gists/{gist_id}/comments/{comment_id} func (s *GistsService) GetComment(ctx context.Context, gistID string, commentID int64) (*GistComment, *Response, error) { u := fmt.Sprintf("gists/%v/comments/%v", gistID, commentID) req, err := s.client.NewRequest("GET", u, nil) @@ -68,7 +72,9 @@ func (s *GistsService) GetComment(ctx context.Context, gistID string, commentID // CreateComment creates a comment for a gist. // -// GitHub API docs: https://docs.github.com/en/rest/gists/comments#create-a-gist-comment +// GitHub API docs: https://docs.github.com/rest/gists/comments#create-a-gist-comment +// +//meta:operation POST /gists/{gist_id}/comments func (s *GistsService) CreateComment(ctx context.Context, gistID string, comment *GistComment) (*GistComment, *Response, error) { u := fmt.Sprintf("gists/%v/comments", gistID) req, err := s.client.NewRequest("POST", u, comment) @@ -87,7 +93,9 @@ func (s *GistsService) CreateComment(ctx context.Context, gistID string, comment // EditComment edits an existing gist comment. // -// GitHub API docs: https://docs.github.com/en/rest/gists/comments#update-a-gist-comment +// GitHub API docs: https://docs.github.com/rest/gists/comments#update-a-gist-comment +// +//meta:operation PATCH /gists/{gist_id}/comments/{comment_id} func (s *GistsService) EditComment(ctx context.Context, gistID string, commentID int64, comment *GistComment) (*GistComment, *Response, error) { u := fmt.Sprintf("gists/%v/comments/%v", gistID, commentID) req, err := s.client.NewRequest("PATCH", u, comment) @@ -106,7 +114,9 @@ func (s *GistsService) EditComment(ctx context.Context, gistID string, commentID // DeleteComment deletes a gist comment. // -// GitHub API docs: https://docs.github.com/en/rest/gists/comments#delete-a-gist-comment +// GitHub API docs: https://docs.github.com/rest/gists/comments#delete-a-gist-comment +// +//meta:operation DELETE /gists/{gist_id}/comments/{comment_id} func (s *GistsService) DeleteComment(ctx context.Context, gistID string, commentID int64) (*Response, error) { u := fmt.Sprintf("gists/%v/comments/%v", gistID, commentID) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/git.go b/github/git.go index 8960de7b14a..2ca835e1b50 100644 --- a/github/git.go +++ b/github/git.go @@ -8,5 +8,5 @@ package github // GitService handles communication with the git data related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/en/rest/git/ +// GitHub API docs: https://docs.github.com/rest/git/ type GitService service diff --git a/github/git_blobs.go b/github/git_blobs.go index da0485ccbe2..d8904288896 100644 --- a/github/git_blobs.go +++ b/github/git_blobs.go @@ -23,7 +23,9 @@ type Blob struct { // GetBlob fetches a blob from a repo given a SHA. // -// GitHub API docs: https://docs.github.com/en/rest/git/blobs#get-a-blob +// GitHub API docs: https://docs.github.com/rest/git/blobs#get-a-blob +// +//meta:operation GET /repos/{owner}/{repo}/git/blobs/{file_sha} func (s *GitService) GetBlob(ctx context.Context, owner string, repo string, sha string) (*Blob, *Response, error) { u := fmt.Sprintf("repos/%v/%v/git/blobs/%v", owner, repo, sha) req, err := s.client.NewRequest("GET", u, nil) @@ -43,7 +45,9 @@ func (s *GitService) GetBlob(ctx context.Context, owner string, repo string, sha // GetBlobRaw fetches a blob's contents from a repo. // Unlike GetBlob, it returns the raw bytes rather than the base64-encoded data. // -// GitHub API docs: https://docs.github.com/en/rest/git/blobs#get-a-blob +// GitHub API docs: https://docs.github.com/rest/git/blobs#get-a-blob +// +//meta:operation GET /repos/{owner}/{repo}/git/blobs/{file_sha} func (s *GitService) GetBlobRaw(ctx context.Context, owner, repo, sha string) ([]byte, *Response, error) { u := fmt.Sprintf("repos/%v/%v/git/blobs/%v", owner, repo, sha) req, err := s.client.NewRequest("GET", u, nil) @@ -64,7 +68,9 @@ func (s *GitService) GetBlobRaw(ctx context.Context, owner, repo, sha string) ([ // CreateBlob creates a blob object. // -// GitHub API docs: https://docs.github.com/en/rest/git/blobs#create-a-blob +// GitHub API docs: https://docs.github.com/rest/git/blobs#create-a-blob +// +//meta:operation POST /repos/{owner}/{repo}/git/blobs func (s *GitService) CreateBlob(ctx context.Context, owner string, repo string, blob *Blob) (*Blob, *Response, error) { u := fmt.Sprintf("repos/%v/%v/git/blobs", owner, repo) req, err := s.client.NewRequest("POST", u, blob) diff --git a/github/git_commits.go b/github/git_commits.go index 1a683bc34c9..573d38be528 100644 --- a/github/git_commits.go +++ b/github/git_commits.go @@ -82,7 +82,9 @@ func (c CommitAuthor) String() string { // GetCommit fetches the Commit object for a given SHA. // -// GitHub API docs: https://docs.github.com/en/rest/git/commits#get-a-commit +// GitHub API docs: https://docs.github.com/rest/git/commits#get-a-commit-object +// +//meta:operation GET /repos/{owner}/{repo}/git/commits/{commit_sha} func (s *GitService) GetCommit(ctx context.Context, owner string, repo string, sha string) (*Commit, *Response, error) { u := fmt.Sprintf("repos/%v/%v/git/commits/%v", owner, repo, sha) req, err := s.client.NewRequest("GET", u, nil) @@ -122,7 +124,9 @@ type CreateCommitOptions struct { // data if omitted. If the commit.Author is omitted, it will be filled in with // the authenticated user’s information and the current date. // -// GitHub API docs: https://docs.github.com/en/rest/git/commits#create-a-commit +// GitHub API docs: https://docs.github.com/rest/git/commits#create-a-commit +// +//meta:operation POST /repos/{owner}/{repo}/git/commits func (s *GitService) CreateCommit(ctx context.Context, owner string, repo string, commit *Commit, opts *CreateCommitOptions) (*Commit, *Response, error) { if commit == nil { return nil, nil, fmt.Errorf("commit must be provided") diff --git a/github/git_refs.go b/github/git_refs.go index e839c30f667..ad7b10d7d3f 100644 --- a/github/git_refs.go +++ b/github/git_refs.go @@ -49,7 +49,9 @@ type updateRefRequest struct { // GetRef fetches a single reference in a repository. // -// GitHub API docs: https://docs.github.com/en/rest/git/refs#get-a-reference +// GitHub API docs: https://docs.github.com/rest/git/refs#get-a-reference +// +//meta:operation GET /repos/{owner}/{repo}/git/ref/{ref} func (s *GitService) GetRef(ctx context.Context, owner string, repo string, ref string) (*Reference, *Response, error) { ref = strings.TrimPrefix(ref, "refs/") u := fmt.Sprintf("repos/%v/%v/git/ref/%v", owner, repo, refURLEscape(ref)) @@ -88,7 +90,9 @@ type ReferenceListOptions struct { // ListMatchingRefs lists references in a repository that match a supplied ref. // Use an empty ref to list all references. // -// GitHub API docs: https://docs.github.com/en/rest/git/refs#list-matching-references +// GitHub API docs: https://docs.github.com/rest/git/refs#list-matching-references +// +//meta:operation GET /repos/{owner}/{repo}/git/matching-refs/{ref} func (s *GitService) ListMatchingRefs(ctx context.Context, owner, repo string, opts *ReferenceListOptions) ([]*Reference, *Response, error) { var ref string if opts != nil { @@ -116,7 +120,9 @@ func (s *GitService) ListMatchingRefs(ctx context.Context, owner, repo string, o // CreateRef creates a new ref in a repository. // -// GitHub API docs: https://docs.github.com/en/rest/git/refs#create-a-reference +// GitHub API docs: https://docs.github.com/rest/git/refs#create-a-reference +// +//meta:operation POST /repos/{owner}/{repo}/git/refs func (s *GitService) CreateRef(ctx context.Context, owner string, repo string, ref *Reference) (*Reference, *Response, error) { u := fmt.Sprintf("repos/%v/%v/git/refs", owner, repo) req, err := s.client.NewRequest("POST", u, &createRefRequest{ @@ -139,7 +145,9 @@ func (s *GitService) CreateRef(ctx context.Context, owner string, repo string, r // UpdateRef updates an existing ref in a repository. // -// GitHub API docs: https://docs.github.com/en/rest/git/refs#update-a-reference +// GitHub API docs: https://docs.github.com/rest/git/refs#update-a-reference +// +//meta:operation PATCH /repos/{owner}/{repo}/git/refs/{ref} func (s *GitService) UpdateRef(ctx context.Context, owner string, repo string, ref *Reference, force bool) (*Reference, *Response, error) { refPath := strings.TrimPrefix(*ref.Ref, "refs/") u := fmt.Sprintf("repos/%v/%v/git/refs/%v", owner, repo, refURLEscape(refPath)) @@ -162,7 +170,9 @@ func (s *GitService) UpdateRef(ctx context.Context, owner string, repo string, r // DeleteRef deletes a ref from a repository. // -// GitHub API docs: https://docs.github.com/en/rest/git/refs#delete-a-reference +// GitHub API docs: https://docs.github.com/rest/git/refs#delete-a-reference +// +//meta:operation DELETE /repos/{owner}/{repo}/git/refs/{ref} func (s *GitService) DeleteRef(ctx context.Context, owner string, repo string, ref string) (*Response, error) { ref = strings.TrimPrefix(ref, "refs/") u := fmt.Sprintf("repos/%v/%v/git/refs/%v", owner, repo, refURLEscape(ref)) diff --git a/github/git_tags.go b/github/git_tags.go index 30d7b2c2d23..67321566f73 100644 --- a/github/git_tags.go +++ b/github/git_tags.go @@ -35,7 +35,9 @@ type createTagRequest struct { // GetTag fetches a tag from a repo given a SHA. // -// GitHub API docs: https://docs.github.com/en/rest/git/tags#get-a-tag +// GitHub API docs: https://docs.github.com/rest/git/tags#get-a-tag +// +//meta:operation GET /repos/{owner}/{repo}/git/tags/{tag_sha} func (s *GitService) GetTag(ctx context.Context, owner string, repo string, sha string) (*Tag, *Response, error) { u := fmt.Sprintf("repos/%v/%v/git/tags/%v", owner, repo, sha) req, err := s.client.NewRequest("GET", u, nil) @@ -54,7 +56,9 @@ func (s *GitService) GetTag(ctx context.Context, owner string, repo string, sha // CreateTag creates a tag object. // -// GitHub API docs: https://docs.github.com/en/rest/git/tags#create-a-tag-object +// GitHub API docs: https://docs.github.com/rest/git/tags#create-a-tag-object +// +//meta:operation POST /repos/{owner}/{repo}/git/tags func (s *GitService) CreateTag(ctx context.Context, owner string, repo string, tag *Tag) (*Tag, *Response, error) { u := fmt.Sprintf("repos/%v/%v/git/tags", owner, repo) diff --git a/github/git_trees.go b/github/git_trees.go index db28976e032..b8eed58e136 100644 --- a/github/git_trees.go +++ b/github/git_trees.go @@ -93,7 +93,9 @@ func (t *TreeEntry) MarshalJSON() ([]byte, error) { // GetTree fetches the Tree object for a given sha hash from a repository. // -// GitHub API docs: https://docs.github.com/en/rest/git/trees#get-a-tree +// GitHub API docs: https://docs.github.com/rest/git/trees#get-a-tree +// +//meta:operation GET /repos/{owner}/{repo}/git/trees/{tree_sha} func (s *GitService) GetTree(ctx context.Context, owner string, repo string, sha string, recursive bool) (*Tree, *Response, error) { u := fmt.Sprintf("repos/%v/%v/git/trees/%v", owner, repo, sha) if recursive { @@ -124,7 +126,9 @@ type createTree struct { // path modifying that tree are specified, it will overwrite the contents of // that tree with the new path contents and write a new tree out. // -// GitHub API docs: https://docs.github.com/en/rest/git/trees#create-a-tree +// GitHub API docs: https://docs.github.com/rest/git/trees#create-a-tree +// +//meta:operation POST /repos/{owner}/{repo}/git/trees func (s *GitService) CreateTree(ctx context.Context, owner string, repo string, baseTree string, entries []*TreeEntry) (*Tree, *Response, error) { u := fmt.Sprintf("repos/%v/%v/git/trees", owner, repo) diff --git a/github/github.go b/github/github.go index 834aa86bc6a..9c1bf084d35 100644 --- a/github/github.go +++ b/github/github.go @@ -5,6 +5,7 @@ //go:generate go run gen-accessors.go //go:generate go run gen-stringify-test.go +//go:generate ../script/metadata.sh update-go package github @@ -131,10 +132,10 @@ const ( // https://developer.github.com/changes/2019-04-11-pulls-branches-for-commit/ mediaTypeListPullsOrBranchesForCommitPreview = "application/vnd.github.groot-preview+json" - // https://docs.github.com/en/rest/previews/#repository-creation-permissions + // https://docs.github.com/rest/previews/#repository-creation-permissions mediaTypeMemberAllowedRepoCreationTypePreview = "application/vnd.github.surtur-preview+json" - // https://docs.github.com/en/rest/previews/#create-and-use-repository-templates + // https://docs.github.com/rest/previews/#create-and-use-repository-templates mediaTypeRepositoryTemplatePreview = "application/vnd.github.baptiste-preview+json" // https://developer.github.com/changes/2019-10-03-multi-line-comments/ @@ -994,7 +995,7 @@ func compareHTTPResponse(r1, r2 *http.Response) bool { /* An ErrorResponse reports one or more errors caused by an API request. -GitHub API docs: https://docs.github.com/en/rest/#client-errors +GitHub API docs: https://docs.github.com/rest/#client-errors */ type ErrorResponse struct { Response *http.Response `json:"-"` // HTTP response that caused this error @@ -1004,7 +1005,7 @@ type ErrorResponse struct { Block *ErrorBlock `json:"block,omitempty"` // Most errors will also include a documentation_url field pointing // to some content that might help you resolve the error, see - // https://docs.github.com/en/rest/#client-errors + // https://docs.github.com/rest/#client-errors DocumentationURL string `json:"documentation_url,omitempty"` } @@ -1132,7 +1133,7 @@ func (ae *AcceptedError) Is(target error) bool { } // AbuseRateLimitError occurs when GitHub returns 403 Forbidden response with the -// "documentation_url" field value equal to "https://docs.github.com/en/rest/overview/resources-in-the-rest-api#secondary-rate-limits". +// "documentation_url" field value equal to "https://docs.github.com/rest/overview/resources-in-the-rest-api#secondary-rate-limits". type AbuseRateLimitError struct { Response *http.Response // HTTP response that caused this error Message string `json:"message"` // error message @@ -1195,7 +1196,7 @@ GitHub error responses structure are often undocumented and inconsistent. Sometimes error is just a simple string (Issue #540). In such cases, Message represents an error message as a workaround. -GitHub API docs: https://docs.github.com/en/rest/#client-errors +GitHub API docs: https://docs.github.com/rest/#client-errors */ type Error struct { Resource string `json:"resource"` // resource on which the error occurred @@ -1309,7 +1310,7 @@ const ( // category returns the rate limit category of the endpoint, determined by HTTP method and Request.URL.Path. func category(method, path string) rateLimitCategory { switch { - // https://docs.github.com/en/rest/rate-limit#about-rate-limits + // https://docs.github.com/rest/rate-limit#about-rate-limits default: // NOTE: coreCategory is returned for actionsRunnerRegistrationCategory too, // because no API found for this category. @@ -1323,17 +1324,17 @@ func category(method, path string) rateLimitCategory { method == http.MethodPost: return integrationManifestCategory - // https://docs.github.com/en/rest/migrations/source-imports#start-an-import + // https://docs.github.com/rest/migrations/source-imports#start-an-import case strings.HasPrefix(path, "/repos/") && strings.HasSuffix(path, "/import") && method == http.MethodPut: return sourceImportCategory - // https://docs.github.com/en/rest/code-scanning#upload-an-analysis-as-sarif-data + // https://docs.github.com/rest/code-scanning#upload-an-analysis-as-sarif-data case strings.HasSuffix(path, "/code-scanning/sarifs"): return codeScanningUploadCategory - // https://docs.github.com/en/enterprise-cloud@latest/rest/scim + // https://docs.github.com/enterprise-cloud@latest/rest/scim case strings.HasPrefix(path, "/scim/"): return scimCategory } @@ -1377,7 +1378,7 @@ that need to use a higher rate limit associated with your OAuth application. This will add the client id and secret as a base64-encoded string in the format ClientID:ClientSecret and apply it as an "Authorization": "Basic" header. -See https://docs.github.com/en/rest/#unauthenticated-rate-limited-requests for +See https://docs.github.com/rest/#unauthenticated-rate-limited-requests for more information. */ type UnauthenticatedRateLimitedTransport struct { diff --git a/github/gitignore.go b/github/gitignore.go index a20a868b44a..34cf285e146 100644 --- a/github/gitignore.go +++ b/github/gitignore.go @@ -13,7 +13,7 @@ import ( // GitignoresService provides access to the gitignore related functions in the // GitHub API. // -// GitHub API docs: https://docs.github.com/en/rest/gitignore/ +// GitHub API docs: https://docs.github.com/rest/gitignore/ type GitignoresService service // Gitignore represents a .gitignore file as returned by the GitHub API. @@ -28,7 +28,9 @@ func (g Gitignore) String() string { // List all available Gitignore templates. // -// GitHub API docs: https://docs.github.com/en/rest/gitignore/#listing-available-templates +// GitHub API docs: https://docs.github.com/rest/gitignore/gitignore#get-all-gitignore-templates +// +//meta:operation GET /gitignore/templates func (s *GitignoresService) List(ctx context.Context) ([]string, *Response, error) { req, err := s.client.NewRequest("GET", "gitignore/templates", nil) if err != nil { @@ -46,7 +48,9 @@ func (s *GitignoresService) List(ctx context.Context) ([]string, *Response, erro // Get a Gitignore by name. // -// GitHub API docs: https://docs.github.com/en/rest/gitignore#get-a-gitignore-template +// GitHub API docs: https://docs.github.com/rest/gitignore/gitignore#get-a-gitignore-template +// +//meta:operation GET /gitignore/templates/{name} func (s *GitignoresService) Get(ctx context.Context, name string) (*Gitignore, *Response, error) { u := fmt.Sprintf("gitignore/templates/%v", name) req, err := s.client.NewRequest("GET", u, nil) diff --git a/github/interactions.go b/github/interactions.go index a690f61268f..2268273dd48 100644 --- a/github/interactions.go +++ b/github/interactions.go @@ -8,7 +8,7 @@ package github // InteractionsService handles communication with the repository and organization related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/en/rest/interactions/ +// GitHub API docs: https://docs.github.com/rest/interactions/ type InteractionsService service // InteractionRestriction represents the interaction restrictions for repository and organization. diff --git a/github/interactions_orgs.go b/github/interactions_orgs.go index 5c7663f583d..f0ba0b15f04 100644 --- a/github/interactions_orgs.go +++ b/github/interactions_orgs.go @@ -12,7 +12,9 @@ import ( // GetRestrictionsForOrg fetches the interaction restrictions for an organization. // -// GitHub API docs: https://docs.github.com/en/rest/interactions/orgs#get-interaction-restrictions-for-an-organization +// GitHub API docs: https://docs.github.com/rest/interactions/orgs#get-interaction-restrictions-for-an-organization +// +//meta:operation GET /orgs/{org}/interaction-limits func (s *InteractionsService) GetRestrictionsForOrg(ctx context.Context, organization string) (*InteractionRestriction, *Response, error) { u := fmt.Sprintf("orgs/%v/interaction-limits", organization) req, err := s.client.NewRequest("GET", u, nil) @@ -39,7 +41,9 @@ func (s *InteractionsService) GetRestrictionsForOrg(ctx context.Context, organiz // in public repositories for the given organization. // Possible values are: "existing_users", "contributors_only", "collaborators_only". // -// GitHub API docs: https://docs.github.com/en/rest/interactions/orgs#set-interaction-restrictions-for-an-organization +// GitHub API docs: https://docs.github.com/rest/interactions/orgs#set-interaction-restrictions-for-an-organization +// +//meta:operation PUT /orgs/{org}/interaction-limits func (s *InteractionsService) UpdateRestrictionsForOrg(ctx context.Context, organization, limit string) (*InteractionRestriction, *Response, error) { u := fmt.Sprintf("orgs/%v/interaction-limits", organization) @@ -65,7 +69,9 @@ func (s *InteractionsService) UpdateRestrictionsForOrg(ctx context.Context, orga // RemoveRestrictionsFromOrg removes the interaction restrictions for an organization. // -// GitHub API docs: https://docs.github.com/en/rest/interactions/orgs#remove-interaction-restrictions-for-an-organization +// GitHub API docs: https://docs.github.com/rest/interactions/orgs#remove-interaction-restrictions-for-an-organization +// +//meta:operation DELETE /orgs/{org}/interaction-limits func (s *InteractionsService) RemoveRestrictionsFromOrg(ctx context.Context, organization string) (*Response, error) { u := fmt.Sprintf("orgs/%v/interaction-limits", organization) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/interactions_repos.go b/github/interactions_repos.go index 41e6c5319d0..9c044badd19 100644 --- a/github/interactions_repos.go +++ b/github/interactions_repos.go @@ -12,7 +12,9 @@ import ( // GetRestrictionsForRepo fetches the interaction restrictions for a repository. // -// GitHub API docs: https://docs.github.com/en/rest/interactions/repos#get-interaction-restrictions-for-a-repository +// GitHub API docs: https://docs.github.com/rest/interactions/repos#get-interaction-restrictions-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/interaction-limits func (s *InteractionsService) GetRestrictionsForRepo(ctx context.Context, owner, repo string) (*InteractionRestriction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/interaction-limits", owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -39,7 +41,9 @@ func (s *InteractionsService) GetRestrictionsForRepo(ctx context.Context, owner, // for the given repository. // Possible values are: "existing_users", "contributors_only", "collaborators_only". // -// GitHub API docs: https://docs.github.com/en/rest/interactions/repos#set-interaction-restrictions-for-a-repository +// GitHub API docs: https://docs.github.com/rest/interactions/repos#set-interaction-restrictions-for-a-repository +// +//meta:operation PUT /repos/{owner}/{repo}/interaction-limits func (s *InteractionsService) UpdateRestrictionsForRepo(ctx context.Context, owner, repo, limit string) (*InteractionRestriction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/interaction-limits", owner, repo) @@ -65,7 +69,9 @@ func (s *InteractionsService) UpdateRestrictionsForRepo(ctx context.Context, own // RemoveRestrictionsFromRepo removes the interaction restrictions for a repository. // -// GitHub API docs: https://docs.github.com/en/rest/interactions/repos#remove-interaction-restrictions-for-a-repository +// GitHub API docs: https://docs.github.com/rest/interactions/repos#remove-interaction-restrictions-for-a-repository +// +//meta:operation DELETE /repos/{owner}/{repo}/interaction-limits func (s *InteractionsService) RemoveRestrictionsFromRepo(ctx context.Context, owner, repo string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/interaction-limits", owner, repo) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/issue_import.go b/github/issue_import.go index 04899772bd1..4f06371085e 100644 --- a/github/issue_import.go +++ b/github/issue_import.go @@ -70,7 +70,9 @@ type IssueImportError struct { // Create a new imported issue on the specified repository. // -// https://gist.github.com/jonmagic/5282384165e0f86ef105#start-an-issue-import +// GitHub API docs: https://gist.github.com/jonmagic/5282384165e0f86ef105#start-an-issue-import +// +//meta:operation POST /repos/{owner}/{repo}/import/issues func (s *IssueImportService) Create(ctx context.Context, owner, repo string, issue *IssueImportRequest) (*IssueImportResponse, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import/issues", owner, repo) req, err := s.client.NewRequest("POST", u, issue) @@ -99,7 +101,9 @@ func (s *IssueImportService) Create(ctx context.Context, owner, repo string, iss // CheckStatus checks the status of an imported issue. // -// https://gist.github.com/jonmagic/5282384165e0f86ef105#import-status-request +// GitHub API docs: https://gist.github.com/jonmagic/5282384165e0f86ef105#import-status-request +// +//meta:operation GET /repos/{owner}/{repo}/import/issues/{issue_number} func (s *IssueImportService) CheckStatus(ctx context.Context, owner, repo string, issueID int64) (*IssueImportResponse, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import/issues/%v", owner, repo, issueID) req, err := s.client.NewRequest("GET", u, nil) @@ -121,7 +125,9 @@ func (s *IssueImportService) CheckStatus(ctx context.Context, owner, repo string // CheckStatusSince checks the status of multiple imported issues since a given date. // -// https://gist.github.com/jonmagic/5282384165e0f86ef105#check-status-of-multiple-issues +// GitHub API docs: https://gist.github.com/jonmagic/5282384165e0f86ef105#check-status-of-multiple-issues +// +//meta:operation GET /repos/{owner}/{repo}/import/issues func (s *IssueImportService) CheckStatusSince(ctx context.Context, owner, repo string, since Timestamp) ([]*IssueImportResponse, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import/issues?since=%v", owner, repo, since.Format("2006-01-02")) req, err := s.client.NewRequest("GET", u, nil) diff --git a/github/issues.go b/github/issues.go index 44364811d3f..1db99328b51 100644 --- a/github/issues.go +++ b/github/issues.go @@ -14,7 +14,7 @@ import ( // IssuesService handles communication with the issue related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/en/rest/issues/ +// GitHub API docs: https://docs.github.com/rest/issues/ type IssuesService service // Issue represents a GitHub issue on a repository. @@ -56,7 +56,7 @@ type Issue struct { NodeID *string `json:"node_id,omitempty"` // TextMatches is only populated from search results that request text matches - // See: search.go and https://docs.github.com/en/rest/search/#text-match-metadata + // See: search.go and https://docs.github.com/rest/search/#text-match-metadata TextMatches []*TextMatch `json:"text_matches,omitempty"` // ActiveLockReason is populated only when LockReason is provided while locking the issue. @@ -132,8 +132,11 @@ type PullRequestLinks struct { // organization repositories; if false, list only owned and member // repositories. // -// GitHub API docs: https://docs.github.com/en/rest/issues/issues#list-user-account-issues-assigned-to-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/rest/issues/issues#list-issues-assigned-to-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/issues/issues#list-issues-assigned-to-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/issues/issues#list-user-account-issues-assigned-to-the-authenticated-user +// +//meta:operation GET /issues +//meta:operation GET /user/issues func (s *IssuesService) List(ctx context.Context, all bool, opts *IssueListOptions) ([]*Issue, *Response, error) { var u string if all { @@ -147,7 +150,9 @@ func (s *IssuesService) List(ctx context.Context, all bool, opts *IssueListOptio // ListByOrg fetches the issues in the specified organization for the // authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/issues/issues#list-organization-issues-assigned-to-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/issues/issues#list-organization-issues-assigned-to-the-authenticated-user +// +//meta:operation GET /orgs/{org}/issues func (s *IssuesService) ListByOrg(ctx context.Context, org string, opts *IssueListOptions) ([]*Issue, *Response, error) { u := fmt.Sprintf("orgs/%v/issues", org) return s.listIssues(ctx, u, opts) @@ -218,7 +223,9 @@ type IssueListByRepoOptions struct { // ListByRepo lists the issues for the specified repository. // -// GitHub API docs: https://docs.github.com/en/rest/issues/issues#list-repository-issues +// GitHub API docs: https://docs.github.com/rest/issues/issues#list-repository-issues +// +//meta:operation GET /repos/{owner}/{repo}/issues func (s *IssuesService) ListByRepo(ctx context.Context, owner string, repo string, opts *IssueListByRepoOptions) ([]*Issue, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues", owner, repo) u, err := addOptions(u, opts) @@ -245,7 +252,9 @@ func (s *IssuesService) ListByRepo(ctx context.Context, owner string, repo strin // Get a single issue. // -// GitHub API docs: https://docs.github.com/en/rest/issues/issues#get-an-issue +// GitHub API docs: https://docs.github.com/rest/issues/issues#get-an-issue +// +//meta:operation GET /repos/{owner}/{repo}/issues/{issue_number} func (s *IssuesService) Get(ctx context.Context, owner string, repo string, number int) (*Issue, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%d", owner, repo, number) req, err := s.client.NewRequest("GET", u, nil) @@ -267,7 +276,9 @@ func (s *IssuesService) Get(ctx context.Context, owner string, repo string, numb // Create a new issue on the specified repository. // -// GitHub API docs: https://docs.github.com/en/rest/issues/issues#create-an-issue +// GitHub API docs: https://docs.github.com/rest/issues/issues#create-an-issue +// +//meta:operation POST /repos/{owner}/{repo}/issues func (s *IssuesService) Create(ctx context.Context, owner string, repo string, issue *IssueRequest) (*Issue, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues", owner, repo) req, err := s.client.NewRequest("POST", u, issue) @@ -286,7 +297,9 @@ func (s *IssuesService) Create(ctx context.Context, owner string, repo string, i // Edit (update) an issue. // -// GitHub API docs: https://docs.github.com/en/rest/issues/issues#update-an-issue +// GitHub API docs: https://docs.github.com/rest/issues/issues#update-an-issue +// +//meta:operation PATCH /repos/{owner}/{repo}/issues/{issue_number} func (s *IssuesService) Edit(ctx context.Context, owner string, repo string, number int, issue *IssueRequest) (*Issue, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%d", owner, repo, number) req, err := s.client.NewRequest("PATCH", u, issue) @@ -307,7 +320,9 @@ func (s *IssuesService) Edit(ctx context.Context, owner string, repo string, num // // This is a helper method to explicitly update an issue with a `null` milestone, thereby removing it. // -// GitHub API docs: https://docs.github.com/en/rest/issues/issues#update-an-issue +// GitHub API docs: https://docs.github.com/rest/issues/issues#update-an-issue +// +//meta:operation PATCH /repos/{owner}/{repo}/issues/{issue_number} func (s *IssuesService) RemoveMilestone(ctx context.Context, owner, repo string, issueNumber int) (*Issue, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%v", owner, repo, issueNumber) req, err := s.client.NewRequest("PATCH", u, &struct { @@ -337,7 +352,9 @@ type LockIssueOptions struct { // Lock an issue's conversation. // -// GitHub API docs: https://docs.github.com/en/rest/issues/issues#lock-an-issue +// GitHub API docs: https://docs.github.com/rest/issues/issues#lock-an-issue +// +//meta:operation PUT /repos/{owner}/{repo}/issues/{issue_number}/lock func (s *IssuesService) Lock(ctx context.Context, owner string, repo string, number int, opts *LockIssueOptions) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%d/lock", owner, repo, number) req, err := s.client.NewRequest("PUT", u, opts) @@ -350,7 +367,9 @@ func (s *IssuesService) Lock(ctx context.Context, owner string, repo string, num // Unlock an issue's conversation. // -// GitHub API docs: https://docs.github.com/en/rest/issues/issues#unlock-an-issue +// GitHub API docs: https://docs.github.com/rest/issues/issues#unlock-an-issue +// +//meta:operation DELETE /repos/{owner}/{repo}/issues/{issue_number}/lock func (s *IssuesService) Unlock(ctx context.Context, owner string, repo string, number int) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%d/lock", owner, repo, number) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/issues_assignees.go b/github/issues_assignees.go index b7f2e802437..fd065771ed3 100644 --- a/github/issues_assignees.go +++ b/github/issues_assignees.go @@ -13,7 +13,9 @@ import ( // ListAssignees fetches all available assignees (owners and collaborators) to // which issues may be assigned. // -// GitHub API docs: https://docs.github.com/en/rest/issues/assignees#list-assignees +// GitHub API docs: https://docs.github.com/rest/issues/assignees#list-assignees +// +//meta:operation GET /repos/{owner}/{repo}/assignees func (s *IssuesService) ListAssignees(ctx context.Context, owner, repo string, opts *ListOptions) ([]*User, *Response, error) { u := fmt.Sprintf("repos/%v/%v/assignees", owner, repo) u, err := addOptions(u, opts) @@ -37,7 +39,9 @@ func (s *IssuesService) ListAssignees(ctx context.Context, owner, repo string, o // IsAssignee checks if a user is an assignee for the specified repository. // -// GitHub API docs: https://docs.github.com/en/rest/issues/assignees#check-if-a-user-can-be-assigned +// GitHub API docs: https://docs.github.com/rest/issues/assignees#check-if-a-user-can-be-assigned +// +//meta:operation GET /repos/{owner}/{repo}/assignees/{assignee} func (s *IssuesService) IsAssignee(ctx context.Context, owner, repo, user string) (bool, *Response, error) { u := fmt.Sprintf("repos/%v/%v/assignees/%v", owner, repo, user) req, err := s.client.NewRequest("GET", u, nil) @@ -52,7 +56,9 @@ func (s *IssuesService) IsAssignee(ctx context.Context, owner, repo, user string // AddAssignees adds the provided GitHub users as assignees to the issue. // -// GitHub API docs: https://docs.github.com/en/rest/issues/assignees#add-assignees-to-an-issue +// GitHub API docs: https://docs.github.com/rest/issues/assignees#add-assignees-to-an-issue +// +//meta:operation POST /repos/{owner}/{repo}/issues/{issue_number}/assignees func (s *IssuesService) AddAssignees(ctx context.Context, owner, repo string, number int, assignees []string) (*Issue, *Response, error) { users := &struct { Assignees []string `json:"assignees,omitempty"` @@ -74,7 +80,9 @@ func (s *IssuesService) AddAssignees(ctx context.Context, owner, repo string, nu // RemoveAssignees removes the provided GitHub users as assignees from the issue. // -// GitHub API docs: https://docs.github.com/en/rest/issues/assignees#remove-assignees-from-an-issue +// GitHub API docs: https://docs.github.com/rest/issues/assignees#remove-assignees-from-an-issue +// +//meta:operation DELETE /repos/{owner}/{repo}/issues/{issue_number}/assignees func (s *IssuesService) RemoveAssignees(ctx context.Context, owner, repo string, number int, assignees []string) (*Issue, *Response, error) { users := &struct { Assignees []string `json:"assignees,omitempty"` diff --git a/github/issues_comments.go b/github/issues_comments.go index 17881c093dc..74a4e60f7ca 100644 --- a/github/issues_comments.go +++ b/github/issues_comments.go @@ -50,8 +50,11 @@ type IssueListCommentsOptions struct { // ListComments lists all comments on the specified issue. Specifying an issue // number of 0 will return all comments on all issues for the repository. // -// GitHub API docs: https://docs.github.com/en/rest/issues/comments#list-issue-comments -// GitHub API docs: https://docs.github.com/en/rest/issues/comments#list-issue-comments-for-a-repository +// GitHub API docs: https://docs.github.com/rest/issues/comments#list-issue-comments +// GitHub API docs: https://docs.github.com/rest/issues/comments#list-issue-comments-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/issues/comments +//meta:operation GET /repos/{owner}/{repo}/issues/{issue_number}/comments func (s *IssuesService) ListComments(ctx context.Context, owner string, repo string, number int, opts *IssueListCommentsOptions) ([]*IssueComment, *Response, error) { var u string if number == 0 { @@ -83,7 +86,9 @@ func (s *IssuesService) ListComments(ctx context.Context, owner string, repo str // GetComment fetches the specified issue comment. // -// GitHub API docs: https://docs.github.com/en/rest/issues/comments#get-an-issue-comment +// GitHub API docs: https://docs.github.com/rest/issues/comments#get-an-issue-comment +// +//meta:operation GET /repos/{owner}/{repo}/issues/comments/{comment_id} func (s *IssuesService) GetComment(ctx context.Context, owner string, repo string, commentID int64) (*IssueComment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, commentID) @@ -106,7 +111,9 @@ func (s *IssuesService) GetComment(ctx context.Context, owner string, repo strin // CreateComment creates a new comment on the specified issue. // -// GitHub API docs: https://docs.github.com/en/rest/issues/comments#create-an-issue-comment +// GitHub API docs: https://docs.github.com/rest/issues/comments#create-an-issue-comment +// +//meta:operation POST /repos/{owner}/{repo}/issues/{issue_number}/comments func (s *IssuesService) CreateComment(ctx context.Context, owner string, repo string, number int, comment *IssueComment) (*IssueComment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%d/comments", owner, repo, number) req, err := s.client.NewRequest("POST", u, comment) @@ -125,7 +132,9 @@ func (s *IssuesService) CreateComment(ctx context.Context, owner string, repo st // EditComment updates an issue comment. // A non-nil comment.Body must be provided. Other comment fields should be left nil. // -// GitHub API docs: https://docs.github.com/en/rest/issues/comments#update-an-issue-comment +// GitHub API docs: https://docs.github.com/rest/issues/comments#update-an-issue-comment +// +//meta:operation PATCH /repos/{owner}/{repo}/issues/comments/{comment_id} func (s *IssuesService) EditComment(ctx context.Context, owner string, repo string, commentID int64, comment *IssueComment) (*IssueComment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, commentID) req, err := s.client.NewRequest("PATCH", u, comment) @@ -143,7 +152,9 @@ func (s *IssuesService) EditComment(ctx context.Context, owner string, repo stri // DeleteComment deletes an issue comment. // -// GitHub API docs: https://docs.github.com/en/rest/issues/comments#delete-an-issue-comment +// GitHub API docs: https://docs.github.com/rest/issues/comments#delete-an-issue-comment +// +//meta:operation DELETE /repos/{owner}/{repo}/issues/comments/{comment_id} func (s *IssuesService) DeleteComment(ctx context.Context, owner string, repo string, commentID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/comments/%d", owner, repo, commentID) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/issues_events.go b/github/issues_events.go index 0305fca1168..23a16bcdc72 100644 --- a/github/issues_events.go +++ b/github/issues_events.go @@ -101,7 +101,9 @@ type DismissedReview struct { // ListIssueEvents lists events for the specified issue. // -// GitHub API docs: https://docs.github.com/en/rest/issues/events#list-issue-events +// GitHub API docs: https://docs.github.com/rest/issues/events#list-issue-events +// +//meta:operation GET /repos/{owner}/{repo}/issues/{issue_number}/events func (s *IssuesService) ListIssueEvents(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*IssueEvent, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%v/events", owner, repo, number) u, err := addOptions(u, opts) @@ -127,7 +129,9 @@ func (s *IssuesService) ListIssueEvents(ctx context.Context, owner, repo string, // ListRepositoryEvents lists events for the specified repository. // -// GitHub API docs: https://docs.github.com/en/rest/issues/events#list-issue-events-for-a-repository +// GitHub API docs: https://docs.github.com/rest/issues/events#list-issue-events-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/issues/events func (s *IssuesService) ListRepositoryEvents(ctx context.Context, owner, repo string, opts *ListOptions) ([]*IssueEvent, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/events", owner, repo) u, err := addOptions(u, opts) @@ -151,7 +155,9 @@ func (s *IssuesService) ListRepositoryEvents(ctx context.Context, owner, repo st // GetEvent returns the specified issue event. // -// GitHub API docs: https://docs.github.com/en/rest/issues/events#get-an-issue-event +// GitHub API docs: https://docs.github.com/rest/issues/events#get-an-issue-event +// +//meta:operation GET /repos/{owner}/{repo}/issues/events/{event_id} func (s *IssuesService) GetEvent(ctx context.Context, owner, repo string, id int64) (*IssueEvent, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/events/%v", owner, repo, id) diff --git a/github/issues_labels.go b/github/issues_labels.go index d0f865c03f1..51e7fe6a55b 100644 --- a/github/issues_labels.go +++ b/github/issues_labels.go @@ -27,7 +27,9 @@ func (l Label) String() string { // ListLabels lists all labels for a repository. // -// GitHub API docs: https://docs.github.com/en/rest/issues/labels#list-labels-for-a-repository +// GitHub API docs: https://docs.github.com/rest/issues/labels#list-labels-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/labels func (s *IssuesService) ListLabels(ctx context.Context, owner string, repo string, opts *ListOptions) ([]*Label, *Response, error) { u := fmt.Sprintf("repos/%v/%v/labels", owner, repo) u, err := addOptions(u, opts) @@ -51,7 +53,9 @@ func (s *IssuesService) ListLabels(ctx context.Context, owner string, repo strin // GetLabel gets a single label. // -// GitHub API docs: https://docs.github.com/en/rest/issues/labels#get-a-label +// GitHub API docs: https://docs.github.com/rest/issues/labels#get-a-label +// +//meta:operation GET /repos/{owner}/{repo}/labels/{name} func (s *IssuesService) GetLabel(ctx context.Context, owner string, repo string, name string) (*Label, *Response, error) { u := fmt.Sprintf("repos/%v/%v/labels/%v", owner, repo, name) req, err := s.client.NewRequest("GET", u, nil) @@ -70,7 +74,9 @@ func (s *IssuesService) GetLabel(ctx context.Context, owner string, repo string, // CreateLabel creates a new label on the specified repository. // -// GitHub API docs: https://docs.github.com/en/rest/issues/labels#create-a-label +// GitHub API docs: https://docs.github.com/rest/issues/labels#create-a-label +// +//meta:operation POST /repos/{owner}/{repo}/labels func (s *IssuesService) CreateLabel(ctx context.Context, owner string, repo string, label *Label) (*Label, *Response, error) { u := fmt.Sprintf("repos/%v/%v/labels", owner, repo) req, err := s.client.NewRequest("POST", u, label) @@ -89,7 +95,9 @@ func (s *IssuesService) CreateLabel(ctx context.Context, owner string, repo stri // EditLabel edits a label. // -// GitHub API docs: https://docs.github.com/en/rest/issues/labels#update-a-label +// GitHub API docs: https://docs.github.com/rest/issues/labels#update-a-label +// +//meta:operation PATCH /repos/{owner}/{repo}/labels/{name} func (s *IssuesService) EditLabel(ctx context.Context, owner string, repo string, name string, label *Label) (*Label, *Response, error) { u := fmt.Sprintf("repos/%v/%v/labels/%v", owner, repo, name) req, err := s.client.NewRequest("PATCH", u, label) @@ -108,7 +116,9 @@ func (s *IssuesService) EditLabel(ctx context.Context, owner string, repo string // DeleteLabel deletes a label. // -// GitHub API docs: https://docs.github.com/en/rest/issues/labels#delete-a-label +// GitHub API docs: https://docs.github.com/rest/issues/labels#delete-a-label +// +//meta:operation DELETE /repos/{owner}/{repo}/labels/{name} func (s *IssuesService) DeleteLabel(ctx context.Context, owner string, repo string, name string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/labels/%v", owner, repo, name) req, err := s.client.NewRequest("DELETE", u, nil) @@ -120,7 +130,9 @@ func (s *IssuesService) DeleteLabel(ctx context.Context, owner string, repo stri // ListLabelsByIssue lists all labels for an issue. // -// GitHub API docs: https://docs.github.com/en/rest/issues/labels#list-labels-for-an-issue +// GitHub API docs: https://docs.github.com/rest/issues/labels#list-labels-for-an-issue +// +//meta:operation GET /repos/{owner}/{repo}/issues/{issue_number}/labels func (s *IssuesService) ListLabelsByIssue(ctx context.Context, owner string, repo string, number int, opts *ListOptions) ([]*Label, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number) u, err := addOptions(u, opts) @@ -144,7 +156,9 @@ func (s *IssuesService) ListLabelsByIssue(ctx context.Context, owner string, rep // AddLabelsToIssue adds labels to an issue. // -// GitHub API docs: https://docs.github.com/en/rest/issues/labels#add-labels-to-an-issue +// GitHub API docs: https://docs.github.com/rest/issues/labels#add-labels-to-an-issue +// +//meta:operation POST /repos/{owner}/{repo}/issues/{issue_number}/labels func (s *IssuesService) AddLabelsToIssue(ctx context.Context, owner string, repo string, number int, labels []string) ([]*Label, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number) req, err := s.client.NewRequest("POST", u, labels) @@ -163,7 +177,9 @@ func (s *IssuesService) AddLabelsToIssue(ctx context.Context, owner string, repo // RemoveLabelForIssue removes a label for an issue. // -// GitHub API docs: https://docs.github.com/en/rest/issues/labels#remove-a-label-from-an-issue +// GitHub API docs: https://docs.github.com/rest/issues/labels#remove-a-label-from-an-issue +// +//meta:operation DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels/{name} func (s *IssuesService) RemoveLabelForIssue(ctx context.Context, owner string, repo string, number int, label string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%d/labels/%v", owner, repo, number, label) req, err := s.client.NewRequest("DELETE", u, nil) @@ -176,7 +192,9 @@ func (s *IssuesService) RemoveLabelForIssue(ctx context.Context, owner string, r // ReplaceLabelsForIssue replaces all labels for an issue. // -// GitHub API docs: https://docs.github.com/en/rest/issues/labels#set-labels-for-an-issue +// GitHub API docs: https://docs.github.com/rest/issues/labels#set-labels-for-an-issue +// +//meta:operation PUT /repos/{owner}/{repo}/issues/{issue_number}/labels func (s *IssuesService) ReplaceLabelsForIssue(ctx context.Context, owner string, repo string, number int, labels []string) ([]*Label, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number) req, err := s.client.NewRequest("PUT", u, labels) @@ -195,7 +213,9 @@ func (s *IssuesService) ReplaceLabelsForIssue(ctx context.Context, owner string, // RemoveLabelsForIssue removes all labels for an issue. // -// GitHub API docs: https://docs.github.com/en/rest/issues/labels#remove-all-labels-from-an-issue +// GitHub API docs: https://docs.github.com/rest/issues/labels#remove-all-labels-from-an-issue +// +//meta:operation DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels func (s *IssuesService) RemoveLabelsForIssue(ctx context.Context, owner string, repo string, number int) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%d/labels", owner, repo, number) req, err := s.client.NewRequest("DELETE", u, nil) @@ -208,7 +228,9 @@ func (s *IssuesService) RemoveLabelsForIssue(ctx context.Context, owner string, // ListLabelsForMilestone lists labels for every issue in a milestone. // -// GitHub API docs: https://docs.github.com/en/rest/issues/labels#list-labels-for-issues-in-a-milestone +// GitHub API docs: https://docs.github.com/rest/issues/labels#list-labels-for-issues-in-a-milestone +// +//meta:operation GET /repos/{owner}/{repo}/milestones/{milestone_number}/labels func (s *IssuesService) ListLabelsForMilestone(ctx context.Context, owner string, repo string, number int, opts *ListOptions) ([]*Label, *Response, error) { u := fmt.Sprintf("repos/%v/%v/milestones/%d/labels", owner, repo, number) u, err := addOptions(u, opts) diff --git a/github/issues_milestones.go b/github/issues_milestones.go index 897c7c0b6da..6c31bcd054d 100644 --- a/github/issues_milestones.go +++ b/github/issues_milestones.go @@ -54,7 +54,9 @@ type MilestoneListOptions struct { // ListMilestones lists all milestones for a repository. // -// GitHub API docs: https://docs.github.com/en/rest/issues/milestones#list-milestones +// GitHub API docs: https://docs.github.com/rest/issues/milestones#list-milestones +// +//meta:operation GET /repos/{owner}/{repo}/milestones func (s *IssuesService) ListMilestones(ctx context.Context, owner string, repo string, opts *MilestoneListOptions) ([]*Milestone, *Response, error) { u := fmt.Sprintf("repos/%v/%v/milestones", owner, repo) u, err := addOptions(u, opts) @@ -78,7 +80,9 @@ func (s *IssuesService) ListMilestones(ctx context.Context, owner string, repo s // GetMilestone gets a single milestone. // -// GitHub API docs: https://docs.github.com/en/rest/issues/milestones#get-a-milestone +// GitHub API docs: https://docs.github.com/rest/issues/milestones#get-a-milestone +// +//meta:operation GET /repos/{owner}/{repo}/milestones/{milestone_number} func (s *IssuesService) GetMilestone(ctx context.Context, owner string, repo string, number int) (*Milestone, *Response, error) { u := fmt.Sprintf("repos/%v/%v/milestones/%d", owner, repo, number) req, err := s.client.NewRequest("GET", u, nil) @@ -97,7 +101,9 @@ func (s *IssuesService) GetMilestone(ctx context.Context, owner string, repo str // CreateMilestone creates a new milestone on the specified repository. // -// GitHub API docs: https://docs.github.com/en/rest/issues/milestones#create-a-milestone +// GitHub API docs: https://docs.github.com/rest/issues/milestones#create-a-milestone +// +//meta:operation POST /repos/{owner}/{repo}/milestones func (s *IssuesService) CreateMilestone(ctx context.Context, owner string, repo string, milestone *Milestone) (*Milestone, *Response, error) { u := fmt.Sprintf("repos/%v/%v/milestones", owner, repo) req, err := s.client.NewRequest("POST", u, milestone) @@ -116,7 +122,9 @@ func (s *IssuesService) CreateMilestone(ctx context.Context, owner string, repo // EditMilestone edits a milestone. // -// GitHub API docs: https://docs.github.com/en/rest/issues/milestones#update-a-milestone +// GitHub API docs: https://docs.github.com/rest/issues/milestones#update-a-milestone +// +//meta:operation PATCH /repos/{owner}/{repo}/milestones/{milestone_number} func (s *IssuesService) EditMilestone(ctx context.Context, owner string, repo string, number int, milestone *Milestone) (*Milestone, *Response, error) { u := fmt.Sprintf("repos/%v/%v/milestones/%d", owner, repo, number) req, err := s.client.NewRequest("PATCH", u, milestone) @@ -135,7 +143,9 @@ func (s *IssuesService) EditMilestone(ctx context.Context, owner string, repo st // DeleteMilestone deletes a milestone. // -// GitHub API docs: https://docs.github.com/en/rest/issues/milestones#delete-a-milestone +// GitHub API docs: https://docs.github.com/rest/issues/milestones#delete-a-milestone +// +//meta:operation DELETE /repos/{owner}/{repo}/milestones/{milestone_number} func (s *IssuesService) DeleteMilestone(ctx context.Context, owner string, repo string, number int) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/milestones/%d", owner, repo, number) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/issues_timeline.go b/github/issues_timeline.go index 8ac02ac14dc..0aa589afe40 100644 --- a/github/issues_timeline.go +++ b/github/issues_timeline.go @@ -14,7 +14,7 @@ import ( // Timeline represents an event that occurred around an Issue or Pull Request. // // It is similar to an IssueEvent but may contain more information. -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/events/issue-event-types +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/events/issue-event-types type Timeline struct { ID *int64 `json:"id,omitempty"` URL *string `json:"url,omitempty"` @@ -166,7 +166,9 @@ type Source struct { // ListIssueTimeline lists events for the specified issue. // -// GitHub API docs: https://docs.github.com/en/rest/issues/timeline#list-timeline-events-for-an-issue +// GitHub API docs: https://docs.github.com/rest/issues/timeline#list-timeline-events-for-an-issue +// +//meta:operation GET /repos/{owner}/{repo}/issues/{issue_number}/timeline func (s *IssuesService) ListIssueTimeline(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*Timeline, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%v/timeline", owner, repo, number) u, err := addOptions(u, opts) diff --git a/github/licenses.go b/github/licenses.go index 0877b6d1831..34b8a3d8af1 100644 --- a/github/licenses.go +++ b/github/licenses.go @@ -13,7 +13,7 @@ import ( // LicensesService handles communication with the license related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/en/rest/licenses/ +// GitHub API docs: https://docs.github.com/rest/licenses/ type LicensesService service // RepositoryLicense represents the license for a repository. @@ -60,7 +60,9 @@ func (l License) String() string { // List popular open source licenses. // -// GitHub API docs: https://docs.github.com/en/rest/licenses/#list-all-licenses +// GitHub API docs: https://docs.github.com/rest/licenses/licenses#get-all-commonly-used-licenses +// +//meta:operation GET /licenses func (s *LicensesService) List(ctx context.Context) ([]*License, *Response, error) { req, err := s.client.NewRequest("GET", "licenses", nil) if err != nil { @@ -78,7 +80,9 @@ func (s *LicensesService) List(ctx context.Context) ([]*License, *Response, erro // Get extended metadata for one license. // -// GitHub API docs: https://docs.github.com/en/rest/licenses#get-a-license +// GitHub API docs: https://docs.github.com/rest/licenses/licenses#get-a-license +// +//meta:operation GET /licenses/{license} func (s *LicensesService) Get(ctx context.Context, licenseName string) (*License, *Response, error) { u := fmt.Sprintf("licenses/%s", licenseName) diff --git a/github/markdown.go b/github/markdown.go index 48b445b3d85..fe3b31128d5 100644 --- a/github/markdown.go +++ b/github/markdown.go @@ -41,6 +41,8 @@ type markdownRenderRequest struct { // Render renders an arbitrary Render document. // // GitHub API docs: https://docs.github.com/rest/markdown/markdown#render-a-markdown-document +// +//meta:operation POST /markdown func (s *MarkdownService) Render(ctx context.Context, text string, opts *MarkdownOptions) (string, *Response, error) { request := &markdownRenderRequest{Text: String(text)} if opts != nil { diff --git a/github/messages.go b/github/messages.go index 0d9811549c2..72edbd9feef 100644 --- a/github/messages.go +++ b/github/messages.go @@ -281,14 +281,14 @@ func ValidateSignature(signature string, payload, secretToken []byte) error { // WebHookType returns the event type of webhook request r. // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/events/github-event-types +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/events/github-event-types func WebHookType(r *http.Request) string { return r.Header.Get(EventTypeHeader) } // DeliveryID returns the unique delivery ID of webhook request r. // -// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/events/github-event-types +// GitHub API docs: https://docs.github.com/developers/webhooks-and-events/events/github-event-types func DeliveryID(r *http.Request) string { return r.Header.Get(DeliveryIDHeader) } diff --git a/github/meta.go b/github/meta.go index 3e9743b00cb..1da8fcf1326 100644 --- a/github/meta.go +++ b/github/meta.go @@ -72,6 +72,8 @@ type APIMeta struct { // endpoint provides information about that installation. // // GitHub API docs: https://docs.github.com/rest/meta/meta#get-github-meta-information +// +//meta:operation GET /meta func (s *MetaService) Get(ctx context.Context) (*APIMeta, *Response, error) { req, err := s.client.NewRequest("GET", "meta", nil) if err != nil { @@ -98,6 +100,8 @@ func (c *Client) APIMeta(ctx context.Context) (*APIMeta, *Response, error) { // bubble. If message is empty, a random zen phrase is used. // // GitHub API docs: https://docs.github.com/rest/meta/meta#get-octocat +// +//meta:operation GET /octocat func (s *MetaService) Octocat(ctx context.Context, message string) (string, *Response, error) { u := "octocat" if message != "" { @@ -131,6 +135,8 @@ func (c *Client) Octocat(ctx context.Context, message string) (string, *Response // See also: http://warpspire.com/posts/taste/ // // GitHub API docs: https://docs.github.com/rest/meta/meta#get-the-zen-of-github +// +//meta:operation GET /zen func (s *MetaService) Zen(ctx context.Context) (string, *Response, error) { req, err := s.client.NewRequest("GET", "zen", nil) if err != nil { diff --git a/github/migrations.go b/github/migrations.go index 67989c0789f..5af8817050f 100644 --- a/github/migrations.go +++ b/github/migrations.go @@ -16,7 +16,7 @@ import ( // MigrationService provides access to the migration related functions // in the GitHub API. // -// GitHub API docs: https://docs.github.com/en/rest/migration/ +// GitHub API docs: https://docs.github.com/rest/migration/ type MigrationService service // Migration represents a GitHub migration (archival). @@ -74,7 +74,9 @@ type startMigration struct { // StartMigration starts the generation of a migration archive. // repos is a slice of repository names to migrate. // -// GitHub API docs: https://docs.github.com/en/rest/migrations/orgs#start-an-organization-migration +// GitHub API docs: https://docs.github.com/rest/migrations/orgs#start-an-organization-migration +// +//meta:operation POST /orgs/{org}/migrations func (s *MigrationService) StartMigration(ctx context.Context, org string, repos []string, opts *MigrationOptions) (*Migration, *Response, error) { u := fmt.Sprintf("orgs/%v/migrations", org) @@ -103,7 +105,9 @@ func (s *MigrationService) StartMigration(ctx context.Context, org string, repos // ListMigrations lists the most recent migrations. // -// GitHub API docs: https://docs.github.com/en/rest/migrations/orgs#list-organization-migrations +// GitHub API docs: https://docs.github.com/rest/migrations/orgs#list-organization-migrations +// +//meta:operation GET /orgs/{org}/migrations func (s *MigrationService) ListMigrations(ctx context.Context, org string, opts *ListOptions) ([]*Migration, *Response, error) { u := fmt.Sprintf("orgs/%v/migrations", org) u, err := addOptions(u, opts) @@ -131,7 +135,9 @@ func (s *MigrationService) ListMigrations(ctx context.Context, org string, opts // MigrationStatus gets the status of a specific migration archive. // id is the migration ID. // -// GitHub API docs: https://docs.github.com/en/rest/migrations/orgs#get-an-organization-migration-status +// GitHub API docs: https://docs.github.com/rest/migrations/orgs#get-an-organization-migration-status +// +//meta:operation GET /orgs/{org}/migrations/{migration_id} func (s *MigrationService) MigrationStatus(ctx context.Context, org string, id int64) (*Migration, *Response, error) { u := fmt.Sprintf("orgs/%v/migrations/%v", org, id) @@ -155,7 +161,9 @@ func (s *MigrationService) MigrationStatus(ctx context.Context, org string, id i // MigrationArchiveURL fetches a migration archive URL. // id is the migration ID. // -// GitHub API docs: https://docs.github.com/en/rest/migrations/orgs#download-an-organization-migration-archive +// GitHub API docs: https://docs.github.com/rest/migrations/orgs#download-an-organization-migration-archive +// +//meta:operation GET /orgs/{org}/migrations/{migration_id}/archive func (s *MigrationService) MigrationArchiveURL(ctx context.Context, org string, id int64) (url string, err error) { u := fmt.Sprintf("orgs/%v/migrations/%v/archive", org, id) @@ -192,7 +200,9 @@ func (s *MigrationService) MigrationArchiveURL(ctx context.Context, org string, // DeleteMigration deletes a previous migration archive. // id is the migration ID. // -// GitHub API docs: https://docs.github.com/en/rest/migrations/orgs#delete-an-organization-migration-archive +// GitHub API docs: https://docs.github.com/rest/migrations/orgs#delete-an-organization-migration-archive +// +//meta:operation DELETE /orgs/{org}/migrations/{migration_id}/archive func (s *MigrationService) DeleteMigration(ctx context.Context, org string, id int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/migrations/%v/archive", org, id) @@ -212,7 +222,9 @@ func (s *MigrationService) DeleteMigration(ctx context.Context, org string, id i // You should unlock each migrated repository and delete them when the migration // is complete and you no longer need the source data. // -// GitHub API docs: https://docs.github.com/en/rest/migrations/orgs#unlock-an-organization-repository +// GitHub API docs: https://docs.github.com/rest/migrations/orgs#unlock-an-organization-repository +// +//meta:operation DELETE /orgs/{org}/migrations/{migration_id}/repos/{repo_name}/lock func (s *MigrationService) UnlockRepo(ctx context.Context, org string, id int64, repo string) (*Response, error) { u := fmt.Sprintf("orgs/%v/migrations/%v/repos/%v/lock", org, id, repo) diff --git a/github/migrations_source_import.go b/github/migrations_source_import.go index 74a04b22a4e..3b161232f6a 100644 --- a/github/migrations_source_import.go +++ b/github/migrations_source_import.go @@ -115,7 +115,7 @@ func (i Import) String() string { // SourceImportAuthor identifies an author imported from a source repository. // -// GitHub API docs: https://docs.github.com/en/rest/migration/source_imports/#get-commit-authors +// GitHub API docs: https://docs.github.com/rest/migration/source_imports/#get-commit-authors type SourceImportAuthor struct { ID *int64 `json:"id,omitempty"` RemoteID *string `json:"remote_id,omitempty"` @@ -132,7 +132,7 @@ func (a SourceImportAuthor) String() string { // LargeFile identifies a file larger than 100MB found during a repository import. // -// GitHub API docs: https://docs.github.com/en/rest/migration/source_imports/#get-large-files +// GitHub API docs: https://docs.github.com/rest/migration/source_imports/#get-large-files type LargeFile struct { RefName *string `json:"ref_name,omitempty"` Path *string `json:"path,omitempty"` @@ -146,7 +146,9 @@ func (f LargeFile) String() string { // StartImport initiates a repository import. // -// GitHub API docs: https://docs.github.com/en/rest/migrations/source-imports#start-an-import +// GitHub API docs: https://docs.github.com/rest/migrations/source-imports#start-an-import +// +//meta:operation PUT /repos/{owner}/{repo}/import func (s *MigrationService) StartImport(ctx context.Context, owner, repo string, in *Import) (*Import, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import", owner, repo) req, err := s.client.NewRequest("PUT", u, in) @@ -165,7 +167,9 @@ func (s *MigrationService) StartImport(ctx context.Context, owner, repo string, // ImportProgress queries for the status and progress of an ongoing repository import. // -// GitHub API docs: https://docs.github.com/en/rest/migrations/source-imports#get-an-import-status +// GitHub API docs: https://docs.github.com/rest/migrations/source-imports#get-an-import-status +// +//meta:operation GET /repos/{owner}/{repo}/import func (s *MigrationService) ImportProgress(ctx context.Context, owner, repo string) (*Import, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import", owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -184,7 +188,9 @@ func (s *MigrationService) ImportProgress(ctx context.Context, owner, repo strin // UpdateImport initiates a repository import. // -// GitHub API docs: https://docs.github.com/en/rest/migrations/source-imports#update-an-import +// GitHub API docs: https://docs.github.com/rest/migrations/source-imports#update-an-import +// +//meta:operation PATCH /repos/{owner}/{repo}/import func (s *MigrationService) UpdateImport(ctx context.Context, owner, repo string, in *Import) (*Import, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import", owner, repo) req, err := s.client.NewRequest("PATCH", u, in) @@ -213,7 +219,9 @@ func (s *MigrationService) UpdateImport(ctx context.Context, owner, repo string, // This method and MapCommitAuthor allow you to provide correct Git author // information. // -// GitHub API docs: https://docs.github.com/en/rest/migrations/source-imports#get-commit-authors +// GitHub API docs: https://docs.github.com/rest/migrations/source-imports#get-commit-authors +// +//meta:operation GET /repos/{owner}/{repo}/import/authors func (s *MigrationService) CommitAuthors(ctx context.Context, owner, repo string) ([]*SourceImportAuthor, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import/authors", owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -234,7 +242,9 @@ func (s *MigrationService) CommitAuthors(ctx context.Context, owner, repo string // application can continue updating authors any time before you push new // commits to the repository. // -// GitHub API docs: https://docs.github.com/en/rest/migrations/source-imports#map-a-commit-author +// GitHub API docs: https://docs.github.com/rest/migrations/source-imports#map-a-commit-author +// +//meta:operation PATCH /repos/{owner}/{repo}/import/authors/{author_id} func (s *MigrationService) MapCommitAuthor(ctx context.Context, owner, repo string, id int64, author *SourceImportAuthor) (*SourceImportAuthor, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import/authors/%v", owner, repo, id) req, err := s.client.NewRequest("PATCH", u, author) @@ -255,7 +265,9 @@ func (s *MigrationService) MapCommitAuthor(ctx context.Context, owner, repo stri // files larger than 100MB. Only the UseLFS field on the provided Import is // used. // -// GitHub API docs: https://docs.github.com/en/rest/migrations/source-imports#update-git-lfs-preference +// GitHub API docs: https://docs.github.com/rest/migrations/source-imports#update-git-lfs-preference +// +//meta:operation PATCH /repos/{owner}/{repo}/import/lfs func (s *MigrationService) SetLFSPreference(ctx context.Context, owner, repo string, in *Import) (*Import, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import/lfs", owner, repo) req, err := s.client.NewRequest("PATCH", u, in) @@ -274,7 +286,9 @@ func (s *MigrationService) SetLFSPreference(ctx context.Context, owner, repo str // LargeFiles lists files larger than 100MB found during the import. // -// GitHub API docs: https://docs.github.com/en/rest/migrations/source-imports#get-large-files +// GitHub API docs: https://docs.github.com/rest/migrations/source-imports#get-large-files +// +//meta:operation GET /repos/{owner}/{repo}/import/large_files func (s *MigrationService) LargeFiles(ctx context.Context, owner, repo string) ([]*LargeFile, *Response, error) { u := fmt.Sprintf("repos/%v/%v/import/large_files", owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -293,7 +307,9 @@ func (s *MigrationService) LargeFiles(ctx context.Context, owner, repo string) ( // CancelImport stops an import for a repository. // -// GitHub API docs: https://docs.github.com/en/rest/migrations/source-imports#cancel-an-import +// GitHub API docs: https://docs.github.com/rest/migrations/source-imports#cancel-an-import +// +//meta:operation DELETE /repos/{owner}/{repo}/import func (s *MigrationService) CancelImport(ctx context.Context, owner, repo string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/import", owner, repo) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/migrations_user.go b/github/migrations_user.go index 6586fdb2d3f..1f907cd4ec2 100644 --- a/github/migrations_user.go +++ b/github/migrations_user.go @@ -67,7 +67,9 @@ type startUserMigration struct { // StartUserMigration starts the generation of a migration archive. // repos is a slice of repository names to migrate. // -// GitHub API docs: https://docs.github.com/en/rest/migrations/users#start-a-user-migration +// GitHub API docs: https://docs.github.com/rest/migrations/users#start-a-user-migration +// +//meta:operation POST /user/migrations func (s *MigrationService) StartUserMigration(ctx context.Context, repos []string, opts *UserMigrationOptions) (*UserMigration, *Response, error) { u := "user/migrations" @@ -96,7 +98,9 @@ func (s *MigrationService) StartUserMigration(ctx context.Context, repos []strin // ListUserMigrations lists the most recent migrations. // -// GitHub API docs: https://docs.github.com/en/rest/migrations/users#list-user-migrations +// GitHub API docs: https://docs.github.com/rest/migrations/users#list-user-migrations +// +//meta:operation GET /user/migrations func (s *MigrationService) ListUserMigrations(ctx context.Context, opts *ListOptions) ([]*UserMigration, *Response, error) { u := "user/migrations" u, err := addOptions(u, opts) @@ -124,7 +128,9 @@ func (s *MigrationService) ListUserMigrations(ctx context.Context, opts *ListOpt // UserMigrationStatus gets the status of a specific migration archive. // id is the migration ID. // -// GitHub API docs: https://docs.github.com/en/rest/migrations/users#get-a-user-migration-status +// GitHub API docs: https://docs.github.com/rest/migrations/users#get-a-user-migration-status +// +//meta:operation GET /user/migrations/{migration_id} func (s *MigrationService) UserMigrationStatus(ctx context.Context, id int64) (*UserMigration, *Response, error) { u := fmt.Sprintf("user/migrations/%v", id) @@ -148,7 +154,9 @@ func (s *MigrationService) UserMigrationStatus(ctx context.Context, id int64) (* // UserMigrationArchiveURL gets the URL for a specific migration archive. // id is the migration ID. // -// GitHub API docs: https://docs.github.com/en/rest/migrations/users#download-a-user-migration-archive +// GitHub API docs: https://docs.github.com/rest/migrations/users#download-a-user-migration-archive +// +//meta:operation GET /user/migrations/{migration_id}/archive func (s *MigrationService) UserMigrationArchiveURL(ctx context.Context, id int64) (string, error) { url := fmt.Sprintf("user/migrations/%v/archive", id) @@ -182,7 +190,9 @@ func (s *MigrationService) UserMigrationArchiveURL(ctx context.Context, id int64 // DeleteUserMigration will delete a previous migration archive. // id is the migration ID. // -// GitHub API docs: https://docs.github.com/en/rest/migrations/users#delete-a-user-migration-archive +// GitHub API docs: https://docs.github.com/rest/migrations/users#delete-a-user-migration-archive +// +//meta:operation DELETE /user/migrations/{migration_id}/archive func (s *MigrationService) DeleteUserMigration(ctx context.Context, id int64) (*Response, error) { url := fmt.Sprintf("user/migrations/%v/archive", id) @@ -202,7 +212,9 @@ func (s *MigrationService) DeleteUserMigration(ctx context.Context, id int64) (* // You should unlock each migrated repository and delete them when the migration // is complete and you no longer need the source data. // -// GitHub API docs: https://docs.github.com/en/rest/migrations/users#unlock-a-user-repository +// GitHub API docs: https://docs.github.com/rest/migrations/users#unlock-a-user-repository +// +//meta:operation DELETE /user/migrations/{migration_id}/repos/{repo_name}/lock func (s *MigrationService) UnlockUserRepo(ctx context.Context, id int64, repo string) (*Response, error) { url := fmt.Sprintf("user/migrations/%v/repos/%v/lock", id, repo) diff --git a/github/orgs.go b/github/orgs.go index 0c7e361b3fc..4d3465271b6 100644 --- a/github/orgs.go +++ b/github/orgs.go @@ -13,7 +13,7 @@ import ( // OrganizationsService provides access to the organization related functions // in the GitHub API. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/ +// GitHub API docs: https://docs.github.com/rest/orgs/ type OrganizationsService service // Organization represents a GitHub organization account. @@ -148,7 +148,9 @@ type OrganizationsListOptions struct { // listing the next set of organizations, use the ID of the last-returned organization // as the opts.Since parameter for the next call. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/orgs#list-organizations +// GitHub API docs: https://docs.github.com/rest/orgs/orgs#list-organizations +// +//meta:operation GET /organizations func (s *OrganizationsService) ListAll(ctx context.Context, opts *OrganizationsListOptions) ([]*Organization, *Response, error) { u, err := addOptions("organizations", opts) if err != nil { @@ -171,8 +173,11 @@ func (s *OrganizationsService) ListAll(ctx context.Context, opts *OrganizationsL // List the organizations for a user. Passing the empty string will list // organizations for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/orgs#list-organizations-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/rest/orgs/orgs#list-organizations-for-a-user +// GitHub API docs: https://docs.github.com/rest/orgs/orgs#list-organizations-for-a-user +// GitHub API docs: https://docs.github.com/rest/orgs/orgs#list-organizations-for-the-authenticated-user +// +//meta:operation GET /user/orgs +//meta:operation GET /users/{username}/orgs func (s *OrganizationsService) List(ctx context.Context, user string, opts *ListOptions) ([]*Organization, *Response, error) { var u string if user != "" { @@ -201,7 +206,9 @@ func (s *OrganizationsService) List(ctx context.Context, user string, opts *List // Get fetches an organization by name. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/orgs#get-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/orgs#get-an-organization +// +//meta:operation GET /orgs/{org} func (s *OrganizationsService) Get(ctx context.Context, org string) (*Organization, *Response, error) { u := fmt.Sprintf("orgs/%v", org) req, err := s.client.NewRequest("GET", u, nil) @@ -223,7 +230,9 @@ func (s *OrganizationsService) Get(ctx context.Context, org string) (*Organizati // GetByID fetches an organization. // -// Note: GetByID uses the undocumented GitHub API endpoint /organizations/:id. +// Note: GetByID uses the undocumented GitHub API endpoint "GET /organizations/{organization_id}". +// +//meta:operation GET /organizations/{organization_id} func (s *OrganizationsService) GetByID(ctx context.Context, id int64) (*Organization, *Response, error) { u := fmt.Sprintf("organizations/%d", id) req, err := s.client.NewRequest("GET", u, nil) @@ -242,7 +251,9 @@ func (s *OrganizationsService) GetByID(ctx context.Context, id int64) (*Organiza // Edit an organization. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/orgs#update-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/orgs#update-an-organization +// +//meta:operation PATCH /orgs/{org} func (s *OrganizationsService) Edit(ctx context.Context, name string, org *Organization) (*Organization, *Response, error) { u := fmt.Sprintf("orgs/%v", name) req, err := s.client.NewRequest("PATCH", u, org) @@ -264,7 +275,9 @@ func (s *OrganizationsService) Edit(ctx context.Context, name string, org *Organ // Delete an organization by name. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/orgs#delete-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/orgs#delete-an-organization +// +//meta:operation DELETE /orgs/{org} func (s *OrganizationsService) Delete(ctx context.Context, org string) (*Response, error) { u := fmt.Sprintf("orgs/%v", org) req, err := s.client.NewRequest("DELETE", u, nil) @@ -277,7 +290,9 @@ func (s *OrganizationsService) Delete(ctx context.Context, org string) (*Respons // ListInstallations lists installations for an organization. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/orgs#list-app-installations-for-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/orgs#list-app-installations-for-an-organization +// +//meta:operation GET /orgs/{org}/installations func (s *OrganizationsService) ListInstallations(ctx context.Context, org string, opts *ListOptions) (*OrganizationInstallations, *Response, error) { u := fmt.Sprintf("orgs/%v/installations", org) diff --git a/github/orgs_actions_allowed.go b/github/orgs_actions_allowed.go index c467c11546b..b115e094a4b 100644 --- a/github/orgs_actions_allowed.go +++ b/github/orgs_actions_allowed.go @@ -11,8 +11,11 @@ import ( // GetActionsAllowed gets the actions that are allowed in an organization. // -// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-an-organization // Deprecated: please use `client.Actions.GetActionsAllowed` instead. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/permissions/selected-actions func (s *OrganizationsService) GetActionsAllowed(ctx context.Context, org string) (*ActionsAllowed, *Response, error) { s2 := (*ActionsService)(s) return s2.GetActionsAllowed(ctx, org) @@ -20,8 +23,11 @@ func (s *OrganizationsService) GetActionsAllowed(ctx context.Context, org string // EditActionsAllowed sets the actions that are allowed in an organization. // -// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-an-organization // Deprecated: please use `client.Actions.EditActionsAllowed` instead. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-an-organization +// +//meta:operation PUT /orgs/{org}/actions/permissions/selected-actions func (s *OrganizationsService) EditActionsAllowed(ctx context.Context, org string, actionsAllowed ActionsAllowed) (*ActionsAllowed, *Response, error) { s2 := (*ActionsService)(s) return s2.EditActionsAllowed(ctx, org, actionsAllowed) diff --git a/github/orgs_actions_permissions.go b/github/orgs_actions_permissions.go index 607ffca7981..97df1c967e9 100644 --- a/github/orgs_actions_permissions.go +++ b/github/orgs_actions_permissions.go @@ -11,8 +11,11 @@ import ( // GetActionsPermissions gets the GitHub Actions permissions policy for repositories and allowed actions in an organization. // -// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#get-github-actions-permissions-for-an-organization // Deprecated: please use `client.Actions.GetActionsPermissions` instead. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions#get-github-actions-permissions-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/permissions func (s *OrganizationsService) GetActionsPermissions(ctx context.Context, org string) (*ActionsPermissions, *Response, error) { s2 := (*ActionsService)(s) return s2.GetActionsPermissions(ctx, org) @@ -20,8 +23,11 @@ func (s *OrganizationsService) GetActionsPermissions(ctx context.Context, org st // EditActionsPermissions sets the permissions policy for repositories and allowed actions in an organization. // -// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#set-github-actions-permissions-for-an-organization // Deprecated: please use `client.Actions.EditActionsPermissions` instead. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions#set-github-actions-permissions-for-an-organization +// +//meta:operation PUT /orgs/{org}/actions/permissions func (s *OrganizationsService) EditActionsPermissions(ctx context.Context, org string, actionsPermissions ActionsPermissions) (*ActionsPermissions, *Response, error) { s2 := (*ActionsService)(s) return s2.EditActionsPermissions(ctx, org, actionsPermissions) diff --git a/github/orgs_audit_log.go b/github/orgs_audit_log.go index e2f8fc24ffd..e3afd3117f5 100644 --- a/github/orgs_audit_log.go +++ b/github/orgs_audit_log.go @@ -41,7 +41,7 @@ type PolicyOverrideReason struct { } // AuditEntry describes the fields that may be represented by various audit-log "action" entries. -// For a list of actions see - https://docs.github.com/en/github/setting-up-and-managing-organizations-and-teams/reviewing-the-audit-log-for-your-organization#audit-log-actions +// For a list of actions see - https://docs.github.com/github/setting-up-and-managing-organizations-and-teams/reviewing-the-audit-log-for-your-organization#audit-log-actions type AuditEntry struct { ActorIP *string `json:"actor_ip,omitempty"` Action *string `json:"action,omitempty"` // The name of the action that was performed, for example `user.login` or `repo.create`. @@ -135,7 +135,9 @@ type AuditEntryData struct { // GetAuditLog gets the audit-log entries for an organization. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/orgs#get-the-audit-log-for-an-organization +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/orgs#get-the-audit-log-for-an-organization +// +//meta:operation GET /orgs/{org}/audit-log func (s *OrganizationsService) GetAuditLog(ctx context.Context, org string, opts *GetAuditLogOptions) ([]*AuditEntry, *Response, error) { u := fmt.Sprintf("orgs/%v/audit-log", org) u, err := addOptions(u, opts) diff --git a/github/orgs_credential_authorizations.go b/github/orgs_credential_authorizations.go index 6d56fe8f79a..eed0f0c66e0 100644 --- a/github/orgs_credential_authorizations.go +++ b/github/orgs_credential_authorizations.go @@ -58,7 +58,9 @@ type CredentialAuthorization struct { // ListCredentialAuthorizations lists credentials authorized through SAML SSO // for a given organization. Only available with GitHub Enterprise Cloud. // -// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/orgs/orgs?apiVersion=2022-11-28#list-saml-sso-authorizations-for-an-organization +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/orgs#list-saml-sso-authorizations-for-an-organization +// +//meta:operation GET /orgs/{org}/credential-authorizations func (s *OrganizationsService) ListCredentialAuthorizations(ctx context.Context, org string, opts *ListOptions) ([]*CredentialAuthorization, *Response, error) { u := fmt.Sprintf("orgs/%v/credential-authorizations", org) u, err := addOptions(u, opts) @@ -83,7 +85,9 @@ func (s *OrganizationsService) ListCredentialAuthorizations(ctx context.Context, // RemoveCredentialAuthorization revokes the SAML SSO authorization for a given // credential within an organization. Only available with GitHub Enterprise Cloud. // -// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/orgs/orgs?apiVersion=2022-11-28#remove-a-saml-sso-authorization-for-an-organization +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/orgs#remove-a-saml-sso-authorization-for-an-organization +// +//meta:operation DELETE /orgs/{org}/credential-authorizations/{credential_id} func (s *OrganizationsService) RemoveCredentialAuthorization(ctx context.Context, org string, credentialID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/credential-authorizations/%v", org, credentialID) req, err := s.client.NewRequest(http.MethodDelete, u, nil) diff --git a/github/orgs_custom_roles.go b/github/orgs_custom_roles.go index 7c1b2d6292d..45de896a2f9 100644 --- a/github/orgs_custom_roles.go +++ b/github/orgs_custom_roles.go @@ -17,7 +17,7 @@ type OrganizationCustomRepoRoles struct { } // CustomRepoRoles represents custom repository roles for an organization. -// See https://docs.github.com/en/enterprise-cloud@latest/organizations/managing-peoples-access-to-your-organization-with-roles/managing-custom-repository-roles-for-an-organization +// See https://docs.github.com/enterprise-cloud@latest/organizations/managing-peoples-access-to-your-organization-with-roles/managing-custom-repository-roles-for-an-organization // for more information. type CustomRepoRoles struct { ID *int64 `json:"id,omitempty"` @@ -30,7 +30,9 @@ type CustomRepoRoles struct { // ListCustomRepoRoles lists the custom repository roles available in this organization. // In order to see custom repository roles in an organization, the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/custom-roles#list-custom-repository-roles-in-an-organization +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/custom-roles#list-custom-repository-roles-in-an-organization +// +//meta:operation GET /orgs/{org}/custom-repository-roles func (s *OrganizationsService) ListCustomRepoRoles(ctx context.Context, org string) (*OrganizationCustomRepoRoles, *Response, error) { u := fmt.Sprintf("orgs/%v/custom-repository-roles", org) @@ -59,7 +61,9 @@ type CreateOrUpdateCustomRoleOptions struct { // CreateCustomRepoRole creates a custom repository role in this organization. // In order to create custom repository roles in an organization, the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/custom-roles#create-a-custom-repository-role +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/custom-roles#create-a-custom-repository-role +// +//meta:operation POST /orgs/{org}/custom-repository-roles func (s *OrganizationsService) CreateCustomRepoRole(ctx context.Context, org string, opts *CreateOrUpdateCustomRoleOptions) (*CustomRepoRoles, *Response, error) { u := fmt.Sprintf("orgs/%v/custom-repository-roles", org) @@ -80,7 +84,9 @@ func (s *OrganizationsService) CreateCustomRepoRole(ctx context.Context, org str // UpdateCustomRepoRole updates a custom repository role in this organization. // In order to update custom repository roles in an organization, the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/custom-roles#update-a-custom-repository-role +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/custom-roles#update-a-custom-repository-role +// +//meta:operation PATCH /orgs/{org}/custom-repository-roles/{role_id} func (s *OrganizationsService) UpdateCustomRepoRole(ctx context.Context, org, roleID string, opts *CreateOrUpdateCustomRoleOptions) (*CustomRepoRoles, *Response, error) { u := fmt.Sprintf("orgs/%v/custom-repository-roles/%v", org, roleID) @@ -101,7 +107,9 @@ func (s *OrganizationsService) UpdateCustomRepoRole(ctx context.Context, org, ro // DeleteCustomRepoRole deletes an existing custom repository role in this organization. // In order to delete custom repository roles in an organization, the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/custom-roles#delete-a-custom-repository-role +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/orgs/custom-roles#delete-a-custom-repository-role +// +//meta:operation DELETE /orgs/{org}/custom-repository-roles/{role_id} func (s *OrganizationsService) DeleteCustomRepoRole(ctx context.Context, org, roleID string) (*Response, error) { u := fmt.Sprintf("orgs/%v/custom-repository-roles/%v", org, roleID) diff --git a/github/orgs_hooks.go b/github/orgs_hooks.go index c0dd51e24e3..c2eef77c92e 100644 --- a/github/orgs_hooks.go +++ b/github/orgs_hooks.go @@ -12,7 +12,9 @@ import ( // ListHooks lists all Hooks for the specified organization. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/webhooks#list-organization-webhooks +// GitHub API docs: https://docs.github.com/rest/orgs/webhooks#list-organization-webhooks +// +//meta:operation GET /orgs/{org}/hooks func (s *OrganizationsService) ListHooks(ctx context.Context, org string, opts *ListOptions) ([]*Hook, *Response, error) { u := fmt.Sprintf("orgs/%v/hooks", org) u, err := addOptions(u, opts) @@ -36,7 +38,9 @@ func (s *OrganizationsService) ListHooks(ctx context.Context, org string, opts * // GetHook returns a single specified Hook. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/webhooks#get-an-organization-webhook +// GitHub API docs: https://docs.github.com/rest/orgs/webhooks#get-an-organization-webhook +// +//meta:operation GET /orgs/{org}/hooks/{hook_id} func (s *OrganizationsService) GetHook(ctx context.Context, org string, id int64) (*Hook, *Response, error) { u := fmt.Sprintf("orgs/%v/hooks/%d", org, id) req, err := s.client.NewRequest("GET", u, nil) @@ -59,7 +63,9 @@ func (s *OrganizationsService) GetHook(ctx context.Context, org string, id int64 // Note that only a subset of the hook fields are used and hook must // not be nil. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/webhooks#create-an-organization-webhook +// GitHub API docs: https://docs.github.com/rest/orgs/webhooks#create-an-organization-webhook +// +//meta:operation POST /orgs/{org}/hooks func (s *OrganizationsService) CreateHook(ctx context.Context, org string, hook *Hook) (*Hook, *Response, error) { u := fmt.Sprintf("orgs/%v/hooks", org) @@ -86,7 +92,9 @@ func (s *OrganizationsService) CreateHook(ctx context.Context, org string, hook // EditHook updates a specified Hook. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/webhooks#update-an-organization-webhook +// GitHub API docs: https://docs.github.com/rest/orgs/webhooks#update-an-organization-webhook +// +//meta:operation PATCH /orgs/{org}/hooks/{hook_id} func (s *OrganizationsService) EditHook(ctx context.Context, org string, id int64, hook *Hook) (*Hook, *Response, error) { u := fmt.Sprintf("orgs/%v/hooks/%d", org, id) req, err := s.client.NewRequest("PATCH", u, hook) @@ -105,7 +113,9 @@ func (s *OrganizationsService) EditHook(ctx context.Context, org string, id int6 // PingHook triggers a 'ping' event to be sent to the Hook. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/webhooks#ping-an-organization-webhook +// GitHub API docs: https://docs.github.com/rest/orgs/webhooks#ping-an-organization-webhook +// +//meta:operation POST /orgs/{org}/hooks/{hook_id}/pings func (s *OrganizationsService) PingHook(ctx context.Context, org string, id int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/hooks/%d/pings", org, id) req, err := s.client.NewRequest("POST", u, nil) @@ -118,7 +128,9 @@ func (s *OrganizationsService) PingHook(ctx context.Context, org string, id int6 // DeleteHook deletes a specified Hook. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/webhooks#delete-an-organization-webhook +// GitHub API docs: https://docs.github.com/rest/orgs/webhooks#delete-an-organization-webhook +// +//meta:operation DELETE /orgs/{org}/hooks/{hook_id} func (s *OrganizationsService) DeleteHook(ctx context.Context, org string, id int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/hooks/%d", org, id) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/orgs_hooks_configuration.go b/github/orgs_hooks_configuration.go index 953a2329c36..aeb616fc4c7 100644 --- a/github/orgs_hooks_configuration.go +++ b/github/orgs_hooks_configuration.go @@ -12,7 +12,9 @@ import ( // GetHookConfiguration returns the configuration for the specified organization webhook. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/webhooks?apiVersion=2022-11-28#get-a-webhook-configuration-for-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/webhooks#get-a-webhook-configuration-for-an-organization +// +//meta:operation GET /orgs/{org}/hooks/{hook_id}/config func (s *OrganizationsService) GetHookConfiguration(ctx context.Context, org string, id int64) (*HookConfig, *Response, error) { u := fmt.Sprintf("orgs/%v/hooks/%v/config", org, id) req, err := s.client.NewRequest("GET", u, nil) @@ -31,7 +33,9 @@ func (s *OrganizationsService) GetHookConfiguration(ctx context.Context, org str // EditHookConfiguration updates the configuration for the specified organization webhook. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/webhooks?apiVersion=2022-11-28#update-a-webhook-configuration-for-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/webhooks#update-a-webhook-configuration-for-an-organization +// +//meta:operation PATCH /orgs/{org}/hooks/{hook_id}/config func (s *OrganizationsService) EditHookConfiguration(ctx context.Context, org string, id int64, config *HookConfig) (*HookConfig, *Response, error) { u := fmt.Sprintf("orgs/%v/hooks/%v/config", org, id) req, err := s.client.NewRequest("PATCH", u, config) diff --git a/github/orgs_hooks_deliveries.go b/github/orgs_hooks_deliveries.go index 1bfad409ea5..c1c30124028 100644 --- a/github/orgs_hooks_deliveries.go +++ b/github/orgs_hooks_deliveries.go @@ -12,7 +12,9 @@ import ( // ListHookDeliveries lists webhook deliveries for a webhook configured in an organization. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/webhooks#list-deliveries-for-an-organization-webhook +// GitHub API docs: https://docs.github.com/rest/orgs/webhooks#list-deliveries-for-an-organization-webhook +// +//meta:operation GET /orgs/{org}/hooks/{hook_id}/deliveries func (s *OrganizationsService) ListHookDeliveries(ctx context.Context, org string, id int64, opts *ListCursorOptions) ([]*HookDelivery, *Response, error) { u := fmt.Sprintf("orgs/%v/hooks/%v/deliveries", org, id) u, err := addOptions(u, opts) @@ -36,7 +38,9 @@ func (s *OrganizationsService) ListHookDeliveries(ctx context.Context, org strin // GetHookDelivery returns a delivery for a webhook configured in an organization. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/webhooks#get-a-webhook-delivery-for-an-organization-webhook +// GitHub API docs: https://docs.github.com/rest/orgs/webhooks#get-a-webhook-delivery-for-an-organization-webhook +// +//meta:operation GET /orgs/{org}/hooks/{hook_id}/deliveries/{delivery_id} func (s *OrganizationsService) GetHookDelivery(ctx context.Context, owner string, hookID, deliveryID int64) (*HookDelivery, *Response, error) { u := fmt.Sprintf("orgs/%v/hooks/%v/deliveries/%v", owner, hookID, deliveryID) req, err := s.client.NewRequest("GET", u, nil) @@ -55,7 +59,9 @@ func (s *OrganizationsService) GetHookDelivery(ctx context.Context, owner string // RedeliverHookDelivery redelivers a delivery for a webhook configured in an organization. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/webhooks#redeliver-a-delivery-for-an-organization-webhook +// GitHub API docs: https://docs.github.com/rest/orgs/webhooks#redeliver-a-delivery-for-an-organization-webhook +// +//meta:operation POST /orgs/{org}/hooks/{hook_id}/deliveries/{delivery_id}/attempts func (s *OrganizationsService) RedeliverHookDelivery(ctx context.Context, owner string, hookID, deliveryID int64) (*HookDelivery, *Response, error) { u := fmt.Sprintf("orgs/%v/hooks/%v/deliveries/%v/attempts", owner, hookID, deliveryID) req, err := s.client.NewRequest("POST", u, nil) diff --git a/github/orgs_members.go b/github/orgs_members.go index 79f8a653333..5bc23657fcd 100644 --- a/github/orgs_members.go +++ b/github/orgs_members.go @@ -71,8 +71,11 @@ type ListMembersOptions struct { // user is an owner of the organization, this will return both concealed and // public members, otherwise it will only return public members. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/members#list-organization-members -// GitHub API docs: https://docs.github.com/en/rest/orgs/members#list-public-organization-members +// GitHub API docs: https://docs.github.com/rest/orgs/members#list-organization-members +// GitHub API docs: https://docs.github.com/rest/orgs/members#list-public-organization-members +// +//meta:operation GET /orgs/{org}/members +//meta:operation GET /orgs/{org}/public_members func (s *OrganizationsService) ListMembers(ctx context.Context, org string, opts *ListMembersOptions) ([]*User, *Response, error) { var u string if opts != nil && opts.PublicOnly { @@ -101,7 +104,9 @@ func (s *OrganizationsService) ListMembers(ctx context.Context, org string, opts // IsMember checks if a user is a member of an organization. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/members#check-organization-membership-for-a-user +// GitHub API docs: https://docs.github.com/rest/orgs/members#check-organization-membership-for-a-user +// +//meta:operation GET /orgs/{org}/members/{username} func (s *OrganizationsService) IsMember(ctx context.Context, org, user string) (bool, *Response, error) { u := fmt.Sprintf("orgs/%v/members/%v", org, user) req, err := s.client.NewRequest("GET", u, nil) @@ -116,7 +121,9 @@ func (s *OrganizationsService) IsMember(ctx context.Context, org, user string) ( // IsPublicMember checks if a user is a public member of an organization. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/members#check-public-organization-membership-for-a-user +// GitHub API docs: https://docs.github.com/rest/orgs/members#check-public-organization-membership-for-a-user +// +//meta:operation GET /orgs/{org}/public_members/{username} func (s *OrganizationsService) IsPublicMember(ctx context.Context, org, user string) (bool, *Response, error) { u := fmt.Sprintf("orgs/%v/public_members/%v", org, user) req, err := s.client.NewRequest("GET", u, nil) @@ -131,7 +138,9 @@ func (s *OrganizationsService) IsPublicMember(ctx context.Context, org, user str // RemoveMember removes a user from all teams of an organization. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/members#remove-an-organization-member +// GitHub API docs: https://docs.github.com/rest/orgs/members#remove-an-organization-member +// +//meta:operation DELETE /orgs/{org}/members/{username} func (s *OrganizationsService) RemoveMember(ctx context.Context, org, user string) (*Response, error) { u := fmt.Sprintf("orgs/%v/members/%v", org, user) req, err := s.client.NewRequest("DELETE", u, nil) @@ -145,7 +154,9 @@ func (s *OrganizationsService) RemoveMember(ctx context.Context, org, user strin // PublicizeMembership publicizes a user's membership in an organization. (A // user cannot publicize the membership for another user.) // -// GitHub API docs: https://docs.github.com/en/rest/orgs/members#set-public-organization-membership-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/orgs/members#set-public-organization-membership-for-the-authenticated-user +// +//meta:operation PUT /orgs/{org}/public_members/{username} func (s *OrganizationsService) PublicizeMembership(ctx context.Context, org, user string) (*Response, error) { u := fmt.Sprintf("orgs/%v/public_members/%v", org, user) req, err := s.client.NewRequest("PUT", u, nil) @@ -158,7 +169,9 @@ func (s *OrganizationsService) PublicizeMembership(ctx context.Context, org, use // ConcealMembership conceals a user's membership in an organization. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/members#remove-public-organization-membership-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/orgs/members#remove-public-organization-membership-for-the-authenticated-user +// +//meta:operation DELETE /orgs/{org}/public_members/{username} func (s *OrganizationsService) ConcealMembership(ctx context.Context, org, user string) (*Response, error) { u := fmt.Sprintf("orgs/%v/public_members/%v", org, user) req, err := s.client.NewRequest("DELETE", u, nil) @@ -181,7 +194,9 @@ type ListOrgMembershipsOptions struct { // ListOrgMemberships lists the organization memberships for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/members#list-organization-memberships-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/orgs/members#list-organization-memberships-for-the-authenticated-user +// +//meta:operation GET /user/memberships/orgs func (s *OrganizationsService) ListOrgMemberships(ctx context.Context, opts *ListOrgMembershipsOptions) ([]*Membership, *Response, error) { u := "user/memberships/orgs" u, err := addOptions(u, opts) @@ -207,8 +222,11 @@ func (s *OrganizationsService) ListOrgMemberships(ctx context.Context, opts *Lis // Passing an empty string for user will get the membership for the // authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/members#get-an-organization-membership-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/rest/orgs/members#get-organization-membership-for-a-user +// GitHub API docs: https://docs.github.com/rest/orgs/members#get-an-organization-membership-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/orgs/members#get-organization-membership-for-a-user +// +//meta:operation GET /orgs/{org}/memberships/{username} +//meta:operation GET /user/memberships/orgs/{org} func (s *OrganizationsService) GetOrgMembership(ctx context.Context, user, org string) (*Membership, *Response, error) { var u string if user != "" { @@ -235,8 +253,11 @@ func (s *OrganizationsService) GetOrgMembership(ctx context.Context, user, org s // Passing an empty string for user will edit the membership for the // authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/members#update-an-organization-membership-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/rest/orgs/members#set-organization-membership-for-a-user +// GitHub API docs: https://docs.github.com/rest/orgs/members#set-organization-membership-for-a-user +// GitHub API docs: https://docs.github.com/rest/orgs/members#update-an-organization-membership-for-the-authenticated-user +// +//meta:operation PUT /orgs/{org}/memberships/{username} +//meta:operation PATCH /user/memberships/orgs/{org} func (s *OrganizationsService) EditOrgMembership(ctx context.Context, user, org string, membership *Membership) (*Membership, *Response, error) { var u, method string if user != "" { @@ -264,7 +285,9 @@ func (s *OrganizationsService) EditOrgMembership(ctx context.Context, user, org // RemoveOrgMembership removes user from the specified organization. If the // user has been invited to the organization, this will cancel their invitation. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/members#remove-organization-membership-for-a-user +// GitHub API docs: https://docs.github.com/rest/orgs/members#remove-organization-membership-for-a-user +// +//meta:operation DELETE /orgs/{org}/memberships/{username} func (s *OrganizationsService) RemoveOrgMembership(ctx context.Context, user, org string) (*Response, error) { u := fmt.Sprintf("orgs/%v/memberships/%v", org, user) req, err := s.client.NewRequest("DELETE", u, nil) @@ -277,7 +300,9 @@ func (s *OrganizationsService) RemoveOrgMembership(ctx context.Context, user, or // ListPendingOrgInvitations returns a list of pending invitations. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/members#list-pending-organization-invitations +// GitHub API docs: https://docs.github.com/rest/orgs/members#list-pending-organization-invitations +// +//meta:operation GET /orgs/{org}/invitations func (s *OrganizationsService) ListPendingOrgInvitations(ctx context.Context, org string, opts *ListOptions) ([]*Invitation, *Response, error) { u := fmt.Sprintf("orgs/%v/invitations", org) u, err := addOptions(u, opts) @@ -323,7 +348,9 @@ type CreateOrgInvitationOptions struct { // In order to create invitations in an organization, // the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/members#create-an-organization-invitation +// GitHub API docs: https://docs.github.com/rest/orgs/members#create-an-organization-invitation +// +//meta:operation POST /orgs/{org}/invitations func (s *OrganizationsService) CreateOrgInvitation(ctx context.Context, org string, opts *CreateOrgInvitationOptions) (*Invitation, *Response, error) { u := fmt.Sprintf("orgs/%v/invitations", org) @@ -344,7 +371,9 @@ func (s *OrganizationsService) CreateOrgInvitation(ctx context.Context, org stri // ListOrgInvitationTeams lists all teams associated with an invitation. In order to see invitations in an organization, // the authenticated user must be an organization owner. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/members#list-organization-invitation-teams +// GitHub API docs: https://docs.github.com/rest/orgs/members#list-organization-invitation-teams +// +//meta:operation GET /orgs/{org}/invitations/{invitation_id}/teams func (s *OrganizationsService) ListOrgInvitationTeams(ctx context.Context, org, invitationID string, opts *ListOptions) ([]*Team, *Response, error) { u := fmt.Sprintf("orgs/%v/invitations/%v/teams", org, invitationID) u, err := addOptions(u, opts) @@ -368,7 +397,9 @@ func (s *OrganizationsService) ListOrgInvitationTeams(ctx context.Context, org, // ListFailedOrgInvitations returns a list of failed inviatations. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/members#list-failed-organization-invitations +// GitHub API docs: https://docs.github.com/rest/orgs/members#list-failed-organization-invitations +// +//meta:operation GET /orgs/{org}/failed_invitations func (s *OrganizationsService) ListFailedOrgInvitations(ctx context.Context, org string, opts *ListOptions) ([]*Invitation, *Response, error) { u := fmt.Sprintf("orgs/%v/failed_invitations", org) u, err := addOptions(u, opts) diff --git a/github/orgs_outside_collaborators.go b/github/orgs_outside_collaborators.go index 506a4946034..56034d72602 100644 --- a/github/orgs_outside_collaborators.go +++ b/github/orgs_outside_collaborators.go @@ -27,7 +27,9 @@ type ListOutsideCollaboratorsOptions struct { // Warning: The API may change without advance notice during the preview period. // Preview features are not supported for production use. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/outside-collaborators#list-outside-collaborators-for-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/outside-collaborators#list-outside-collaborators-for-an-organization +// +//meta:operation GET /orgs/{org}/outside_collaborators func (s *OrganizationsService) ListOutsideCollaborators(ctx context.Context, org string, opts *ListOutsideCollaboratorsOptions) ([]*User, *Response, error) { u := fmt.Sprintf("orgs/%v/outside_collaborators", org) u, err := addOptions(u, opts) @@ -52,7 +54,9 @@ func (s *OrganizationsService) ListOutsideCollaborators(ctx context.Context, org // RemoveOutsideCollaborator removes a user from the list of outside collaborators; // consequently, removing them from all the organization's repositories. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/outside-collaborators#remove-outside-collaborator-from-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/outside-collaborators#remove-outside-collaborator-from-an-organization +// +//meta:operation DELETE /orgs/{org}/outside_collaborators/{username} func (s *OrganizationsService) RemoveOutsideCollaborator(ctx context.Context, org string, user string) (*Response, error) { u := fmt.Sprintf("orgs/%v/outside_collaborators/%v", org, user) req, err := s.client.NewRequest("DELETE", u, nil) @@ -69,7 +73,9 @@ func (s *OrganizationsService) RemoveOutsideCollaborator(ctx context.Context, or // Responses for converting a non-member or the last owner to an outside collaborator // are listed in GitHub API docs. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/outside-collaborators#convert-an-organization-member-to-outside-collaborator +// GitHub API docs: https://docs.github.com/rest/orgs/outside-collaborators#convert-an-organization-member-to-outside-collaborator +// +//meta:operation PUT /orgs/{org}/outside_collaborators/{username} func (s *OrganizationsService) ConvertMemberToOutsideCollaborator(ctx context.Context, org string, user string) (*Response, error) { u := fmt.Sprintf("orgs/%v/outside_collaborators/%v", org, user) req, err := s.client.NewRequest("PUT", u, nil) diff --git a/github/orgs_packages.go b/github/orgs_packages.go index 449b3dd3e91..4fb9a63b428 100644 --- a/github/orgs_packages.go +++ b/github/orgs_packages.go @@ -12,7 +12,9 @@ import ( // ListPackages lists the packages for an organization. // -// GitHub API docs: https://docs.github.com/en/rest/packages#list-packages-for-an-organization +// GitHub API docs: https://docs.github.com/rest/packages/packages#list-packages-for-an-organization +// +//meta:operation GET /orgs/{org}/packages func (s *OrganizationsService) ListPackages(ctx context.Context, org string, opts *PackageListOptions) ([]*Package, *Response, error) { u := fmt.Sprintf("orgs/%v/packages", org) u, err := addOptions(u, opts) @@ -36,7 +38,9 @@ func (s *OrganizationsService) ListPackages(ctx context.Context, org string, opt // GetPackage gets a package by name from an organization. // -// GitHub API docs: https://docs.github.com/en/rest/packages#get-a-package-for-an-organization +// GitHub API docs: https://docs.github.com/rest/packages/packages#get-a-package-for-an-organization +// +//meta:operation GET /orgs/{org}/packages/{package_type}/{package_name} func (s *OrganizationsService) GetPackage(ctx context.Context, org, packageType, packageName string) (*Package, *Response, error) { u := fmt.Sprintf("orgs/%v/packages/%v/%v", org, packageType, packageName) req, err := s.client.NewRequest("GET", u, nil) @@ -55,7 +59,9 @@ func (s *OrganizationsService) GetPackage(ctx context.Context, org, packageType, // DeletePackage deletes a package from an organization. // -// GitHub API docs: https://docs.github.com/en/rest/packages#delete-a-package-for-an-organization +// GitHub API docs: https://docs.github.com/rest/packages/packages#delete-a-package-for-an-organization +// +//meta:operation DELETE /orgs/{org}/packages/{package_type}/{package_name} func (s *OrganizationsService) DeletePackage(ctx context.Context, org, packageType, packageName string) (*Response, error) { u := fmt.Sprintf("orgs/%v/packages/%v/%v", org, packageType, packageName) req, err := s.client.NewRequest("DELETE", u, nil) @@ -68,7 +74,9 @@ func (s *OrganizationsService) DeletePackage(ctx context.Context, org, packageTy // RestorePackage restores a package to an organization. // -// GitHub API docs: https://docs.github.com/en/rest/packages#restore-a-package-for-an-organization +// GitHub API docs: https://docs.github.com/rest/packages/packages#restore-a-package-for-an-organization +// +//meta:operation POST /orgs/{org}/packages/{package_type}/{package_name}/restore func (s *OrganizationsService) RestorePackage(ctx context.Context, org, packageType, packageName string) (*Response, error) { u := fmt.Sprintf("orgs/%v/packages/%v/%v/restore", org, packageType, packageName) req, err := s.client.NewRequest("POST", u, nil) @@ -81,7 +89,9 @@ func (s *OrganizationsService) RestorePackage(ctx context.Context, org, packageT // PackageGetAllVersions gets all versions of a package in an organization. // -// GitHub API docs: https://docs.github.com/en/rest/packages#list-package-versions-for-a-package-owned-by-an-organization +// GitHub API docs: https://docs.github.com/rest/packages/packages#list-package-versions-for-a-package-owned-by-an-organization +// +//meta:operation GET /orgs/{org}/packages/{package_type}/{package_name}/versions func (s *OrganizationsService) PackageGetAllVersions(ctx context.Context, org, packageType, packageName string, opts *PackageListOptions) ([]*PackageVersion, *Response, error) { u := fmt.Sprintf("orgs/%v/packages/%v/%v/versions", org, packageType, packageName) u, err := addOptions(u, opts) @@ -105,7 +115,9 @@ func (s *OrganizationsService) PackageGetAllVersions(ctx context.Context, org, p // PackageGetVersion gets a specific version of a package in an organization. // -// GitHub API docs: https://docs.github.com/en/rest/packages#get-a-package-version-for-an-organization +// GitHub API docs: https://docs.github.com/rest/packages/packages#get-a-package-version-for-an-organization +// +//meta:operation GET /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id} func (s *OrganizationsService) PackageGetVersion(ctx context.Context, org, packageType, packageName string, packageVersionID int64) (*PackageVersion, *Response, error) { u := fmt.Sprintf("orgs/%v/packages/%v/%v/versions/%v", org, packageType, packageName, packageVersionID) req, err := s.client.NewRequest("GET", u, nil) @@ -124,7 +136,9 @@ func (s *OrganizationsService) PackageGetVersion(ctx context.Context, org, packa // PackageDeleteVersion deletes a package version from an organization. // -// GitHub API docs: https://docs.github.com/en/rest/packages#delete-package-version-for-an-organization +// GitHub API docs: https://docs.github.com/rest/packages/packages#delete-package-version-for-an-organization +// +//meta:operation DELETE /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id} func (s *OrganizationsService) PackageDeleteVersion(ctx context.Context, org, packageType, packageName string, packageVersionID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/packages/%v/%v/versions/%v", org, packageType, packageName, packageVersionID) req, err := s.client.NewRequest("DELETE", u, nil) @@ -137,7 +151,9 @@ func (s *OrganizationsService) PackageDeleteVersion(ctx context.Context, org, pa // PackageRestoreVersion restores a package version to an organization. // -// GitHub API docs: https://docs.github.com/en/rest/packages#restore-package-version-for-an-organization +// GitHub API docs: https://docs.github.com/rest/packages/packages#restore-package-version-for-an-organization +// +//meta:operation POST /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}/restore func (s *OrganizationsService) PackageRestoreVersion(ctx context.Context, org, packageType, packageName string, packageVersionID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/packages/%v/%v/versions/%v/restore", org, packageType, packageName, packageVersionID) req, err := s.client.NewRequest("POST", u, nil) diff --git a/github/orgs_personal_access_tokens.go b/github/orgs_personal_access_tokens.go index c30ff2843ee..0d786114f8c 100644 --- a/github/orgs_personal_access_tokens.go +++ b/github/orgs_personal_access_tokens.go @@ -21,7 +21,9 @@ type ReviewPersonalAccessTokenRequestOptions struct { // Only GitHub Apps can call this API, using the `organization_personal_access_token_requests: write` permission. // `action` can be one of `approve` or `deny`. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/personal-access-tokens?apiVersion=2022-11-28#review-a-request-to-access-organization-resources-with-a-fine-grained-personal-access-token +// GitHub API docs: https://docs.github.com/rest/orgs/personal-access-tokens#review-a-request-to-access-organization-resources-with-a-fine-grained-personal-access-token +// +//meta:operation POST /orgs/{org}/personal-access-token-requests/{pat_request_id} func (s *OrganizationsService) ReviewPersonalAccessTokenRequest(ctx context.Context, org string, requestID int64, opts ReviewPersonalAccessTokenRequestOptions) (*Response, error) { u := fmt.Sprintf("orgs/%v/personal-access-token-requests/%v", org, requestID) diff --git a/github/orgs_projects.go b/github/orgs_projects.go index d49eae54dce..454d8cf1c34 100644 --- a/github/orgs_projects.go +++ b/github/orgs_projects.go @@ -12,7 +12,9 @@ import ( // ListProjects lists the projects for an organization. // -// GitHub API docs: https://docs.github.com/en/rest/projects/projects#list-organization-projects +// GitHub API docs: https://docs.github.com/rest/projects/projects#list-organization-projects +// +//meta:operation GET /orgs/{org}/projects func (s *OrganizationsService) ListProjects(ctx context.Context, org string, opts *ProjectListOptions) ([]*Project, *Response, error) { u := fmt.Sprintf("orgs/%v/projects", org) u, err := addOptions(u, opts) @@ -39,7 +41,9 @@ func (s *OrganizationsService) ListProjects(ctx context.Context, org string, opt // CreateProject creates a GitHub Project for the specified organization. // -// GitHub API docs: https://docs.github.com/en/rest/projects/projects#create-an-organization-project +// GitHub API docs: https://docs.github.com/rest/projects/projects#create-an-organization-project +// +//meta:operation POST /orgs/{org}/projects func (s *OrganizationsService) CreateProject(ctx context.Context, org string, opts *ProjectOptions) (*Project, *Response, error) { u := fmt.Sprintf("orgs/%v/projects", org) req, err := s.client.NewRequest("POST", u, opts) diff --git a/github/orgs_rules.go b/github/orgs_rules.go index a3905af8fb3..37c06a7333c 100644 --- a/github/orgs_rules.go +++ b/github/orgs_rules.go @@ -12,7 +12,9 @@ import ( // GetAllOrganizationRulesets gets all the rulesets for the specified organization. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/rules#get-all-organization-repository-rulesets +// GitHub API docs: https://docs.github.com/rest/orgs/rules#get-all-organization-repository-rulesets +// +//meta:operation GET /orgs/{org}/rulesets func (s *OrganizationsService) GetAllOrganizationRulesets(ctx context.Context, org string) ([]*Ruleset, *Response, error) { u := fmt.Sprintf("orgs/%v/rulesets", org) @@ -32,7 +34,9 @@ func (s *OrganizationsService) GetAllOrganizationRulesets(ctx context.Context, o // CreateOrganizationRuleset creates a ruleset for the specified organization. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/rules#create-an-organization-repository-ruleset +// GitHub API docs: https://docs.github.com/rest/orgs/rules#create-an-organization-repository-ruleset +// +//meta:operation POST /orgs/{org}/rulesets func (s *OrganizationsService) CreateOrganizationRuleset(ctx context.Context, org string, rs *Ruleset) (*Ruleset, *Response, error) { u := fmt.Sprintf("orgs/%v/rulesets", org) @@ -52,7 +56,9 @@ func (s *OrganizationsService) CreateOrganizationRuleset(ctx context.Context, or // GetOrganizationRuleset gets a ruleset from the specified organization. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/rules#get-an-organization-repository-ruleset +// GitHub API docs: https://docs.github.com/rest/orgs/rules#get-an-organization-repository-ruleset +// +//meta:operation GET /orgs/{org}/rulesets/{ruleset_id} func (s *OrganizationsService) GetOrganizationRuleset(ctx context.Context, org string, rulesetID int64) (*Ruleset, *Response, error) { u := fmt.Sprintf("orgs/%v/rulesets/%v", org, rulesetID) @@ -72,7 +78,9 @@ func (s *OrganizationsService) GetOrganizationRuleset(ctx context.Context, org s // UpdateOrganizationRuleset updates a ruleset from the specified organization. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/rules#update-an-organization-repository-ruleset +// GitHub API docs: https://docs.github.com/rest/orgs/rules#update-an-organization-repository-ruleset +// +//meta:operation PUT /orgs/{org}/rulesets/{ruleset_id} func (s *OrganizationsService) UpdateOrganizationRuleset(ctx context.Context, org string, rulesetID int64, rs *Ruleset) (*Ruleset, *Response, error) { u := fmt.Sprintf("orgs/%v/rulesets/%v", org, rulesetID) @@ -92,7 +100,9 @@ func (s *OrganizationsService) UpdateOrganizationRuleset(ctx context.Context, or // DeleteOrganizationRuleset deletes a ruleset from the specified organization. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/rules#delete-an-organization-repository-ruleset +// GitHub API docs: https://docs.github.com/rest/orgs/rules#delete-an-organization-repository-ruleset +// +//meta:operation DELETE /orgs/{org}/rulesets/{ruleset_id} func (s *OrganizationsService) DeleteOrganizationRuleset(ctx context.Context, org string, rulesetID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/rulesets/%v", org, rulesetID) diff --git a/github/orgs_security_managers.go b/github/orgs_security_managers.go index a3f002e0e1c..08037727320 100644 --- a/github/orgs_security_managers.go +++ b/github/orgs_security_managers.go @@ -12,7 +12,9 @@ import ( // ListSecurityManagerTeams lists all security manager teams for an organization. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/security-managers#list-security-manager-teams +// GitHub API docs: https://docs.github.com/rest/orgs/security-managers#list-security-manager-teams +// +//meta:operation GET /orgs/{org}/security-managers func (s *OrganizationsService) ListSecurityManagerTeams(ctx context.Context, org string) ([]*Team, *Response, error) { u := fmt.Sprintf("orgs/%v/security-managers", org) @@ -32,7 +34,9 @@ func (s *OrganizationsService) ListSecurityManagerTeams(ctx context.Context, org // AddSecurityManagerTeam adds a team to the list of security managers for an organization. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/security-managers#add-a-security-manager-team +// GitHub API docs: https://docs.github.com/rest/orgs/security-managers#add-a-security-manager-team +// +//meta:operation PUT /orgs/{org}/security-managers/teams/{team_slug} func (s *OrganizationsService) AddSecurityManagerTeam(ctx context.Context, org, team string) (*Response, error) { u := fmt.Sprintf("orgs/%v/security-managers/teams/%v", org, team) req, err := s.client.NewRequest("PUT", u, nil) @@ -45,7 +49,9 @@ func (s *OrganizationsService) AddSecurityManagerTeam(ctx context.Context, org, // RemoveSecurityManagerTeam removes a team from the list of security managers for an organization. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/security-managers#remove-a-security-manager-team +// GitHub API docs: https://docs.github.com/rest/orgs/security-managers#remove-a-security-manager-team +// +//meta:operation DELETE /orgs/{org}/security-managers/teams/{team_slug} func (s *OrganizationsService) RemoveSecurityManagerTeam(ctx context.Context, org, team string) (*Response, error) { u := fmt.Sprintf("orgs/%v/security-managers/teams/%v", org, team) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/orgs_users_blocking.go b/github/orgs_users_blocking.go index 9c6cf60269e..62bd9116cde 100644 --- a/github/orgs_users_blocking.go +++ b/github/orgs_users_blocking.go @@ -12,7 +12,9 @@ import ( // ListBlockedUsers lists all the users blocked by an organization. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/blocking#list-users-blocked-by-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/blocking#list-users-blocked-by-an-organization +// +//meta:operation GET /orgs/{org}/blocks func (s *OrganizationsService) ListBlockedUsers(ctx context.Context, org string, opts *ListOptions) ([]*User, *Response, error) { u := fmt.Sprintf("orgs/%v/blocks", org) u, err := addOptions(u, opts) @@ -39,7 +41,9 @@ func (s *OrganizationsService) ListBlockedUsers(ctx context.Context, org string, // IsBlocked reports whether specified user is blocked from an organization. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/blocking#check-if-a-user-is-blocked-by-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/blocking#check-if-a-user-is-blocked-by-an-organization +// +//meta:operation GET /orgs/{org}/blocks/{username} func (s *OrganizationsService) IsBlocked(ctx context.Context, org string, user string) (bool, *Response, error) { u := fmt.Sprintf("orgs/%v/blocks/%v", org, user) @@ -58,7 +62,9 @@ func (s *OrganizationsService) IsBlocked(ctx context.Context, org string, user s // BlockUser blocks specified user from an organization. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/blocking#block-a-user-from-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/blocking#block-a-user-from-an-organization +// +//meta:operation PUT /orgs/{org}/blocks/{username} func (s *OrganizationsService) BlockUser(ctx context.Context, org string, user string) (*Response, error) { u := fmt.Sprintf("orgs/%v/blocks/%v", org, user) @@ -75,7 +81,9 @@ func (s *OrganizationsService) BlockUser(ctx context.Context, org string, user s // UnblockUser unblocks specified user from an organization. // -// GitHub API docs: https://docs.github.com/en/rest/orgs/blocking#unblock-a-user-from-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/blocking#unblock-a-user-from-an-organization +// +//meta:operation DELETE /orgs/{org}/blocks/{username} func (s *OrganizationsService) UnblockUser(ctx context.Context, org string, user string) (*Response, error) { u := fmt.Sprintf("orgs/%v/blocks/%v", org, user) diff --git a/github/projects.go b/github/projects.go index df7ad6cd97e..c5c42f8939b 100644 --- a/github/projects.go +++ b/github/projects.go @@ -13,7 +13,7 @@ import ( // ProjectsService provides access to the projects functions in the // GitHub API. // -// GitHub API docs: https://docs.github.com/en/rest/projects +// GitHub API docs: https://docs.github.com/rest/projects type ProjectsService service // Project represents a GitHub Project. @@ -43,7 +43,9 @@ func (p Project) String() string { // GetProject gets a GitHub Project for a repo. // -// GitHub API docs: https://docs.github.com/en/rest/projects/projects#get-a-project +// GitHub API docs: https://docs.github.com/rest/projects/projects#get-a-project +// +//meta:operation GET /projects/{project_id} func (s *ProjectsService) GetProject(ctx context.Context, id int64) (*Project, *Response, error) { u := fmt.Sprintf("projects/%v", id) req, err := s.client.NewRequest("GET", u, nil) @@ -90,7 +92,9 @@ type ProjectOptions struct { // UpdateProject updates a repository project. // -// GitHub API docs: https://docs.github.com/en/rest/projects/projects#update-a-project +// GitHub API docs: https://docs.github.com/rest/projects/projects#update-a-project +// +//meta:operation PATCH /projects/{project_id} func (s *ProjectsService) UpdateProject(ctx context.Context, id int64, opts *ProjectOptions) (*Project, *Response, error) { u := fmt.Sprintf("projects/%v", id) req, err := s.client.NewRequest("PATCH", u, opts) @@ -112,7 +116,9 @@ func (s *ProjectsService) UpdateProject(ctx context.Context, id int64, opts *Pro // DeleteProject deletes a GitHub Project from a repository. // -// GitHub API docs: https://docs.github.com/en/rest/projects/projects#delete-a-project +// GitHub API docs: https://docs.github.com/rest/projects/projects#delete-a-project +// +//meta:operation DELETE /projects/{project_id} func (s *ProjectsService) DeleteProject(ctx context.Context, id int64) (*Response, error) { u := fmt.Sprintf("projects/%v", id) req, err := s.client.NewRequest("DELETE", u, nil) @@ -128,7 +134,7 @@ func (s *ProjectsService) DeleteProject(ctx context.Context, id int64) (*Respons // ProjectColumn represents a column of a GitHub Project. // -// GitHub API docs: https://docs.github.com/en/rest/repos/projects/ +// GitHub API docs: https://docs.github.com/rest/repos/projects/ type ProjectColumn struct { ID *int64 `json:"id,omitempty"` Name *string `json:"name,omitempty"` @@ -142,7 +148,9 @@ type ProjectColumn struct { // ListProjectColumns lists the columns of a GitHub Project for a repo. // -// GitHub API docs: https://docs.github.com/en/rest/projects/columns#list-project-columns +// GitHub API docs: https://docs.github.com/rest/projects/columns#list-project-columns +// +//meta:operation GET /projects/{project_id}/columns func (s *ProjectsService) ListProjectColumns(ctx context.Context, projectID int64, opts *ListOptions) ([]*ProjectColumn, *Response, error) { u := fmt.Sprintf("projects/%v/columns", projectID) u, err := addOptions(u, opts) @@ -169,7 +177,9 @@ func (s *ProjectsService) ListProjectColumns(ctx context.Context, projectID int6 // GetProjectColumn gets a column of a GitHub Project for a repo. // -// GitHub API docs: https://docs.github.com/en/rest/projects/columns#get-a-project-column +// GitHub API docs: https://docs.github.com/rest/projects/columns#get-a-project-column +// +//meta:operation GET /projects/columns/{column_id} func (s *ProjectsService) GetProjectColumn(ctx context.Context, id int64) (*ProjectColumn, *Response, error) { u := fmt.Sprintf("projects/columns/%v", id) req, err := s.client.NewRequest("GET", u, nil) @@ -199,7 +209,9 @@ type ProjectColumnOptions struct { // CreateProjectColumn creates a column for the specified (by number) project. // -// GitHub API docs: https://docs.github.com/en/rest/projects/columns#create-a-project-column +// GitHub API docs: https://docs.github.com/rest/projects/columns#create-a-project-column +// +//meta:operation POST /projects/{project_id}/columns func (s *ProjectsService) CreateProjectColumn(ctx context.Context, projectID int64, opts *ProjectColumnOptions) (*ProjectColumn, *Response, error) { u := fmt.Sprintf("projects/%v/columns", projectID) req, err := s.client.NewRequest("POST", u, opts) @@ -221,7 +233,9 @@ func (s *ProjectsService) CreateProjectColumn(ctx context.Context, projectID int // UpdateProjectColumn updates a column of a GitHub Project. // -// GitHub API docs: https://docs.github.com/en/rest/projects/columns#update-an-existing-project-column +// GitHub API docs: https://docs.github.com/rest/projects/columns#update-an-existing-project-column +// +//meta:operation PATCH /projects/columns/{column_id} func (s *ProjectsService) UpdateProjectColumn(ctx context.Context, columnID int64, opts *ProjectColumnOptions) (*ProjectColumn, *Response, error) { u := fmt.Sprintf("projects/columns/%v", columnID) req, err := s.client.NewRequest("PATCH", u, opts) @@ -243,7 +257,9 @@ func (s *ProjectsService) UpdateProjectColumn(ctx context.Context, columnID int6 // DeleteProjectColumn deletes a column from a GitHub Project. // -// GitHub API docs: https://docs.github.com/en/rest/projects/columns#delete-a-project-column +// GitHub API docs: https://docs.github.com/rest/projects/columns#delete-a-project-column +// +//meta:operation DELETE /projects/columns/{column_id} func (s *ProjectsService) DeleteProjectColumn(ctx context.Context, columnID int64) (*Response, error) { u := fmt.Sprintf("projects/columns/%v", columnID) req, err := s.client.NewRequest("DELETE", u, nil) @@ -267,7 +283,9 @@ type ProjectColumnMoveOptions struct { // MoveProjectColumn moves a column within a GitHub Project. // -// GitHub API docs: https://docs.github.com/en/rest/projects/columns#move-a-project-column +// GitHub API docs: https://docs.github.com/rest/projects/columns#move-a-project-column +// +//meta:operation POST /projects/columns/{column_id}/moves func (s *ProjectsService) MoveProjectColumn(ctx context.Context, columnID int64, opts *ProjectColumnMoveOptions) (*Response, error) { u := fmt.Sprintf("projects/columns/%v/moves", columnID) req, err := s.client.NewRequest("POST", u, opts) @@ -283,7 +301,7 @@ func (s *ProjectsService) MoveProjectColumn(ctx context.Context, columnID int64, // ProjectCard represents a card in a column of a GitHub Project. // -// GitHub API docs: https://docs.github.com/en/rest/projects/cards/#get-a-project-card +// GitHub API docs: https://docs.github.com/rest/projects/cards/#get-a-project-card type ProjectCard struct { URL *string `json:"url,omitempty"` ColumnURL *string `json:"column_url,omitempty"` @@ -318,7 +336,9 @@ type ProjectCardListOptions struct { // ListProjectCards lists the cards in a column of a GitHub Project. // -// GitHub API docs: https://docs.github.com/en/rest/projects/cards#list-project-cards +// GitHub API docs: https://docs.github.com/rest/projects/cards#list-project-cards +// +//meta:operation GET /projects/columns/{column_id}/cards func (s *ProjectsService) ListProjectCards(ctx context.Context, columnID int64, opts *ProjectCardListOptions) ([]*ProjectCard, *Response, error) { u := fmt.Sprintf("projects/columns/%v/cards", columnID) u, err := addOptions(u, opts) @@ -345,7 +365,9 @@ func (s *ProjectsService) ListProjectCards(ctx context.Context, columnID int64, // GetProjectCard gets a card in a column of a GitHub Project. // -// GitHub API docs: https://docs.github.com/en/rest/projects/cards#get-a-project-card +// GitHub API docs: https://docs.github.com/rest/projects/cards#get-a-project-card +// +//meta:operation GET /projects/columns/cards/{card_id} func (s *ProjectsService) GetProjectCard(ctx context.Context, cardID int64) (*ProjectCard, *Response, error) { u := fmt.Sprintf("projects/columns/cards/%v", cardID) req, err := s.client.NewRequest("GET", u, nil) @@ -383,7 +405,9 @@ type ProjectCardOptions struct { // CreateProjectCard creates a card in the specified column of a GitHub Project. // -// GitHub API docs: https://docs.github.com/en/rest/projects/cards#create-a-project-card +// GitHub API docs: https://docs.github.com/rest/projects/cards#create-a-project-card +// +//meta:operation POST /projects/columns/{column_id}/cards func (s *ProjectsService) CreateProjectCard(ctx context.Context, columnID int64, opts *ProjectCardOptions) (*ProjectCard, *Response, error) { u := fmt.Sprintf("projects/columns/%v/cards", columnID) req, err := s.client.NewRequest("POST", u, opts) @@ -405,7 +429,9 @@ func (s *ProjectsService) CreateProjectCard(ctx context.Context, columnID int64, // UpdateProjectCard updates a card of a GitHub Project. // -// GitHub API docs: https://docs.github.com/en/rest/projects/cards#update-an-existing-project-card +// GitHub API docs: https://docs.github.com/rest/projects/cards#update-an-existing-project-card +// +//meta:operation PATCH /projects/columns/cards/{card_id} func (s *ProjectsService) UpdateProjectCard(ctx context.Context, cardID int64, opts *ProjectCardOptions) (*ProjectCard, *Response, error) { u := fmt.Sprintf("projects/columns/cards/%v", cardID) req, err := s.client.NewRequest("PATCH", u, opts) @@ -427,7 +453,9 @@ func (s *ProjectsService) UpdateProjectCard(ctx context.Context, cardID int64, o // DeleteProjectCard deletes a card from a GitHub Project. // -// GitHub API docs: https://docs.github.com/en/rest/projects/cards#delete-a-project-card +// GitHub API docs: https://docs.github.com/rest/projects/cards#delete-a-project-card +// +//meta:operation DELETE /projects/columns/cards/{card_id} func (s *ProjectsService) DeleteProjectCard(ctx context.Context, cardID int64) (*Response, error) { u := fmt.Sprintf("projects/columns/cards/%v", cardID) req, err := s.client.NewRequest("DELETE", u, nil) @@ -455,7 +483,9 @@ type ProjectCardMoveOptions struct { // MoveProjectCard moves a card within a GitHub Project. // -// GitHub API docs: https://docs.github.com/en/rest/projects/cards#move-a-project-card +// GitHub API docs: https://docs.github.com/rest/projects/cards#move-a-project-card +// +//meta:operation POST /projects/columns/cards/{card_id}/moves func (s *ProjectsService) MoveProjectCard(ctx context.Context, cardID int64, opts *ProjectCardMoveOptions) (*Response, error) { u := fmt.Sprintf("projects/columns/cards/%v/moves", cardID) req, err := s.client.NewRequest("POST", u, opts) @@ -485,7 +515,9 @@ type ProjectCollaboratorOptions struct { // AddProjectCollaborator adds a collaborator to an organization project and sets // their permission level. You must be an organization owner or a project admin to add a collaborator. // -// GitHub API docs: https://docs.github.com/en/rest/projects/collaborators#add-project-collaborator +// GitHub API docs: https://docs.github.com/rest/projects/collaborators#add-project-collaborator +// +//meta:operation PUT /projects/{project_id}/collaborators/{username} func (s *ProjectsService) AddProjectCollaborator(ctx context.Context, id int64, username string, opts *ProjectCollaboratorOptions) (*Response, error) { u := fmt.Sprintf("projects/%v/collaborators/%v", id, username) req, err := s.client.NewRequest("PUT", u, opts) @@ -502,7 +534,9 @@ func (s *ProjectsService) AddProjectCollaborator(ctx context.Context, id int64, // RemoveProjectCollaborator removes a collaborator from an organization project. // You must be an organization owner or a project admin to remove a collaborator. // -// GitHub API docs: https://docs.github.com/en/rest/projects/collaborators#remove-user-as-a-collaborator +// GitHub API docs: https://docs.github.com/rest/projects/collaborators#remove-user-as-a-collaborator +// +//meta:operation DELETE /projects/{project_id}/collaborators/{username} func (s *ProjectsService) RemoveProjectCollaborator(ctx context.Context, id int64, username string) (*Response, error) { u := fmt.Sprintf("projects/%v/collaborators/%v", id, username) req, err := s.client.NewRequest("DELETE", u, nil) @@ -538,7 +572,9 @@ type ListCollaboratorOptions struct { // with access through default organization permissions, and organization owners. You must be an // organization owner or a project admin to list collaborators. // -// GitHub API docs: https://docs.github.com/en/rest/projects/collaborators#list-project-collaborators +// GitHub API docs: https://docs.github.com/rest/projects/collaborators#list-project-collaborators +// +//meta:operation GET /projects/{project_id}/collaborators func (s *ProjectsService) ListProjectCollaborators(ctx context.Context, id int64, opts *ListCollaboratorOptions) ([]*User, *Response, error) { u := fmt.Sprintf("projects/%v/collaborators", id) u, err := addOptions(u, opts) @@ -576,7 +612,9 @@ type ProjectPermissionLevel struct { // project. Possible values for the permission key: "admin", "write", "read", "none". // You must be an organization owner or a project admin to review a user's permission level. // -// GitHub API docs: https://docs.github.com/en/rest/projects/collaborators#get-project-permission-for-a-user +// GitHub API docs: https://docs.github.com/rest/projects/collaborators#get-project-permission-for-a-user +// +//meta:operation GET /projects/{project_id}/collaborators/{username}/permission func (s *ProjectsService) ReviewProjectCollaboratorPermission(ctx context.Context, id int64, username string) (*ProjectPermissionLevel, *Response, error) { u := fmt.Sprintf("projects/%v/collaborators/%v/permission", id, username) req, err := s.client.NewRequest("GET", u, nil) diff --git a/github/pulls.go b/github/pulls.go index 29549e24b86..80df9fa688a 100644 --- a/github/pulls.go +++ b/github/pulls.go @@ -14,7 +14,7 @@ import ( // PullRequestsService handles communication with the pull request related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/en/rest/pulls/ +// GitHub API docs: https://docs.github.com/rest/pulls/ type PullRequestsService service // PullRequestAutoMerge represents the "auto_merge" response for a PullRequest. @@ -72,7 +72,7 @@ type PullRequest struct { AutoMerge *PullRequestAutoMerge `json:"auto_merge,omitempty"` // RequestedTeams is populated as part of the PullRequestEvent. - // See, https://docs.github.com/en/developers/webhooks-and-events/github-event-types#pullrequestevent for an example. + // See, https://docs.github.com/developers/webhooks-and-events/github-event-types#pullrequestevent for an example. RequestedTeams []*Team `json:"requested_teams,omitempty"` Links *PRLinks `json:"_links,omitempty"` @@ -142,7 +142,9 @@ type PullRequestListOptions struct { // List the pull requests for the specified repository. // -// GitHub API docs: https://docs.github.com/en/rest/pulls/pulls#list-pull-requests +// GitHub API docs: https://docs.github.com/rest/pulls/pulls#list-pull-requests +// +//meta:operation GET /repos/{owner}/{repo}/pulls func (s *PullRequestsService) List(ctx context.Context, owner string, repo string, opts *PullRequestListOptions) ([]*PullRequest, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls", owner, repo) u, err := addOptions(u, opts) @@ -169,7 +171,9 @@ func (s *PullRequestsService) List(ctx context.Context, owner string, repo strin // The results may include open and closed pull requests. // By default, the PullRequestListOptions State filters for "open". // -// GitHub API docs: https://docs.github.com/en/rest/commits/commits#list-pull-requests-associated-with-a-commit +// GitHub API docs: https://docs.github.com/rest/commits/commits#list-pull-requests-associated-with-a-commit +// +//meta:operation GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls func (s *PullRequestsService) ListPullRequestsWithCommit(ctx context.Context, owner, repo, sha string, opts *ListOptions) ([]*PullRequest, *Response, error) { u := fmt.Sprintf("repos/%v/%v/commits/%v/pulls", owner, repo, sha) u, err := addOptions(u, opts) @@ -195,7 +199,9 @@ func (s *PullRequestsService) ListPullRequestsWithCommit(ctx context.Context, ow // Get a single pull request. // -// GitHub API docs: https://docs.github.com/en/rest/pulls/pulls#get-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/pulls#get-a-pull-request +// +//meta:operation GET /repos/{owner}/{repo}/pulls/{pull_number} func (s *PullRequestsService) Get(ctx context.Context, owner string, repo string, number int) (*PullRequest, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d", owner, repo, number) req, err := s.client.NewRequest("GET", u, nil) @@ -214,7 +220,9 @@ func (s *PullRequestsService) Get(ctx context.Context, owner string, repo string // GetRaw gets a single pull request in raw (diff or patch) format. // -// GitHub API docs: https://docs.github.com/en/rest/pulls/pulls#get-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/pulls#get-a-pull-request +// +//meta:operation GET /repos/{owner}/{repo}/pulls/{pull_number} func (s *PullRequestsService) GetRaw(ctx context.Context, owner string, repo string, number int, opts RawOptions) (string, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d", owner, repo, number) req, err := s.client.NewRequest("GET", u, nil) @@ -254,7 +262,9 @@ type NewPullRequest struct { // Create a new pull request on the specified repository. // -// GitHub API docs: https://docs.github.com/en/rest/pulls/pulls#create-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/pulls#create-a-pull-request +// +//meta:operation POST /repos/{owner}/{repo}/pulls func (s *PullRequestsService) Create(ctx context.Context, owner string, repo string, pull *NewPullRequest) (*PullRequest, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls", owner, repo) req, err := s.client.NewRequest("POST", u, pull) @@ -293,7 +303,9 @@ type PullRequestBranchUpdateResponse struct { // A follow up request, after a delay of a second or so, should result // in a successful request. // -// GitHub API docs: https://docs.github.com/en/rest/pulls/pulls#update-a-pull-request-branch +// GitHub API docs: https://docs.github.com/rest/pulls/pulls#update-a-pull-request-branch +// +//meta:operation PUT /repos/{owner}/{repo}/pulls/{pull_number}/update-branch func (s *PullRequestsService) UpdateBranch(ctx context.Context, owner, repo string, number int, opts *PullRequestBranchUpdateOptions) (*PullRequestBranchUpdateResponse, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d/update-branch", owner, repo, number) @@ -328,7 +340,9 @@ type pullRequestUpdate struct { // The following fields are editable: Title, Body, State, Base.Ref and MaintainerCanModify. // Base.Ref updates the base branch of the pull request. // -// GitHub API docs: https://docs.github.com/en/rest/pulls/pulls#update-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/pulls#update-a-pull-request +// +//meta:operation PATCH /repos/{owner}/{repo}/pulls/{pull_number} func (s *PullRequestsService) Edit(ctx context.Context, owner string, repo string, number int, pull *PullRequest) (*PullRequest, *Response, error) { if pull == nil { return nil, nil, fmt.Errorf("pull must be provided") @@ -365,7 +379,9 @@ func (s *PullRequestsService) Edit(ctx context.Context, owner string, repo strin // ListCommits lists the commits in a pull request. // -// GitHub API docs: https://docs.github.com/en/rest/pulls/pulls#list-commits-on-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/pulls#list-commits-on-a-pull-request +// +//meta:operation GET /repos/{owner}/{repo}/pulls/{pull_number}/commits func (s *PullRequestsService) ListCommits(ctx context.Context, owner string, repo string, number int, opts *ListOptions) ([]*RepositoryCommit, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d/commits", owner, repo, number) u, err := addOptions(u, opts) @@ -389,7 +405,9 @@ func (s *PullRequestsService) ListCommits(ctx context.Context, owner string, rep // ListFiles lists the files in a pull request. // -// GitHub API docs: https://docs.github.com/en/rest/pulls/pulls#list-pull-requests-files +// GitHub API docs: https://docs.github.com/rest/pulls/pulls#list-pull-requests-files +// +//meta:operation GET /repos/{owner}/{repo}/pulls/{pull_number}/files func (s *PullRequestsService) ListFiles(ctx context.Context, owner string, repo string, number int, opts *ListOptions) ([]*CommitFile, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d/files", owner, repo, number) u, err := addOptions(u, opts) @@ -413,7 +431,9 @@ func (s *PullRequestsService) ListFiles(ctx context.Context, owner string, repo // IsMerged checks if a pull request has been merged. // -// GitHub API docs: https://docs.github.com/en/rest/pulls/pulls#check-if-a-pull-request-has-been-merged +// GitHub API docs: https://docs.github.com/rest/pulls/pulls#check-if-a-pull-request-has-been-merged +// +//meta:operation GET /repos/{owner}/{repo}/pulls/{pull_number}/merge func (s *PullRequestsService) IsMerged(ctx context.Context, owner string, repo string, number int) (bool, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d/merge", owner, repo, number) req, err := s.client.NewRequest("GET", u, nil) @@ -455,7 +475,9 @@ type pullRequestMergeRequest struct { // Merge a pull request. // commitMessage is an extra detail to append to automatic commit message. // -// GitHub API docs: https://docs.github.com/en/rest/pulls/pulls#merge-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/pulls#merge-a-pull-request +// +//meta:operation PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge func (s *PullRequestsService) Merge(ctx context.Context, owner string, repo string, number int, commitMessage string, options *PullRequestOptions) (*PullRequestMergeResult, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d/merge", owner, repo, number) diff --git a/github/pulls_comments.go b/github/pulls_comments.go index ea1cf45d1e8..a9ffe8d7cc1 100644 --- a/github/pulls_comments.go +++ b/github/pulls_comments.go @@ -41,7 +41,7 @@ type PullRequestComment struct { URL *string `json:"url,omitempty"` HTMLURL *string `json:"html_url,omitempty"` PullRequestURL *string `json:"pull_request_url,omitempty"` - // Can be one of: LINE, FILE from https://docs.github.com/en/rest/pulls/comments?apiVersion=2022-11-28#create-a-review-comment-for-a-pull-request + // Can be one of: LINE, FILE from https://docs.github.com/rest/pulls/comments#create-a-review-comment-for-a-pull-request SubjectType *string `json:"subject_type,omitempty"` } @@ -68,8 +68,11 @@ type PullRequestListCommentsOptions struct { // pull request number of 0 will return all comments on all pull requests for // the repository. // -// GitHub API docs: https://docs.github.com/en/rest/pulls/comments#list-review-comments-on-a-pull-request -// GitHub API docs: https://docs.github.com/en/rest/pulls/comments#list-review-comments-in-a-repository +// GitHub API docs: https://docs.github.com/rest/pulls/comments#list-review-comments-in-a-repository +// GitHub API docs: https://docs.github.com/rest/pulls/comments#list-review-comments-on-a-pull-request +// +//meta:operation GET /repos/{owner}/{repo}/pulls/comments +//meta:operation GET /repos/{owner}/{repo}/pulls/{pull_number}/comments func (s *PullRequestsService) ListComments(ctx context.Context, owner, repo string, number int, opts *PullRequestListCommentsOptions) ([]*PullRequestComment, *Response, error) { var u string if number == 0 { @@ -102,7 +105,9 @@ func (s *PullRequestsService) ListComments(ctx context.Context, owner, repo stri // GetComment fetches the specified pull request comment. // -// GitHub API docs: https://docs.github.com/en/rest/pulls/comments#get-a-review-comment-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/comments#get-a-review-comment-for-a-pull-request +// +//meta:operation GET /repos/{owner}/{repo}/pulls/comments/{comment_id} func (s *PullRequestsService) GetComment(ctx context.Context, owner, repo string, commentID int64) (*PullRequestComment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/comments/%d", owner, repo, commentID) req, err := s.client.NewRequest("GET", u, nil) @@ -125,7 +130,9 @@ func (s *PullRequestsService) GetComment(ctx context.Context, owner, repo string // CreateComment creates a new comment on the specified pull request. // -// GitHub API docs: https://docs.github.com/en/rest/pulls/comments#create-a-review-comment-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/comments#create-a-review-comment-for-a-pull-request +// +//meta:operation POST /repos/{owner}/{repo}/pulls/{pull_number}/comments func (s *PullRequestsService) CreateComment(ctx context.Context, owner, repo string, number int, comment *PullRequestComment) (*PullRequestComment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d/comments", owner, repo, number) req, err := s.client.NewRequest("POST", u, comment) @@ -147,7 +154,9 @@ func (s *PullRequestsService) CreateComment(ctx context.Context, owner, repo str // CreateCommentInReplyTo creates a new comment as a reply to an existing pull request comment. // -// GitHub API docs: https://docs.github.com/en/rest/pulls/comments#create-a-review-comment-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/comments#create-a-review-comment-for-a-pull-request +// +//meta:operation POST /repos/{owner}/{repo}/pulls/{pull_number}/comments func (s *PullRequestsService) CreateCommentInReplyTo(ctx context.Context, owner, repo string, number int, body string, commentID int64) (*PullRequestComment, *Response, error) { comment := &struct { Body string `json:"body,omitempty"` @@ -174,7 +183,9 @@ func (s *PullRequestsService) CreateCommentInReplyTo(ctx context.Context, owner, // EditComment updates a pull request comment. // A non-nil comment.Body must be provided. Other comment fields should be left nil. // -// GitHub API docs: https://docs.github.com/en/rest/pulls/comments#update-a-review-comment-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/comments#update-a-review-comment-for-a-pull-request +// +//meta:operation PATCH /repos/{owner}/{repo}/pulls/comments/{comment_id} func (s *PullRequestsService) EditComment(ctx context.Context, owner, repo string, commentID int64, comment *PullRequestComment) (*PullRequestComment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/comments/%d", owner, repo, commentID) req, err := s.client.NewRequest("PATCH", u, comment) @@ -193,7 +204,9 @@ func (s *PullRequestsService) EditComment(ctx context.Context, owner, repo strin // DeleteComment deletes a pull request comment. // -// GitHub API docs: https://docs.github.com/en/rest/pulls/comments#delete-a-review-comment-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/comments#delete-a-review-comment-for-a-pull-request +// +//meta:operation DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id} func (s *PullRequestsService) DeleteComment(ctx context.Context, owner, repo string, commentID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/comments/%d", owner, repo, commentID) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/pulls_reviewers.go b/github/pulls_reviewers.go index 1c336540b81..3f0c50b746a 100644 --- a/github/pulls_reviewers.go +++ b/github/pulls_reviewers.go @@ -25,7 +25,9 @@ type Reviewers struct { // RequestReviewers creates a review request for the provided reviewers for the specified pull request. // -// GitHub API docs: https://docs.github.com/en/rest/pulls/review-requests#request-reviewers-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/review-requests#request-reviewers-for-a-pull-request +// +//meta:operation POST /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers func (s *PullRequestsService) RequestReviewers(ctx context.Context, owner, repo string, number int, reviewers ReviewersRequest) (*PullRequest, *Response, error) { u := fmt.Sprintf("repos/%s/%s/pulls/%d/requested_reviewers", owner, repo, number) req, err := s.client.NewRequest("POST", u, &reviewers) @@ -44,7 +46,9 @@ func (s *PullRequestsService) RequestReviewers(ctx context.Context, owner, repo // ListReviewers lists reviewers whose reviews have been requested on the specified pull request. // -// GitHub API docs: https://docs.github.com/en/rest/pulls/review-requests#list-requested-reviewers-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/review-requests#get-all-requested-reviewers-for-a-pull-request +// +//meta:operation GET /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers func (s *PullRequestsService) ListReviewers(ctx context.Context, owner, repo string, number int, opts *ListOptions) (*Reviewers, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d/requested_reviewers", owner, repo, number) u, err := addOptions(u, opts) @@ -68,7 +72,9 @@ func (s *PullRequestsService) ListReviewers(ctx context.Context, owner, repo str // RemoveReviewers removes the review request for the provided reviewers for the specified pull request. // -// GitHub API docs: https://docs.github.com/en/rest/pulls/review-requests#remove-requested-reviewers-from-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/review-requests#remove-requested-reviewers-from-a-pull-request +// +//meta:operation DELETE /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers func (s *PullRequestsService) RemoveReviewers(ctx context.Context, owner, repo string, number int, reviewers ReviewersRequest) (*Response, error) { u := fmt.Sprintf("repos/%s/%s/pulls/%d/requested_reviewers", owner, repo, number) req, err := s.client.NewRequest("DELETE", u, &reviewers) diff --git a/github/pulls_reviews.go b/github/pulls_reviews.go index addcce46834..27b8dc37d5d 100644 --- a/github/pulls_reviews.go +++ b/github/pulls_reviews.go @@ -100,7 +100,9 @@ func (r PullRequestReviewDismissalRequest) String() string { // ListReviews lists all reviews on the specified pull request. // -// GitHub API docs: https://docs.github.com/en/rest/pulls/reviews#list-reviews-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/reviews#list-reviews-for-a-pull-request +// +//meta:operation GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews func (s *PullRequestsService) ListReviews(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*PullRequestReview, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews", owner, repo, number) u, err := addOptions(u, opts) @@ -124,7 +126,9 @@ func (s *PullRequestsService) ListReviews(ctx context.Context, owner, repo strin // GetReview fetches the specified pull request review. // -// GitHub API docs: https://docs.github.com/en/rest/pulls/reviews#get-a-review-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/reviews#get-a-review-for-a-pull-request +// +//meta:operation GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id} func (s *PullRequestsService) GetReview(ctx context.Context, owner, repo string, number int, reviewID int64) (*PullRequestReview, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d", owner, repo, number, reviewID) @@ -144,7 +148,9 @@ func (s *PullRequestsService) GetReview(ctx context.Context, owner, repo string, // DeletePendingReview deletes the specified pull request pending review. // -// GitHub API docs: https://docs.github.com/en/rest/pulls/reviews#delete-a-pending-review-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/reviews#delete-a-pending-review-for-a-pull-request +// +//meta:operation DELETE /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id} func (s *PullRequestsService) DeletePendingReview(ctx context.Context, owner, repo string, number int, reviewID int64) (*PullRequestReview, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d", owner, repo, number, reviewID) @@ -164,7 +170,9 @@ func (s *PullRequestsService) DeletePendingReview(ctx context.Context, owner, re // ListReviewComments lists all the comments for the specified review. // -// GitHub API docs: https://docs.github.com/en/rest/pulls/reviews#list-comments-for-a-pull-request-review +// GitHub API docs: https://docs.github.com/rest/pulls/reviews#list-comments-for-a-pull-request-review +// +//meta:operation GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/comments func (s *PullRequestsService) ListReviewComments(ctx context.Context, owner, repo string, number int, reviewID int64, opts *ListOptions) ([]*PullRequestComment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/comments", owner, repo, number, reviewID) u, err := addOptions(u, opts) @@ -188,8 +196,6 @@ func (s *PullRequestsService) ListReviewComments(ctx context.Context, owner, rep // CreateReview creates a new review on the specified pull request. // -// GitHub API docs: https://docs.github.com/en/rest/pulls/reviews#create-a-review-for-a-pull-request -// // In order to use multi-line comments, you must use the "comfort fade" preview. // This replaces the use of the "Position" field in comments with 4 new fields: // @@ -223,6 +229,10 @@ func (s *PullRequestsService) ListReviewComments(ctx context.Context, owner, rep // Use this instead. // It is waaaaaay better. // ``` +// +// GitHub API docs: https://docs.github.com/rest/pulls/reviews#create-a-review-for-a-pull-request +// +//meta:operation POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews func (s *PullRequestsService) CreateReview(ctx context.Context, owner, repo string, number int, review *PullRequestReviewRequest) (*PullRequestReview, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews", owner, repo, number) @@ -251,7 +261,9 @@ func (s *PullRequestsService) CreateReview(ctx context.Context, owner, repo stri // UpdateReview updates the review summary on the specified pull request. // -// GitHub API docs: https://docs.github.com/en/rest/pulls/reviews#update-a-review-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/reviews#update-a-review-for-a-pull-request +// +//meta:operation PUT /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id} func (s *PullRequestsService) UpdateReview(ctx context.Context, owner, repo string, number int, reviewID int64, body string) (*PullRequestReview, *Response, error) { opts := &struct { Body string `json:"body"` @@ -274,7 +286,9 @@ func (s *PullRequestsService) UpdateReview(ctx context.Context, owner, repo stri // SubmitReview submits a specified review on the specified pull request. // -// GitHub API docs: https://docs.github.com/en/rest/pulls/reviews#submit-a-review-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/reviews#submit-a-review-for-a-pull-request +// +//meta:operation POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/events func (s *PullRequestsService) SubmitReview(ctx context.Context, owner, repo string, number int, reviewID int64, review *PullRequestReviewRequest) (*PullRequestReview, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/events", owner, repo, number, reviewID) @@ -294,7 +308,9 @@ func (s *PullRequestsService) SubmitReview(ctx context.Context, owner, repo stri // DismissReview dismisses a specified review on the specified pull request. // -// GitHub API docs: https://docs.github.com/en/rest/pulls/reviews#dismiss-a-review-for-a-pull-request +// GitHub API docs: https://docs.github.com/rest/pulls/reviews#dismiss-a-review-for-a-pull-request +// +//meta:operation PUT /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/dismissals func (s *PullRequestsService) DismissReview(ctx context.Context, owner, repo string, number int, reviewID int64, review *PullRequestReviewDismissalRequest) (*PullRequestReview, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/dismissals", owner, repo, number, reviewID) diff --git a/github/rate_limit.go b/github/rate_limit.go index 838c3ba7966..0fc15f815e2 100644 --- a/github/rate_limit.go +++ b/github/rate_limit.go @@ -59,6 +59,10 @@ func (r RateLimits) String() string { } // Get returns the rate limits for the current client. +// +// GitHub API docs: https://docs.github.com/rest/rate-limit/rate-limit#get-rate-limit-status-for-the-authenticated-user +// +//meta:operation GET /rate_limit func (s *RateLimitService) Get(ctx context.Context) (*RateLimits, *Response, error) { req, err := s.client.NewRequest("GET", "rate_limit", nil) if err != nil { diff --git a/github/reactions.go b/github/reactions.go index f06a8ef3dbc..1aa7ac38f2a 100644 --- a/github/reactions.go +++ b/github/reactions.go @@ -14,7 +14,7 @@ import ( // ReactionsService provides access to the reactions-related functions in the // GitHub API. // -// GitHub API docs: https://docs.github.com/en/rest/reactions +// GitHub API docs: https://docs.github.com/rest/reactions type ReactionsService service // Reaction represents a GitHub reaction. @@ -60,7 +60,9 @@ type ListCommentReactionOptions struct { // ListCommentReactions lists the reactions for a commit comment. // -// GitHub API docs: https://docs.github.com/en/rest/reactions#list-reactions-for-a-commit-comment +// GitHub API docs: https://docs.github.com/rest/reactions/reactions#list-reactions-for-a-commit-comment +// +//meta:operation GET /repos/{owner}/{repo}/comments/{comment_id}/reactions func (s *ReactionsService) ListCommentReactions(ctx context.Context, owner, repo string, id int64, opts *ListCommentReactionOptions) ([]*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions", owner, repo, id) u, err := addOptions(u, opts) @@ -90,7 +92,9 @@ func (s *ReactionsService) ListCommentReactions(ctx context.Context, owner, repo // previously created reaction will be returned with Status: 200 OK. // The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes". // -// GitHub API docs: https://docs.github.com/en/rest/reactions#create-reaction-for-a-commit-comment +// GitHub API docs: https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-commit-comment +// +//meta:operation POST /repos/{owner}/{repo}/comments/{comment_id}/reactions func (s *ReactionsService) CreateCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions", owner, repo, id) @@ -114,7 +118,9 @@ func (s *ReactionsService) CreateCommentReaction(ctx context.Context, owner, rep // DeleteCommentReaction deletes the reaction for a commit comment. // -// GitHub API docs: https://docs.github.com/en/rest/reactions#delete-a-commit-comment-reaction +// GitHub API docs: https://docs.github.com/rest/reactions/reactions#delete-a-commit-comment-reaction +// +//meta:operation DELETE /repos/{owner}/{repo}/comments/{comment_id}/reactions/{reaction_id} func (s *ReactionsService) DeleteCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions/%v", owner, repo, commentID, reactionID) @@ -123,7 +129,9 @@ func (s *ReactionsService) DeleteCommentReaction(ctx context.Context, owner, rep // DeleteCommentReactionByID deletes the reaction for a commit comment by repository ID. // -// GitHub API docs: https://docs.github.com/en/rest/reactions#delete-a-commit-comment-reaction +// GitHub API docs: https://docs.github.com/rest/reactions/reactions#delete-a-commit-comment-reaction +// +//meta:operation DELETE /repos/{owner}/{repo}/comments/{comment_id}/reactions/{reaction_id} func (s *ReactionsService) DeleteCommentReactionByID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) { u := fmt.Sprintf("repositories/%v/comments/%v/reactions/%v", repoID, commentID, reactionID) @@ -132,7 +140,9 @@ func (s *ReactionsService) DeleteCommentReactionByID(ctx context.Context, repoID // ListIssueReactions lists the reactions for an issue. // -// GitHub API docs: https://docs.github.com/en/rest/reactions#list-reactions-for-an-issue +// GitHub API docs: https://docs.github.com/rest/reactions/reactions#list-reactions-for-an-issue +// +//meta:operation GET /repos/{owner}/{repo}/issues/{issue_number}/reactions func (s *ReactionsService) ListIssueReactions(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%v/reactions", owner, repo, number) u, err := addOptions(u, opts) @@ -162,7 +172,9 @@ func (s *ReactionsService) ListIssueReactions(ctx context.Context, owner, repo s // previously created reaction will be returned with Status: 200 OK. // The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes". // -// GitHub API docs: https://docs.github.com/en/rest/reactions#create-reaction-for-an-issue +// GitHub API docs: https://docs.github.com/rest/reactions/reactions#create-reaction-for-an-issue +// +//meta:operation POST /repos/{owner}/{repo}/issues/{issue_number}/reactions func (s *ReactionsService) CreateIssueReaction(ctx context.Context, owner, repo string, number int, content string) (*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/%v/reactions", owner, repo, number) @@ -186,7 +198,9 @@ func (s *ReactionsService) CreateIssueReaction(ctx context.Context, owner, repo // DeleteIssueReaction deletes the reaction to an issue. // -// GitHub API docs: https://docs.github.com/en/rest/reactions#delete-an-issue-reaction +// GitHub API docs: https://docs.github.com/rest/reactions/reactions#delete-an-issue-reaction +// +//meta:operation DELETE /repos/{owner}/{repo}/issues/{issue_number}/reactions/{reaction_id} func (s *ReactionsService) DeleteIssueReaction(ctx context.Context, owner, repo string, issueNumber int, reactionID int64) (*Response, error) { url := fmt.Sprintf("repos/%v/%v/issues/%v/reactions/%v", owner, repo, issueNumber, reactionID) @@ -195,7 +209,9 @@ func (s *ReactionsService) DeleteIssueReaction(ctx context.Context, owner, repo // DeleteIssueReactionByID deletes the reaction to an issue by repository ID. // -// GitHub API docs: https://docs.github.com/en/rest/reactions#delete-an-issue-reaction +// GitHub API docs: https://docs.github.com/rest/reactions/reactions#delete-an-issue-reaction +// +//meta:operation DELETE /repos/{owner}/{repo}/issues/{issue_number}/reactions/{reaction_id} func (s *ReactionsService) DeleteIssueReactionByID(ctx context.Context, repoID, issueNumber int, reactionID int64) (*Response, error) { url := fmt.Sprintf("repositories/%v/issues/%v/reactions/%v", repoID, issueNumber, reactionID) @@ -204,7 +220,9 @@ func (s *ReactionsService) DeleteIssueReactionByID(ctx context.Context, repoID, // ListIssueCommentReactions lists the reactions for an issue comment. // -// GitHub API docs: https://docs.github.com/en/rest/reactions#list-reactions-for-an-issue-comment +// GitHub API docs: https://docs.github.com/rest/reactions/reactions#list-reactions-for-an-issue-comment +// +//meta:operation GET /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions func (s *ReactionsService) ListIssueCommentReactions(ctx context.Context, owner, repo string, id int64, opts *ListOptions) ([]*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions", owner, repo, id) u, err := addOptions(u, opts) @@ -234,7 +252,9 @@ func (s *ReactionsService) ListIssueCommentReactions(ctx context.Context, owner, // previously created reaction will be returned with Status: 200 OK. // The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes". // -// GitHub API docs: https://docs.github.com/en/rest/reactions#create-reaction-for-an-issue-comment +// GitHub API docs: https://docs.github.com/rest/reactions/reactions#create-reaction-for-an-issue-comment +// +//meta:operation POST /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions func (s *ReactionsService) CreateIssueCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions", owner, repo, id) @@ -258,7 +278,9 @@ func (s *ReactionsService) CreateIssueCommentReaction(ctx context.Context, owner // DeleteIssueCommentReaction deletes the reaction to an issue comment. // -// GitHub API docs: https://docs.github.com/en/rest/reactions#delete-an-issue-comment-reaction +// GitHub API docs: https://docs.github.com/rest/reactions/reactions#delete-an-issue-comment-reaction +// +//meta:operation DELETE /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions/{reaction_id} func (s *ReactionsService) DeleteIssueCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) { url := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions/%v", owner, repo, commentID, reactionID) @@ -267,7 +289,9 @@ func (s *ReactionsService) DeleteIssueCommentReaction(ctx context.Context, owner // DeleteIssueCommentReactionByID deletes the reaction to an issue comment by repository ID. // -// GitHub API docs: https://docs.github.com/en/rest/reactions#delete-an-issue-comment-reaction +// GitHub API docs: https://docs.github.com/rest/reactions/reactions#delete-an-issue-comment-reaction +// +//meta:operation DELETE /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions/{reaction_id} func (s *ReactionsService) DeleteIssueCommentReactionByID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) { url := fmt.Sprintf("repositories/%v/issues/comments/%v/reactions/%v", repoID, commentID, reactionID) @@ -276,7 +300,9 @@ func (s *ReactionsService) DeleteIssueCommentReactionByID(ctx context.Context, r // ListPullRequestCommentReactions lists the reactions for a pull request review comment. // -// GitHub API docs: https://docs.github.com/en/rest/reactions#list-reactions-for-a-pull-request-review-comment +// GitHub API docs: https://docs.github.com/rest/reactions/reactions#list-reactions-for-a-pull-request-review-comment +// +//meta:operation GET /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions func (s *ReactionsService) ListPullRequestCommentReactions(ctx context.Context, owner, repo string, id int64, opts *ListOptions) ([]*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions", owner, repo, id) u, err := addOptions(u, opts) @@ -306,7 +332,9 @@ func (s *ReactionsService) ListPullRequestCommentReactions(ctx context.Context, // previously created reaction will be returned with Status: 200 OK. // The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes". // -// GitHub API docs: https://docs.github.com/en/rest/reactions#create-reaction-for-a-pull-request-review-comment +// GitHub API docs: https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-pull-request-review-comment +// +//meta:operation POST /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions func (s *ReactionsService) CreatePullRequestCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions", owner, repo, id) @@ -330,7 +358,9 @@ func (s *ReactionsService) CreatePullRequestCommentReaction(ctx context.Context, // DeletePullRequestCommentReaction deletes the reaction to a pull request review comment. // -// GitHub API docs: https://docs.github.com/en/rest/reactions#delete-a-pull-request-comment-reaction +// GitHub API docs: https://docs.github.com/rest/reactions/reactions#delete-a-pull-request-comment-reaction +// +//meta:operation DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions/{reaction_id} func (s *ReactionsService) DeletePullRequestCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) { url := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions/%v", owner, repo, commentID, reactionID) @@ -339,7 +369,9 @@ func (s *ReactionsService) DeletePullRequestCommentReaction(ctx context.Context, // DeletePullRequestCommentReactionByID deletes the reaction to a pull request review comment by repository ID. // -// GitHub API docs: https://docs.github.com/en/rest/reactions#delete-a-pull-request-comment-reaction +// GitHub API docs: https://docs.github.com/rest/reactions/reactions#delete-a-pull-request-comment-reaction +// +//meta:operation DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions/{reaction_id} func (s *ReactionsService) DeletePullRequestCommentReactionByID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) { url := fmt.Sprintf("repositories/%v/pulls/comments/%v/reactions/%v", repoID, commentID, reactionID) @@ -348,7 +380,9 @@ func (s *ReactionsService) DeletePullRequestCommentReactionByID(ctx context.Cont // ListTeamDiscussionReactions lists the reactions for a team discussion. // -// GitHub API docs: https://docs.github.com/en/rest/reactions#list-reactions-for-a-team-discussion-legacy +// GitHub API docs: https://docs.github.com/rest/reactions/reactions#list-reactions-for-a-team-discussion-legacy +// +//meta:operation GET /teams/{team_id}/discussions/{discussion_number}/reactions func (s *ReactionsService) ListTeamDiscussionReactions(ctx context.Context, teamID int64, discussionNumber int, opts *ListOptions) ([]*Reaction, *Response, error) { u := fmt.Sprintf("teams/%v/discussions/%v/reactions", teamID, discussionNumber) u, err := addOptions(u, opts) @@ -375,7 +409,9 @@ func (s *ReactionsService) ListTeamDiscussionReactions(ctx context.Context, team // CreateTeamDiscussionReaction creates a reaction for a team discussion. // The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes". // -// GitHub API docs: https://docs.github.com/en/rest/reactions#create-reaction-for-a-team-discussion-legacy +// GitHub API docs: https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-team-discussion-legacy +// +//meta:operation POST /teams/{team_id}/discussions/{discussion_number}/reactions func (s *ReactionsService) CreateTeamDiscussionReaction(ctx context.Context, teamID int64, discussionNumber int, content string) (*Reaction, *Response, error) { u := fmt.Sprintf("teams/%v/discussions/%v/reactions", teamID, discussionNumber) @@ -398,7 +434,9 @@ func (s *ReactionsService) CreateTeamDiscussionReaction(ctx context.Context, tea // DeleteTeamDiscussionReaction deletes the reaction to a team discussion. // -// GitHub API docs: https://docs.github.com/en/rest/reactions#delete-team-discussion-reaction +// GitHub API docs: https://docs.github.com/rest/reactions/reactions#delete-team-discussion-reaction +// +//meta:operation DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions/{reaction_id} func (s *ReactionsService) DeleteTeamDiscussionReaction(ctx context.Context, org, teamSlug string, discussionNumber int, reactionID int64) (*Response, error) { url := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/reactions/%v", org, teamSlug, discussionNumber, reactionID) @@ -407,7 +445,9 @@ func (s *ReactionsService) DeleteTeamDiscussionReaction(ctx context.Context, org // DeleteTeamDiscussionReactionByOrgIDAndTeamID deletes the reaction to a team discussion by organization ID and team ID. // -// GitHub API docs: https://docs.github.com/en/rest/reactions#create-reaction-for-a-team-discussion +// GitHub API docs: https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-team-discussion +// +//meta:operation POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions func (s *ReactionsService) DeleteTeamDiscussionReactionByOrgIDAndTeamID(ctx context.Context, orgID, teamID, discussionNumber int, reactionID int64) (*Response, error) { url := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/reactions/%v", orgID, teamID, discussionNumber, reactionID) @@ -416,7 +456,9 @@ func (s *ReactionsService) DeleteTeamDiscussionReactionByOrgIDAndTeamID(ctx cont // ListTeamDiscussionCommentReactions lists the reactions for a team discussion comment. // -// GitHub API docs: https://docs.github.com/en/rest/reactions#list-reactions-for-a-team-discussion-comment-legacy +// GitHub API docs: https://docs.github.com/rest/reactions/reactions#list-reactions-for-a-team-discussion-comment-legacy +// +//meta:operation GET /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions func (s *ReactionsService) ListTeamDiscussionCommentReactions(ctx context.Context, teamID int64, discussionNumber, commentNumber int, opts *ListOptions) ([]*Reaction, *Response, error) { u := fmt.Sprintf("teams/%v/discussions/%v/comments/%v/reactions", teamID, discussionNumber, commentNumber) u, err := addOptions(u, opts) @@ -442,7 +484,9 @@ func (s *ReactionsService) ListTeamDiscussionCommentReactions(ctx context.Contex // CreateTeamDiscussionCommentReaction creates a reaction for a team discussion comment. // The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes". // -// GitHub API docs: https://docs.github.com/en/rest/reactions#create-reaction-for-a-team-discussion-comment-legacy +// GitHub API docs: https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-team-discussion-comment-legacy +// +//meta:operation POST /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions func (s *ReactionsService) CreateTeamDiscussionCommentReaction(ctx context.Context, teamID int64, discussionNumber, commentNumber int, content string) (*Reaction, *Response, error) { u := fmt.Sprintf("teams/%v/discussions/%v/comments/%v/reactions", teamID, discussionNumber, commentNumber) @@ -465,7 +509,9 @@ func (s *ReactionsService) CreateTeamDiscussionCommentReaction(ctx context.Conte // DeleteTeamDiscussionCommentReaction deletes the reaction to a team discussion comment. // -// GitHub API docs: https://docs.github.com/en/rest/reactions#delete-team-discussion-comment-reaction +// GitHub API docs: https://docs.github.com/rest/reactions/reactions#delete-team-discussion-comment-reaction +// +//meta:operation DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions/{reaction_id} func (s *ReactionsService) DeleteTeamDiscussionCommentReaction(ctx context.Context, org, teamSlug string, discussionNumber, commentNumber int, reactionID int64) (*Response, error) { url := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments/%v/reactions/%v", org, teamSlug, discussionNumber, commentNumber, reactionID) @@ -474,7 +520,9 @@ func (s *ReactionsService) DeleteTeamDiscussionCommentReaction(ctx context.Conte // DeleteTeamDiscussionCommentReactionByOrgIDAndTeamID deletes the reaction to a team discussion comment by organization ID and team ID. // -// GitHub API docs: https://docs.github.com/en/rest/reactions#create-reaction-for-a-team-discussion-comment +// GitHub API docs: https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-team-discussion-comment +// +//meta:operation POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions func (s *ReactionsService) DeleteTeamDiscussionCommentReactionByOrgIDAndTeamID(ctx context.Context, orgID, teamID, discussionNumber, commentNumber int, reactionID int64) (*Response, error) { url := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments/%v/reactions/%v", orgID, teamID, discussionNumber, commentNumber, reactionID) @@ -498,7 +546,9 @@ func (s *ReactionsService) deleteReaction(ctx context.Context, url string) (*Res // added the reaction type to this release. // The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes". // -// GitHub API docs: https://docs.github.com/en/rest/reactions#create-reaction-for-a-release +// GitHub API docs: https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-release +// +//meta:operation POST /repos/{owner}/{repo}/releases/{release_id}/reactions func (s *ReactionsService) CreateReleaseReaction(ctx context.Context, owner, repo string, releaseID int64, content string) (*Reaction, *Response, error) { u := fmt.Sprintf("repos/%v/%v/releases/%v/reactions", owner, repo, releaseID) diff --git a/github/repos.go b/github/repos.go index 60ff9b41347..e158562e69d 100644 --- a/github/repos.go +++ b/github/repos.go @@ -22,7 +22,7 @@ var ErrBranchNotProtected = errors.New("branch is not protected") // RepositoriesService handles communication with the repository related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/en/rest/repos/ +// GitHub API docs: https://docs.github.com/rest/repos/ type RepositoriesService service // Repository represents a GitHub repository. @@ -141,7 +141,7 @@ type Repository struct { TeamsURL *string `json:"teams_url,omitempty"` // TextMatches is only populated from search results that request text matches - // See: search.go and https://docs.github.com/en/rest/search/#text-match-metadata + // See: search.go and https://docs.github.com/rest/search/#text-match-metadata TextMatches []*TextMatch `json:"text_matches,omitempty"` // Visibility is only used for Create and Edit endpoints. The visibility field @@ -150,7 +150,7 @@ type Repository struct { Visibility *string `json:"visibility,omitempty"` // RoleName is only returned by the API 'check team permissions for a repository'. - // See: teams.go (IsTeamRepoByID) https://docs.github.com/en/rest/teams/teams#check-team-permissions-for-a-repository + // See: teams.go (IsTeamRepoByID) https://docs.github.com/rest/teams/teams#check-team-permissions-for-a-repository RoleName *string `json:"role_name,omitempty"` } @@ -220,7 +220,7 @@ func (s SecurityAndAnalysis) String() string { // AdvancedSecurity specifies the state of advanced security on a repository. // -// GitHub API docs: https://docs.github.com/en/github/getting-started-with-github/learning-about-github/about-github-advanced-security +// GitHub API docs: https://docs.github.com/github/getting-started-with-github/learning-about-github/about-github-advanced-security type AdvancedSecurity struct { Status *string `json:"status,omitempty"` } @@ -231,7 +231,7 @@ func (a AdvancedSecurity) String() string { // SecretScanning specifies the state of secret scanning on a repository. // -// GitHub API docs: https://docs.github.com/en/code-security/secret-security/about-secret-scanning +// GitHub API docs: https://docs.github.com/code-security/secret-security/about-secret-scanning type SecretScanning struct { Status *string `json:"status,omitempty"` } @@ -242,7 +242,7 @@ func (s SecretScanning) String() string { // SecretScanningPushProtection specifies the state of secret scanning push protection on a repository. // -// GitHub API docs: https://docs.github.com/en/code-security/secret-scanning/about-secret-scanning#about-secret-scanning-for-partner-patterns +// GitHub API docs: https://docs.github.com/code-security/secret-scanning/about-secret-scanning#about-secret-scanning-for-partner-patterns type SecretScanningPushProtection struct { Status *string `json:"status,omitempty"` } @@ -253,7 +253,7 @@ func (s SecretScanningPushProtection) String() string { // DependabotSecurityUpdates specifies the state of Dependabot security updates on a repository. // -// GitHub API docs: https://docs.github.com/en/code-security/dependabot/dependabot-security-updates/about-dependabot-security-updates +// GitHub API docs: https://docs.github.com/code-security/dependabot/dependabot-security-updates/about-dependabot-security-updates type DependabotSecurityUpdates struct { Status *string `json:"status,omitempty"` } @@ -265,8 +265,11 @@ func (d DependabotSecurityUpdates) String() string { // List the repositories for a user. Passing the empty string will list // repositories for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/repos/repos#list-repositories-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/rest/repos/repos#list-repositories-for-a-user +// GitHub API docs: https://docs.github.com/rest/repos/repos#list-repositories-for-a-user +// GitHub API docs: https://docs.github.com/rest/repos/repos#list-repositories-for-the-authenticated-user +// +//meta:operation GET /user/repos +//meta:operation GET /users/{username}/repos func (s *RepositoriesService) List(ctx context.Context, user string, opts *RepositoryListOptions) ([]*Repository, *Response, error) { var u string if user != "" { @@ -317,7 +320,9 @@ type RepositoryListByOrgOptions struct { // ListByOrg lists the repositories for an organization. // -// GitHub API docs: https://docs.github.com/en/rest/repos/repos#list-organization-repositories +// GitHub API docs: https://docs.github.com/rest/repos/repos#list-organization-repositories +// +//meta:operation GET /orgs/{org}/repos func (s *RepositoriesService) ListByOrg(ctx context.Context, org string, opts *RepositoryListByOrgOptions) ([]*Repository, *Response, error) { u := fmt.Sprintf("orgs/%v/repos", org) u, err := addOptions(u, opts) @@ -352,7 +357,9 @@ type RepositoryListAllOptions struct { // ListAll lists all GitHub repositories in the order that they were created. // -// GitHub API docs: https://docs.github.com/en/rest/repos/repos#list-public-repositories +// GitHub API docs: https://docs.github.com/rest/repos/repos#list-public-repositories +// +//meta:operation GET /repositories func (s *RepositoriesService) ListAll(ctx context.Context, opts *RepositoryListAllOptions) ([]*Repository, *Response, error) { u, err := addOptions("repositories", opts) if err != nil { @@ -424,8 +431,11 @@ type createRepoRequest struct { // changes propagate throughout its servers. You may set up a loop with // exponential back-off to verify repository's creation. // -// GitHub API docs: https://docs.github.com/en/rest/repos/repos#create-a-repository-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/rest/repos/repos#create-an-organization-repository +// GitHub API docs: https://docs.github.com/rest/repos/repos#create-a-repository-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/repos/repos#create-an-organization-repository +// +//meta:operation POST /orgs/{org}/repos +//meta:operation POST /user/repos func (s *RepositoriesService) Create(ctx context.Context, org string, repo *Repository) (*Repository, *Response, error) { var u string if org != "" { @@ -492,7 +502,9 @@ type TemplateRepoRequest struct { // CreateFromTemplate generates a repository from a template. // -// GitHub API docs: https://docs.github.com/en/rest/repos/repos#create-a-repository-using-a-template +// GitHub API docs: https://docs.github.com/rest/repos/repos#create-a-repository-using-a-template +// +//meta:operation POST /repos/{template_owner}/{template_repo}/generate func (s *RepositoriesService) CreateFromTemplate(ctx context.Context, templateOwner, templateRepo string, templateRepoReq *TemplateRepoRequest) (*Repository, *Response, error) { u := fmt.Sprintf("repos/%v/%v/generate", templateOwner, templateRepo) @@ -513,7 +525,9 @@ func (s *RepositoriesService) CreateFromTemplate(ctx context.Context, templateOw // Get fetches a repository. // -// GitHub API docs: https://docs.github.com/en/rest/repos/repos#get-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/repos#get-a-repository +// +//meta:operation GET /repos/{owner}/{repo} func (s *RepositoriesService) Get(ctx context.Context, owner, repo string) (*Repository, *Response, error) { u := fmt.Sprintf("repos/%v/%v", owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -522,7 +536,7 @@ func (s *RepositoriesService) Get(ctx context.Context, owner, repo string) (*Rep } // TODO: remove custom Accept header when the license support fully launches - // https://docs.github.com/en/rest/licenses/#get-a-repositorys-license + // https://docs.github.com/rest/licenses/#get-a-repositorys-license acceptHeaders := []string{ mediaTypeCodesOfConductPreview, mediaTypeTopicsPreview, @@ -541,10 +555,12 @@ func (s *RepositoriesService) Get(ctx context.Context, owner, repo string) (*Rep } // GetCodeOfConduct gets the contents of a repository's code of conduct. -// Note that https://docs.github.com/en/rest/codes-of-conduct#about-the-codes-of-conduct-api +// Note that https://docs.github.com/rest/codes-of-conduct#about-the-codes-of-conduct-api // says to use the GET /repos/{owner}/{repo} endpoint. // -// GitHub API docs: https://docs.github.com/en/rest/repos/repos#update-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/repos#get-a-repository +// +//meta:operation GET /repos/{owner}/{repo} func (s *RepositoriesService) GetCodeOfConduct(ctx context.Context, owner, repo string) (*CodeOfConduct, *Response, error) { u := fmt.Sprintf("repos/%v/%v", owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -566,7 +582,9 @@ func (s *RepositoriesService) GetCodeOfConduct(ctx context.Context, owner, repo // GetByID fetches a repository. // -// Note: GetByID uses the undocumented GitHub API endpoint /repositories/:id. +// Note: GetByID uses the undocumented GitHub API endpoint "GET /repositories/{repository_id}". +// +//meta:operation GET /repositories/{repository_id} func (s *RepositoriesService) GetByID(ctx context.Context, id int64) (*Repository, *Response, error) { u := fmt.Sprintf("repositories/%d", id) req, err := s.client.NewRequest("GET", u, nil) @@ -585,7 +603,9 @@ func (s *RepositoriesService) GetByID(ctx context.Context, id int64) (*Repositor // Edit updates a repository. // -// GitHub API docs: https://docs.github.com/en/rest/repos/repos#update-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/repos#update-a-repository +// +//meta:operation PATCH /repos/{owner}/{repo} func (s *RepositoriesService) Edit(ctx context.Context, owner, repo string, repository *Repository) (*Repository, *Response, error) { u := fmt.Sprintf("repos/%v/%v", owner, repo) req, err := s.client.NewRequest("PATCH", u, repository) @@ -606,7 +626,9 @@ func (s *RepositoriesService) Edit(ctx context.Context, owner, repo string, repo // Delete a repository. // -// GitHub API docs: https://docs.github.com/en/rest/repos/repos#delete-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/repos#delete-a-repository +// +//meta:operation DELETE /repos/{owner}/{repo} func (s *RepositoriesService) Delete(ctx context.Context, owner, repo string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v", owner, repo) req, err := s.client.NewRequest("DELETE", u, nil) @@ -653,7 +675,9 @@ type ListContributorsOptions struct { // GetVulnerabilityAlerts checks if vulnerability alerts are enabled for a repository. // -// GitHub API docs: https://docs.github.com/en/rest/repos/repos#check-if-vulnerability-alerts-are-enabled-for-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/repos#check-if-vulnerability-alerts-are-enabled-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/vulnerability-alerts func (s *RepositoriesService) GetVulnerabilityAlerts(ctx context.Context, owner, repository string) (bool, *Response, error) { u := fmt.Sprintf("repos/%v/%v/vulnerability-alerts", owner, repository) @@ -672,7 +696,9 @@ func (s *RepositoriesService) GetVulnerabilityAlerts(ctx context.Context, owner, // EnableVulnerabilityAlerts enables vulnerability alerts and the dependency graph for a repository. // -// GitHub API docs: https://docs.github.com/en/rest/repos/repos#enable-vulnerability-alerts +// GitHub API docs: https://docs.github.com/rest/repos/repos#enable-vulnerability-alerts +// +//meta:operation PUT /repos/{owner}/{repo}/vulnerability-alerts func (s *RepositoriesService) EnableVulnerabilityAlerts(ctx context.Context, owner, repository string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/vulnerability-alerts", owner, repository) @@ -689,7 +715,9 @@ func (s *RepositoriesService) EnableVulnerabilityAlerts(ctx context.Context, own // DisableVulnerabilityAlerts disables vulnerability alerts and the dependency graph for a repository. // -// GitHub API docs: https://docs.github.com/en/rest/repos/repos#disable-vulnerability-alerts +// GitHub API docs: https://docs.github.com/rest/repos/repos#disable-vulnerability-alerts +// +//meta:operation DELETE /repos/{owner}/{repo}/vulnerability-alerts func (s *RepositoriesService) DisableVulnerabilityAlerts(ctx context.Context, owner, repository string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/vulnerability-alerts", owner, repository) @@ -706,7 +734,9 @@ func (s *RepositoriesService) DisableVulnerabilityAlerts(ctx context.Context, ow // GetAutomatedSecurityFixes checks if the automated security fixes for a repository are enabled. // -// GitHub API docs: https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#check-if-automated-security-fixes-are-enabled-for-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/repos#check-if-automated-security-fixes-are-enabled-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/automated-security-fixes func (s *RepositoriesService) GetAutomatedSecurityFixes(ctx context.Context, owner, repository string) (*AutomatedSecurityFixes, *Response, error) { u := fmt.Sprintf("repos/%v/%v/automated-security-fixes", owner, repository) @@ -725,7 +755,9 @@ func (s *RepositoriesService) GetAutomatedSecurityFixes(ctx context.Context, own // EnableAutomatedSecurityFixes enables the automated security fixes for a repository. // -// GitHub API docs: https://docs.github.com/en/rest/repos/repos#enable-automated-security-fixes +// GitHub API docs: https://docs.github.com/rest/repos/repos#enable-automated-security-fixes +// +//meta:operation PUT /repos/{owner}/{repo}/automated-security-fixes func (s *RepositoriesService) EnableAutomatedSecurityFixes(ctx context.Context, owner, repository string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/automated-security-fixes", owner, repository) @@ -739,7 +771,9 @@ func (s *RepositoriesService) EnableAutomatedSecurityFixes(ctx context.Context, // DisableAutomatedSecurityFixes disables vulnerability alerts and the dependency graph for a repository. // -// GitHub API docs: https://docs.github.com/en/rest/repos/repos#disable-automated-security-fixes +// GitHub API docs: https://docs.github.com/rest/repos/repos#disable-automated-security-fixes +// +//meta:operation DELETE /repos/{owner}/{repo}/automated-security-fixes func (s *RepositoriesService) DisableAutomatedSecurityFixes(ctx context.Context, owner, repository string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/automated-security-fixes", owner, repository) @@ -753,7 +787,9 @@ func (s *RepositoriesService) DisableAutomatedSecurityFixes(ctx context.Context, // ListContributors lists contributors for a repository. // -// GitHub API docs: https://docs.github.com/en/rest/repos/repos#list-repository-contributors +// GitHub API docs: https://docs.github.com/rest/repos/repos#list-repository-contributors +// +//meta:operation GET /repos/{owner}/{repo}/contributors func (s *RepositoriesService) ListContributors(ctx context.Context, owner string, repository string, opts *ListContributorsOptions) ([]*Contributor, *Response, error) { u := fmt.Sprintf("repos/%v/%v/contributors", owner, repository) u, err := addOptions(u, opts) @@ -784,7 +820,9 @@ func (s *RepositoriesService) ListContributors(ctx context.Context, owner string // "Python": 7769 // } // -// GitHub API docs: https://docs.github.com/en/rest/repos/repos#list-repository-languages +// GitHub API docs: https://docs.github.com/rest/repos/repos#list-repository-languages +// +//meta:operation GET /repos/{owner}/{repo}/languages func (s *RepositoriesService) ListLanguages(ctx context.Context, owner string, repo string) (map[string]int, *Response, error) { u := fmt.Sprintf("repos/%v/%v/languages", owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -803,7 +841,9 @@ func (s *RepositoriesService) ListLanguages(ctx context.Context, owner string, r // ListTeams lists the teams for the specified repository. // -// GitHub API docs: https://docs.github.com/en/rest/repos/repos#list-repository-teams +// GitHub API docs: https://docs.github.com/rest/repos/repos#list-repository-teams +// +//meta:operation GET /repos/{owner}/{repo}/teams func (s *RepositoriesService) ListTeams(ctx context.Context, owner string, repo string, opts *ListOptions) ([]*Team, *Response, error) { u := fmt.Sprintf("repos/%v/%v/teams", owner, repo) u, err := addOptions(u, opts) @@ -835,7 +875,9 @@ type RepositoryTag struct { // ListTags lists tags for the specified repository. // -// GitHub API docs: https://docs.github.com/en/rest/repos/repos#list-repository-tags +// GitHub API docs: https://docs.github.com/rest/repos/repos#list-repository-tags +// +//meta:operation GET /repos/{owner}/{repo}/tags func (s *RepositoriesService) ListTags(ctx context.Context, owner string, repo string, opts *ListOptions) ([]*RepositoryTag, *Response, error) { u := fmt.Sprintf("repos/%v/%v/tags", owner, repo) u, err := addOptions(u, opts) @@ -1251,7 +1293,9 @@ type AutomatedSecurityFixes struct { // ListBranches lists branches for the specified repository. // -// GitHub API docs: https://docs.github.com/en/rest/branches/branches#list-branches +// GitHub API docs: https://docs.github.com/rest/branches/branches#list-branches +// +//meta:operation GET /repos/{owner}/{repo}/branches func (s *RepositoriesService) ListBranches(ctx context.Context, owner string, repo string, opts *BranchListOptions) ([]*Branch, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches", owner, repo) u, err := addOptions(u, opts) @@ -1277,7 +1321,9 @@ func (s *RepositoriesService) ListBranches(ctx context.Context, owner string, re // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/en/rest/branches/branches#get-a-branch +// GitHub API docs: https://docs.github.com/rest/branches/branches#get-a-branch +// +//meta:operation GET /repos/{owner}/{repo}/branches/{branch} func (s *RepositoriesService) GetBranch(ctx context.Context, owner, repo, branch string, maxRedirects int) (*Branch, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v", owner, repo, url.PathEscape(branch)) @@ -1308,7 +1354,9 @@ type renameBranchRequest struct { // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/en/rest/branches/branches#rename-a-branch +// GitHub API docs: https://docs.github.com/rest/branches/branches#rename-a-branch +// +//meta:operation POST /repos/{owner}/{repo}/branches/{branch}/rename func (s *RepositoriesService) RenameBranch(ctx context.Context, owner, repo, branch, newName string) (*Branch, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/rename", owner, repo, url.PathEscape(branch)) r := &renameBranchRequest{NewName: newName} @@ -1330,7 +1378,9 @@ func (s *RepositoriesService) RenameBranch(ctx context.Context, owner, repo, bra // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#get-branch-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#get-branch-protection +// +//meta:operation GET /repos/{owner}/{repo}/branches/{branch}/protection func (s *RepositoriesService) GetBranchProtection(ctx context.Context, owner, repo, branch string) (*Protection, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("GET", u, nil) @@ -1357,7 +1407,9 @@ func (s *RepositoriesService) GetBranchProtection(ctx context.Context, owner, re // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#get-status-checks-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#get-status-checks-protection +// +//meta:operation GET /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks func (s *RepositoriesService) GetRequiredStatusChecks(ctx context.Context, owner, repo, branch string) (*RequiredStatusChecks, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_status_checks", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("GET", u, nil) @@ -1381,7 +1433,9 @@ func (s *RepositoriesService) GetRequiredStatusChecks(ctx context.Context, owner // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#get-all-status-check-contexts +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#get-all-status-check-contexts +// +//meta:operation GET /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts func (s *RepositoriesService) ListRequiredStatusChecksContexts(ctx context.Context, owner, repo, branch string) (contexts []string, resp *Response, err error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_status_checks/contexts", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("GET", u, nil) @@ -1404,7 +1458,9 @@ func (s *RepositoriesService) ListRequiredStatusChecksContexts(ctx context.Conte // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#update-branch-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#update-branch-protection +// +//meta:operation PUT /repos/{owner}/{repo}/branches/{branch}/protection func (s *RepositoriesService) UpdateBranchProtection(ctx context.Context, owner, repo, branch string, preq *ProtectionRequest) (*Protection, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("PUT", u, preq) @@ -1428,7 +1484,9 @@ func (s *RepositoriesService) UpdateBranchProtection(ctx context.Context, owner, // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#delete-branch-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#delete-branch-protection +// +//meta:operation DELETE /repos/{owner}/{repo}/branches/{branch}/protection func (s *RepositoriesService) RemoveBranchProtection(ctx context.Context, owner, repo, branch string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("DELETE", u, nil) @@ -1443,7 +1501,9 @@ func (s *RepositoriesService) RemoveBranchProtection(ctx context.Context, owner, // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#get-commit-signature-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#get-commit-signature-protection +// +//meta:operation GET /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures func (s *RepositoriesService) GetSignaturesProtectedBranch(ctx context.Context, owner, repo, branch string) (*SignaturesProtectedBranch, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_signatures", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("GET", u, nil) @@ -1468,7 +1528,9 @@ func (s *RepositoriesService) GetSignaturesProtectedBranch(ctx context.Context, // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#create-commit-signature-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#create-commit-signature-protection +// +//meta:operation POST /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures func (s *RepositoriesService) RequireSignaturesOnProtectedBranch(ctx context.Context, owner, repo, branch string) (*SignaturesProtectedBranch, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_signatures", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("POST", u, nil) @@ -1492,7 +1554,9 @@ func (s *RepositoriesService) RequireSignaturesOnProtectedBranch(ctx context.Con // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#delete-commit-signature-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#delete-commit-signature-protection +// +//meta:operation DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures func (s *RepositoriesService) OptionalSignaturesOnProtectedBranch(ctx context.Context, owner, repo, branch string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_signatures", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("DELETE", u, nil) @@ -1510,7 +1574,9 @@ func (s *RepositoriesService) OptionalSignaturesOnProtectedBranch(ctx context.Co // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#update-status-check-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#update-status-check-protection +// +//meta:operation PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks func (s *RepositoriesService) UpdateRequiredStatusChecks(ctx context.Context, owner, repo, branch string, sreq *RequiredStatusChecksRequest) (*RequiredStatusChecks, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_status_checks", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("PATCH", u, sreq) @@ -1531,7 +1597,9 @@ func (s *RepositoriesService) UpdateRequiredStatusChecks(ctx context.Context, ow // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#remove-status-check-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#remove-status-check-protection +// +//meta:operation DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks func (s *RepositoriesService) RemoveRequiredStatusChecks(ctx context.Context, owner, repo, branch string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_status_checks", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("DELETE", u, nil) @@ -1544,7 +1612,9 @@ func (s *RepositoriesService) RemoveRequiredStatusChecks(ctx context.Context, ow // License gets the contents of a repository's license if one is detected. // -// GitHub API docs: https://docs.github.com/en/rest/licenses#get-the-license-for-a-repository +// GitHub API docs: https://docs.github.com/rest/licenses/licenses#get-the-license-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/license func (s *RepositoriesService) License(ctx context.Context, owner, repo string) (*RepositoryLicense, *Response, error) { u := fmt.Sprintf("repos/%v/%v/license", owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -1565,7 +1635,9 @@ func (s *RepositoriesService) License(ctx context.Context, owner, repo string) ( // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#get-pull-request-review-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#get-pull-request-review-protection +// +//meta:operation GET /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews func (s *RepositoriesService) GetPullRequestReviewEnforcement(ctx context.Context, owner, repo, branch string) (*PullRequestReviewsEnforcement, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_pull_request_reviews", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("GET", u, nil) @@ -1590,7 +1662,9 @@ func (s *RepositoriesService) GetPullRequestReviewEnforcement(ctx context.Contex // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#update-pull-request-review-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#update-pull-request-review-protection +// +//meta:operation PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews func (s *RepositoriesService) UpdatePullRequestReviewEnforcement(ctx context.Context, owner, repo, branch string, patch *PullRequestReviewsEnforcementUpdate) (*PullRequestReviewsEnforcement, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_pull_request_reviews", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("PATCH", u, patch) @@ -1615,7 +1689,9 @@ func (s *RepositoriesService) UpdatePullRequestReviewEnforcement(ctx context.Con // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#update-pull-request-review-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#update-pull-request-review-protection +// +//meta:operation PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews func (s *RepositoriesService) DisableDismissalRestrictions(ctx context.Context, owner, repo, branch string) (*PullRequestReviewsEnforcement, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_pull_request_reviews", owner, repo, url.PathEscape(branch)) @@ -1644,7 +1720,9 @@ func (s *RepositoriesService) DisableDismissalRestrictions(ctx context.Context, // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#delete-pull-request-review-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#delete-pull-request-review-protection +// +//meta:operation DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews func (s *RepositoriesService) RemovePullRequestReviewEnforcement(ctx context.Context, owner, repo, branch string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_pull_request_reviews", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("DELETE", u, nil) @@ -1659,7 +1737,9 @@ func (s *RepositoriesService) RemovePullRequestReviewEnforcement(ctx context.Con // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#get-admin-branch-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#get-admin-branch-protection +// +//meta:operation GET /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins func (s *RepositoriesService) GetAdminEnforcement(ctx context.Context, owner, repo, branch string) (*AdminEnforcement, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/enforce_admins", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("GET", u, nil) @@ -1681,7 +1761,9 @@ func (s *RepositoriesService) GetAdminEnforcement(ctx context.Context, owner, re // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#set-admin-branch-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#set-admin-branch-protection +// +//meta:operation POST /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins func (s *RepositoriesService) AddAdminEnforcement(ctx context.Context, owner, repo, branch string) (*AdminEnforcement, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/enforce_admins", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("POST", u, nil) @@ -1702,7 +1784,9 @@ func (s *RepositoriesService) AddAdminEnforcement(ctx context.Context, owner, re // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#delete-admin-branch-protection +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#delete-admin-branch-protection +// +//meta:operation DELETE /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins func (s *RepositoriesService) RemoveAdminEnforcement(ctx context.Context, owner, repo, branch string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/enforce_admins", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("DELETE", u, nil) @@ -1720,7 +1804,9 @@ type repositoryTopics struct { // ListAllTopics lists topics for a repository. // -// GitHub API docs: https://docs.github.com/en/rest/repos/repos#get-all-repository-topics +// GitHub API docs: https://docs.github.com/rest/repos/repos#get-all-repository-topics +// +//meta:operation GET /repos/{owner}/{repo}/topics func (s *RepositoriesService) ListAllTopics(ctx context.Context, owner, repo string) ([]string, *Response, error) { u := fmt.Sprintf("repos/%v/%v/topics", owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -1742,7 +1828,9 @@ func (s *RepositoriesService) ListAllTopics(ctx context.Context, owner, repo str // ReplaceAllTopics replaces all repository topics. // -// GitHub API docs: https://docs.github.com/en/rest/repos/repos#replace-all-repository-topics +// GitHub API docs: https://docs.github.com/rest/repos/repos#replace-all-repository-topics +// +//meta:operation PUT /repos/{owner}/{repo}/topics func (s *RepositoriesService) ReplaceAllTopics(ctx context.Context, owner, repo string, topics []string) ([]string, *Response, error) { u := fmt.Sprintf("repos/%v/%v/topics", owner, repo) t := &repositoryTopics{ @@ -1773,9 +1861,11 @@ func (s *RepositoriesService) ReplaceAllTopics(ctx context.Context, owner, repo // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#get-apps-with-access-to-the-protected-branch -// // Deprecated: Please use ListAppRestrictions instead. +// +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#get-apps-with-access-to-the-protected-branch +// +//meta:operation GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps func (s *RepositoriesService) ListApps(ctx context.Context, owner, repo, branch string) ([]*App, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/apps", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("GET", u, nil) @@ -1795,9 +1885,11 @@ func (s *RepositoriesService) ListApps(ctx context.Context, owner, repo, branch // ListAppRestrictions lists the GitHub apps that have push access to a given protected branch. // It requires the GitHub apps to have `write` access to the `content` permission. // -// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#get-apps-with-access-to-the-protected-branch -// // Note: This is a wrapper around ListApps so a naming convention with ListUserRestrictions and ListTeamRestrictions is preserved. +// +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#get-apps-with-access-to-the-protected-branch +// +//meta:operation GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps func (s *RepositoriesService) ListAppRestrictions(ctx context.Context, owner, repo, branch string) ([]*App, *Response, error) { return s.ListApps(ctx, owner, repo, branch) } @@ -1810,7 +1902,9 @@ func (s *RepositoriesService) ListAppRestrictions(ctx context.Context, owner, re // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#set-app-access-restrictions +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#set-app-access-restrictions +// +//meta:operation PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps func (s *RepositoriesService) ReplaceAppRestrictions(ctx context.Context, owner, repo, branch string, apps []string) ([]*App, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/apps", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("PUT", u, apps) @@ -1834,7 +1928,9 @@ func (s *RepositoriesService) ReplaceAppRestrictions(ctx context.Context, owner, // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#add-app-access-restrictions +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#add-app-access-restrictions +// +//meta:operation POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps func (s *RepositoriesService) AddAppRestrictions(ctx context.Context, owner, repo, branch string, apps []string) ([]*App, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/apps", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("POST", u, apps) @@ -1858,7 +1954,9 @@ func (s *RepositoriesService) AddAppRestrictions(ctx context.Context, owner, rep // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#remove-app-access-restrictions +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#remove-app-access-restrictions +// +//meta:operation DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps func (s *RepositoriesService) RemoveAppRestrictions(ctx context.Context, owner, repo, branch string, apps []string) ([]*App, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/apps", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("DELETE", u, apps) @@ -1880,7 +1978,9 @@ func (s *RepositoriesService) RemoveAppRestrictions(ctx context.Context, owner, // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#get-teams-with-access-to-the-protected-branch +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#get-teams-with-access-to-the-protected-branch +// +//meta:operation GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams func (s *RepositoriesService) ListTeamRestrictions(ctx context.Context, owner, repo, branch string) ([]*Team, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/teams", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("GET", u, nil) @@ -1905,7 +2005,9 @@ func (s *RepositoriesService) ListTeamRestrictions(ctx context.Context, owner, r // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#set-team-access-restrictions +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#set-team-access-restrictions +// +//meta:operation PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams func (s *RepositoriesService) ReplaceTeamRestrictions(ctx context.Context, owner, repo, branch string, teams []string) ([]*Team, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/teams", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("PUT", u, teams) @@ -1929,7 +2031,9 @@ func (s *RepositoriesService) ReplaceTeamRestrictions(ctx context.Context, owner // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#add-team-access-restrictions +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#add-team-access-restrictions +// +//meta:operation POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams func (s *RepositoriesService) AddTeamRestrictions(ctx context.Context, owner, repo, branch string, teams []string) ([]*Team, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/teams", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("POST", u, teams) @@ -1953,7 +2057,9 @@ func (s *RepositoriesService) AddTeamRestrictions(ctx context.Context, owner, re // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#remove-team-access-restrictions +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#remove-team-access-restrictions +// +//meta:operation DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams func (s *RepositoriesService) RemoveTeamRestrictions(ctx context.Context, owner, repo, branch string, teams []string) ([]*Team, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/teams", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("DELETE", u, teams) @@ -1975,7 +2081,9 @@ func (s *RepositoriesService) RemoveTeamRestrictions(ctx context.Context, owner, // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#get-users-with-access-to-the-protected-branch +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#get-users-with-access-to-the-protected-branch +// +//meta:operation GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users func (s *RepositoriesService) ListUserRestrictions(ctx context.Context, owner, repo, branch string) ([]*User, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/users", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("GET", u, nil) @@ -2000,7 +2108,9 @@ func (s *RepositoriesService) ListUserRestrictions(ctx context.Context, owner, r // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#set-team-access-restrictions +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#set-user-access-restrictions +// +//meta:operation PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users func (s *RepositoriesService) ReplaceUserRestrictions(ctx context.Context, owner, repo, branch string, users []string) ([]*User, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/users", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("PUT", u, users) @@ -2024,7 +2134,9 @@ func (s *RepositoriesService) ReplaceUserRestrictions(ctx context.Context, owner // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#add-team-access-restrictions +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#add-user-access-restrictions +// +//meta:operation POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users func (s *RepositoriesService) AddUserRestrictions(ctx context.Context, owner, repo, branch string, users []string) ([]*User, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/users", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("POST", u, users) @@ -2048,7 +2160,9 @@ func (s *RepositoriesService) AddUserRestrictions(ctx context.Context, owner, re // // Note: the branch name is URL path escaped for you. See: https://pkg.go.dev/net/url#PathEscape . // -// GitHub API docs: https://docs.github.com/en/rest/branches/branch-protection#remove-team-access-restrictions +// GitHub API docs: https://docs.github.com/rest/branches/branch-protection#remove-user-access-restrictions +// +//meta:operation DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users func (s *RepositoriesService) RemoveUserRestrictions(ctx context.Context, owner, repo, branch string, users []string) ([]*User, *Response, error) { u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/restrictions/users", owner, repo, url.PathEscape(branch)) req, err := s.client.NewRequest("DELETE", u, users) @@ -2080,7 +2194,9 @@ type TransferRequest struct { // A follow up request, after a delay of a second or so, should result // in a successful request. // -// GitHub API docs: https://docs.github.com/en/rest/repos/repos#transfer-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/repos#transfer-a-repository +// +//meta:operation POST /repos/{owner}/{repo}/transfer func (s *RepositoriesService) Transfer(ctx context.Context, owner, repo string, transfer TransferRequest) (*Repository, *Response, error) { u := fmt.Sprintf("repos/%v/%v/transfer", owner, repo) @@ -2109,7 +2225,9 @@ type DispatchRequestOptions struct { // Dispatch triggers a repository_dispatch event in a GitHub Actions workflow. // -// GitHub API docs: https://docs.github.com/en/rest/repos/repos#create-a-repository-dispatch-event +// GitHub API docs: https://docs.github.com/rest/repos/repos#create-a-repository-dispatch-event +// +//meta:operation POST /repos/{owner}/{repo}/dispatches func (s *RepositoriesService) Dispatch(ctx context.Context, owner, repo string, opts DispatchRequestOptions) (*Repository, *Response, error) { u := fmt.Sprintf("repos/%v/%v/dispatches", owner, repo) @@ -2137,7 +2255,9 @@ func isBranchNotProtected(err error) bool { // EnablePrivateReporting enables private reporting of vulnerabilities for a // repository. // -// GitHub API docs: https://docs.github.com/en/rest/repos/repos#enable-private-vulnerability-reporting-for-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/repos#enable-private-vulnerability-reporting-for-a-repository +// +//meta:operation PUT /repos/{owner}/{repo}/private-vulnerability-reporting func (s *RepositoriesService) EnablePrivateReporting(ctx context.Context, owner, repo string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/private-vulnerability-reporting", owner, repo) @@ -2157,7 +2277,9 @@ func (s *RepositoriesService) EnablePrivateReporting(ctx context.Context, owner, // DisablePrivateReporting disables private reporting of vulnerabilities for a // repository. // -// GitHub API docs: https://docs.github.com/en/rest/repos/repos#disable-private-vulnerability-reporting-for-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/repos#disable-private-vulnerability-reporting-for-a-repository +// +//meta:operation DELETE /repos/{owner}/{repo}/private-vulnerability-reporting func (s *RepositoriesService) DisablePrivateReporting(ctx context.Context, owner, repo string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/private-vulnerability-reporting", owner, repo) diff --git a/github/repos_actions_access.go b/github/repos_actions_access.go index 55761eeb7ee..2da1f01cc26 100644 --- a/github/repos_actions_access.go +++ b/github/repos_actions_access.go @@ -12,7 +12,7 @@ import ( // RepositoryActionsAccessLevel represents the repository actions access level. // -// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#set-the-level-of-access-for-workflows-outside-of-the-repository +// GitHub API docs: https://docs.github.com/rest/actions/permissions#set-the-level-of-access-for-workflows-outside-of-the-repository type RepositoryActionsAccessLevel struct { // AccessLevel specifies the level of access that workflows outside of the repository have // to actions and reusable workflows within the repository. @@ -23,7 +23,9 @@ type RepositoryActionsAccessLevel struct { // GetActionsAccessLevel gets the level of access that workflows outside of the repository have // to actions and reusable workflows in the repository. // -// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#get-the-level-of-access-for-workflows-outside-of-the-repository +// GitHub API docs: https://docs.github.com/rest/actions/permissions#get-the-level-of-access-for-workflows-outside-of-the-repository +// +//meta:operation GET /repos/{owner}/{repo}/actions/permissions/access func (s *RepositoriesService) GetActionsAccessLevel(ctx context.Context, owner, repo string) (*RepositoryActionsAccessLevel, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/permissions/access", owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -43,7 +45,9 @@ func (s *RepositoriesService) GetActionsAccessLevel(ctx context.Context, owner, // EditActionsAccessLevel sets the level of access that workflows outside of the repository have // to actions and reusable workflows in the repository. // -// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#set-the-level-of-access-for-workflows-outside-of-the-repository +// GitHub API docs: https://docs.github.com/rest/actions/permissions#set-the-level-of-access-for-workflows-outside-of-the-repository +// +//meta:operation PUT /repos/{owner}/{repo}/actions/permissions/access func (s *RepositoriesService) EditActionsAccessLevel(ctx context.Context, owner, repo string, repositoryActionsAccessLevel RepositoryActionsAccessLevel) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/permissions/access", owner, repo) req, err := s.client.NewRequest("PUT", u, repositoryActionsAccessLevel) diff --git a/github/repos_actions_allowed.go b/github/repos_actions_allowed.go index 25a46905839..e9ebff1d328 100644 --- a/github/repos_actions_allowed.go +++ b/github/repos_actions_allowed.go @@ -12,7 +12,9 @@ import ( // GetActionsAllowed gets the allowed actions and reusable workflows for a repository. // -// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/actions/permissions/selected-actions func (s *RepositoriesService) GetActionsAllowed(ctx context.Context, org, repo string) (*ActionsAllowed, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/permissions/selected-actions", org, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -31,7 +33,9 @@ func (s *RepositoriesService) GetActionsAllowed(ctx context.Context, org, repo s // EditActionsAllowed sets the allowed actions and reusable workflows for a repository. // -// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-a-repository +// +//meta:operation PUT /repos/{owner}/{repo}/actions/permissions/selected-actions func (s *RepositoriesService) EditActionsAllowed(ctx context.Context, org, repo string, actionsAllowed ActionsAllowed) (*ActionsAllowed, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/permissions/selected-actions", org, repo) req, err := s.client.NewRequest("PUT", u, actionsAllowed) diff --git a/github/repos_actions_permissions.go b/github/repos_actions_permissions.go index 45f844cec02..2dcc367de1c 100644 --- a/github/repos_actions_permissions.go +++ b/github/repos_actions_permissions.go @@ -12,7 +12,7 @@ import ( // ActionsPermissionsRepository represents a policy for repositories and allowed actions in a repository. // -// GitHub API docs: https://docs.github.com/en/rest/actions/permissions +// GitHub API docs: https://docs.github.com/rest/actions/permissions type ActionsPermissionsRepository struct { Enabled *bool `json:"enabled,omitempty"` AllowedActions *string `json:"allowed_actions,omitempty"` @@ -25,7 +25,9 @@ func (a ActionsPermissionsRepository) String() string { // GetActionsPermissions gets the GitHub Actions permissions policy for repositories and allowed actions in a repository. // -// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#get-github-actions-permissions-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/permissions#get-github-actions-permissions-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/actions/permissions func (s *RepositoriesService) GetActionsPermissions(ctx context.Context, owner, repo string) (*ActionsPermissionsRepository, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/permissions", owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -44,7 +46,9 @@ func (s *RepositoriesService) GetActionsPermissions(ctx context.Context, owner, // EditActionsPermissions sets the permissions policy for repositories and allowed actions in a repository. // -// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#set-github-actions-permissions-for-a-repository +// GitHub API docs: https://docs.github.com/rest/actions/permissions#set-github-actions-permissions-for-a-repository +// +//meta:operation PUT /repos/{owner}/{repo}/actions/permissions func (s *RepositoriesService) EditActionsPermissions(ctx context.Context, owner, repo string, actionsPermissionsRepository ActionsPermissionsRepository) (*ActionsPermissionsRepository, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/permissions", owner, repo) req, err := s.client.NewRequest("PUT", u, actionsPermissionsRepository) diff --git a/github/repos_autolinks.go b/github/repos_autolinks.go index 0d2cec618f0..200605aa0b2 100644 --- a/github/repos_autolinks.go +++ b/github/repos_autolinks.go @@ -28,7 +28,9 @@ type Autolink struct { // ListAutolinks returns a list of autolinks configured for the given repository. // Information about autolinks are only available to repository administrators. // -// GitHub API docs: https://docs.github.com/en/rest/repos/autolinks#list-all-autolinks-of-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/autolinks#list-all-autolinks-of-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/autolinks func (s *RepositoriesService) ListAutolinks(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Autolink, *Response, error) { u := fmt.Sprintf("repos/%v/%v/autolinks", owner, repo) u, err := addOptions(u, opts) @@ -53,7 +55,9 @@ func (s *RepositoriesService) ListAutolinks(ctx context.Context, owner, repo str // AddAutolink creates an autolink reference for a repository. // Users with admin access to the repository can create an autolink. // -// GitHub API docs: https://docs.github.com/en/rest/repos/autolinks#create-an-autolink-reference-for-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/autolinks#create-an-autolink-reference-for-a-repository +// +//meta:operation POST /repos/{owner}/{repo}/autolinks func (s *RepositoriesService) AddAutolink(ctx context.Context, owner, repo string, opts *AutolinkOptions) (*Autolink, *Response, error) { u := fmt.Sprintf("repos/%v/%v/autolinks", owner, repo) req, err := s.client.NewRequest("POST", u, opts) @@ -72,7 +76,9 @@ func (s *RepositoriesService) AddAutolink(ctx context.Context, owner, repo strin // GetAutolink returns a single autolink reference by ID that was configured for the given repository. // Information about autolinks are only available to repository administrators. // -// GitHub API docs: https://docs.github.com/en/rest/repos/autolinks#get-an-autolink-reference-of-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/autolinks#get-an-autolink-reference-of-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/autolinks/{autolink_id} func (s *RepositoriesService) GetAutolink(ctx context.Context, owner, repo string, id int64) (*Autolink, *Response, error) { u := fmt.Sprintf("repos/%v/%v/autolinks/%v", owner, repo, id) @@ -93,7 +99,9 @@ func (s *RepositoriesService) GetAutolink(ctx context.Context, owner, repo strin // DeleteAutolink deletes a single autolink reference by ID that was configured for the given repository. // Information about autolinks are only available to repository administrators. // -// GitHub API docs: https://docs.github.com/en/rest/repos/autolinks#delete-an-autolink-reference-from-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/autolinks#delete-an-autolink-reference-from-a-repository +// +//meta:operation DELETE /repos/{owner}/{repo}/autolinks/{autolink_id} func (s *RepositoriesService) DeleteAutolink(ctx context.Context, owner, repo string, id int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/autolinks/%v", owner, repo, id) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/repos_codeowners.go b/github/repos_codeowners.go index 1c3f78abd9b..93eeae09b17 100644 --- a/github/repos_codeowners.go +++ b/github/repos_codeowners.go @@ -36,7 +36,9 @@ type CodeownersError struct { // GetCodeownersErrors lists any syntax errors that are detected in the CODEOWNERS file. // -// GitHub API docs: https://docs.github.com/en/rest/repos/repos#list-codeowners-errors +// GitHub API docs: https://docs.github.com/rest/repos/repos#list-codeowners-errors +// +//meta:operation GET /repos/{owner}/{repo}/codeowners/errors func (s *RepositoriesService) GetCodeownersErrors(ctx context.Context, owner, repo string, opts *GetCodeownersErrorsOptions) (*CodeownersErrors, *Response, error) { u := fmt.Sprintf("repos/%v/%v/codeowners/errors", owner, repo) u, err := addOptions(u, opts) diff --git a/github/repos_collaborators.go b/github/repos_collaborators.go index c2396872f2e..15a4e77a2f1 100644 --- a/github/repos_collaborators.go +++ b/github/repos_collaborators.go @@ -34,7 +34,7 @@ type ListCollaboratorsOptions struct { } // CollaboratorInvitation represents an invitation created when adding a collaborator. -// GitHub API docs: https://docs.github.com/en/rest/repos/collaborators/#response-when-a-new-invitation-is-created +// GitHub API docs: https://docs.github.com/rest/repos/collaborators/#response-when-a-new-invitation-is-created type CollaboratorInvitation struct { ID *int64 `json:"id,omitempty"` Repo *Repository `json:"repository,omitempty"` @@ -48,7 +48,9 @@ type CollaboratorInvitation struct { // ListCollaborators lists the GitHub users that have access to the repository. // -// GitHub API docs: https://docs.github.com/en/rest/collaborators/collaborators#list-repository-collaborators +// GitHub API docs: https://docs.github.com/rest/collaborators/collaborators#list-repository-collaborators +// +//meta:operation GET /repos/{owner}/{repo}/collaborators func (s *RepositoriesService) ListCollaborators(ctx context.Context, owner, repo string, opts *ListCollaboratorsOptions) ([]*User, *Response, error) { u := fmt.Sprintf("repos/%v/%v/collaborators", owner, repo) u, err := addOptions(u, opts) @@ -75,7 +77,9 @@ func (s *RepositoriesService) ListCollaborators(ctx context.Context, owner, repo // Note: This will return false if the user is not a collaborator OR the user // is not a GitHub user. // -// GitHub API docs: https://docs.github.com/en/rest/collaborators/collaborators#check-if-a-user-is-a-repository-collaborator +// GitHub API docs: https://docs.github.com/rest/collaborators/collaborators#check-if-a-user-is-a-repository-collaborator +// +//meta:operation GET /repos/{owner}/{repo}/collaborators/{username} func (s *RepositoriesService) IsCollaborator(ctx context.Context, owner, repo, user string) (bool, *Response, error) { u := fmt.Sprintf("repos/%v/%v/collaborators/%v", owner, repo, user) req, err := s.client.NewRequest("GET", u, nil) @@ -99,7 +103,9 @@ type RepositoryPermissionLevel struct { // GetPermissionLevel retrieves the specific permission level a collaborator has for a given repository. // -// GitHub API docs: https://docs.github.com/en/rest/collaborators/collaborators#get-repository-permissions-for-a-user +// GitHub API docs: https://docs.github.com/rest/collaborators/collaborators#get-repository-permissions-for-a-user +// +//meta:operation GET /repos/{owner}/{repo}/collaborators/{username}/permission func (s *RepositoriesService) GetPermissionLevel(ctx context.Context, owner, repo, user string) (*RepositoryPermissionLevel, *Response, error) { u := fmt.Sprintf("repos/%v/%v/collaborators/%v/permission", owner, repo, user) req, err := s.client.NewRequest("GET", u, nil) @@ -134,7 +140,9 @@ type RepositoryAddCollaboratorOptions struct { // AddCollaborator sends an invitation to the specified GitHub user // to become a collaborator to the given repo. // -// GitHub API docs: https://docs.github.com/en/rest/collaborators/collaborators#add-a-repository-collaborator +// GitHub API docs: https://docs.github.com/rest/collaborators/collaborators#add-a-repository-collaborator +// +//meta:operation PUT /repos/{owner}/{repo}/collaborators/{username} func (s *RepositoriesService) AddCollaborator(ctx context.Context, owner, repo, user string, opts *RepositoryAddCollaboratorOptions) (*CollaboratorInvitation, *Response, error) { u := fmt.Sprintf("repos/%v/%v/collaborators/%v", owner, repo, user) req, err := s.client.NewRequest("PUT", u, opts) @@ -154,7 +162,9 @@ func (s *RepositoriesService) AddCollaborator(ctx context.Context, owner, repo, // RemoveCollaborator removes the specified GitHub user as collaborator from the given repo. // Note: Does not return error if a valid user that is not a collaborator is removed. // -// GitHub API docs: https://docs.github.com/en/rest/collaborators/collaborators#remove-a-repository-collaborator +// GitHub API docs: https://docs.github.com/rest/collaborators/collaborators#remove-a-repository-collaborator +// +//meta:operation DELETE /repos/{owner}/{repo}/collaborators/{username} func (s *RepositoriesService) RemoveCollaborator(ctx context.Context, owner, repo, user string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/collaborators/%v", owner, repo, user) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/repos_comments.go b/github/repos_comments.go index e282374e9e5..766a614cc12 100644 --- a/github/repos_comments.go +++ b/github/repos_comments.go @@ -35,7 +35,9 @@ func (r RepositoryComment) String() string { // ListComments lists all the comments for the repository. // -// GitHub API docs: https://docs.github.com/en/rest/commits/comments#list-commit-comments-for-a-repository +// GitHub API docs: https://docs.github.com/rest/commits/comments#list-commit-comments-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/comments func (s *RepositoriesService) ListComments(ctx context.Context, owner, repo string, opts *ListOptions) ([]*RepositoryComment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/comments", owner, repo) u, err := addOptions(u, opts) @@ -62,7 +64,9 @@ func (s *RepositoriesService) ListComments(ctx context.Context, owner, repo stri // ListCommitComments lists all the comments for a given commit SHA. // -// GitHub API docs: https://docs.github.com/en/rest/commits/comments#list-commit-comments +// GitHub API docs: https://docs.github.com/rest/commits/comments#list-commit-comments +// +//meta:operation GET /repos/{owner}/{repo}/commits/{commit_sha}/comments func (s *RepositoriesService) ListCommitComments(ctx context.Context, owner, repo, sha string, opts *ListOptions) ([]*RepositoryComment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/commits/%v/comments", owner, repo, sha) u, err := addOptions(u, opts) @@ -90,7 +94,9 @@ func (s *RepositoriesService) ListCommitComments(ctx context.Context, owner, rep // CreateComment creates a comment for the given commit. // Note: GitHub allows for comments to be created for non-existing files and positions. // -// GitHub API docs: https://docs.github.com/en/rest/commits/comments#create-a-commit-comment +// GitHub API docs: https://docs.github.com/rest/commits/comments#create-a-commit-comment +// +//meta:operation POST /repos/{owner}/{repo}/commits/{commit_sha}/comments func (s *RepositoriesService) CreateComment(ctx context.Context, owner, repo, sha string, comment *RepositoryComment) (*RepositoryComment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/commits/%v/comments", owner, repo, sha) req, err := s.client.NewRequest("POST", u, comment) @@ -109,7 +115,9 @@ func (s *RepositoriesService) CreateComment(ctx context.Context, owner, repo, sh // GetComment gets a single comment from a repository. // -// GitHub API docs: https://docs.github.com/en/rest/commits/comments#get-a-commit-comment +// GitHub API docs: https://docs.github.com/rest/commits/comments#get-a-commit-comment +// +//meta:operation GET /repos/{owner}/{repo}/comments/{comment_id} func (s *RepositoriesService) GetComment(ctx context.Context, owner, repo string, id int64) (*RepositoryComment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/comments/%v", owner, repo, id) req, err := s.client.NewRequest("GET", u, nil) @@ -131,7 +139,9 @@ func (s *RepositoriesService) GetComment(ctx context.Context, owner, repo string // UpdateComment updates the body of a single comment. // -// GitHub API docs: https://docs.github.com/en/rest/commits/comments#update-a-commit-comment +// GitHub API docs: https://docs.github.com/rest/commits/comments#update-a-commit-comment +// +//meta:operation PATCH /repos/{owner}/{repo}/comments/{comment_id} func (s *RepositoriesService) UpdateComment(ctx context.Context, owner, repo string, id int64, comment *RepositoryComment) (*RepositoryComment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/comments/%v", owner, repo, id) req, err := s.client.NewRequest("PATCH", u, comment) @@ -150,7 +160,9 @@ func (s *RepositoriesService) UpdateComment(ctx context.Context, owner, repo str // DeleteComment deletes a single comment from a repository. // -// GitHub API docs: https://docs.github.com/en/rest/commits/comments#delete-a-commit-comment +// GitHub API docs: https://docs.github.com/rest/commits/comments#delete-a-commit-comment +// +//meta:operation DELETE /repos/{owner}/{repo}/comments/{comment_id} func (s *RepositoriesService) DeleteComment(ctx context.Context, owner, repo string, id int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/comments/%v", owner, repo, id) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/repos_commits.go b/github/repos_commits.go index d1fb577c61c..cca7430cb51 100644 --- a/github/repos_commits.go +++ b/github/repos_commits.go @@ -124,7 +124,9 @@ type BranchCommit struct { // ListCommits lists the commits of a repository. // -// GitHub API docs: https://docs.github.com/en/rest/commits/commits#list-commits +// GitHub API docs: https://docs.github.com/rest/commits/commits#list-commits +// +//meta:operation GET /repos/{owner}/{repo}/commits func (s *RepositoriesService) ListCommits(ctx context.Context, owner, repo string, opts *CommitsListOptions) ([]*RepositoryCommit, *Response, error) { u := fmt.Sprintf("repos/%v/%v/commits", owner, repo) u, err := addOptions(u, opts) @@ -148,8 +150,9 @@ func (s *RepositoriesService) ListCommits(ctx context.Context, owner, repo strin // GetCommit fetches the specified commit, including all details about it. // -// GitHub API docs: https://docs.github.com/en/rest/commits/commits#get-a-single-commit -// GitHub API docs: https://docs.github.com/en/rest/commits/commits#get-a-commit +// GitHub API docs: https://docs.github.com/rest/commits/commits#get-a-commit +// +//meta:operation GET /repos/{owner}/{repo}/commits/{ref} func (s *RepositoriesService) GetCommit(ctx context.Context, owner, repo, sha string, opts *ListOptions) (*RepositoryCommit, *Response, error) { u := fmt.Sprintf("repos/%v/%v/commits/%v", owner, repo, sha) u, err := addOptions(u, opts) @@ -173,7 +176,9 @@ func (s *RepositoriesService) GetCommit(ctx context.Context, owner, repo, sha st // GetCommitRaw fetches the specified commit in raw (diff or patch) format. // -// GitHub API docs: https://docs.github.com/en/rest/commits/commits#get-a-commit +// GitHub API docs: https://docs.github.com/rest/commits/commits#get-a-commit +// +//meta:operation GET /repos/{owner}/{repo}/commits/{ref} func (s *RepositoriesService) GetCommitRaw(ctx context.Context, owner string, repo string, sha string, opts RawOptions) (string, *Response, error) { u := fmt.Sprintf("repos/%v/%v/commits/%v", owner, repo, sha) req, err := s.client.NewRequest("GET", u, nil) @@ -202,7 +207,9 @@ func (s *RepositoriesService) GetCommitRaw(ctx context.Context, owner string, re // GetCommitSHA1 gets the SHA-1 of a commit reference. If a last-known SHA1 is // supplied and no new commits have occurred, a 304 Unmodified response is returned. // -// GitHub API docs: https://docs.github.com/en/rest/commits/commits#get-a-commit +// GitHub API docs: https://docs.github.com/rest/commits/commits#get-a-commit +// +//meta:operation GET /repos/{owner}/{repo}/commits/{ref} func (s *RepositoriesService) GetCommitSHA1(ctx context.Context, owner, repo, ref, lastSHA string) (string, *Response, error) { u := fmt.Sprintf("repos/%v/%v/commits/%v", owner, repo, refURLEscape(ref)) @@ -227,7 +234,9 @@ func (s *RepositoriesService) GetCommitSHA1(ctx context.Context, owner, repo, re // CompareCommits compares a range of commits with each other. // -// GitHub API docs: https://docs.github.com/en/rest/commits/commits#compare-two-commits +// GitHub API docs: https://docs.github.com/rest/commits/commits#compare-two-commits +// +//meta:operation GET /repos/{owner}/{repo}/compare/{basehead} func (s *RepositoriesService) CompareCommits(ctx context.Context, owner, repo string, base, head string, opts *ListOptions) (*CommitsComparison, *Response, error) { escapedBase := url.QueryEscape(base) escapedHead := url.QueryEscape(head) @@ -258,7 +267,9 @@ func (s *RepositoriesService) CompareCommits(ctx context.Context, owner, repo st // To compare branches across other repositories in the same network as "repo", // use the format ":branch". // -// GitHub API docs: https://docs.github.com/en/rest/commits/commits#compare-two-commits +// GitHub API docs: https://docs.github.com/rest/commits/commits#compare-two-commits +// +//meta:operation GET /repos/{owner}/{repo}/compare/{basehead} func (s *RepositoriesService) CompareCommitsRaw(ctx context.Context, owner, repo, base, head string, opts RawOptions) (string, *Response, error) { escapedBase := url.QueryEscape(base) escapedHead := url.QueryEscape(head) @@ -291,7 +302,9 @@ func (s *RepositoriesService) CompareCommitsRaw(ctx context.Context, owner, repo // ListBranchesHeadCommit gets all branches where the given commit SHA is the HEAD, // or latest commit for the branch. // -// GitHub API docs: https://docs.github.com/en/rest/commits/commits#list-branches-for-head-commit +// GitHub API docs: https://docs.github.com/rest/commits/commits#list-branches-for-head-commit +// +//meta:operation GET /repos/{owner}/{repo}/commits/{commit_sha}/branches-where-head func (s *RepositoriesService) ListBranchesHeadCommit(ctx context.Context, owner, repo, sha string) ([]*BranchCommit, *Response, error) { u := fmt.Sprintf("repos/%v/%v/commits/%v/branches-where-head", owner, repo, sha) diff --git a/github/repos_community_health.go b/github/repos_community_health.go index 750ee158270..54d1b414ec9 100644 --- a/github/repos_community_health.go +++ b/github/repos_community_health.go @@ -43,7 +43,9 @@ type CommunityHealthMetrics struct { // GetCommunityHealthMetrics retrieves all the community health metrics for a repository. // -// GitHub API docs: https://docs.github.com/en/rest/metrics/community#get-community-profile-metrics +// GitHub API docs: https://docs.github.com/rest/metrics/community#get-community-profile-metrics +// +//meta:operation GET /repos/{owner}/{repo}/community/profile func (s *RepositoriesService) GetCommunityHealthMetrics(ctx context.Context, owner, repo string) (*CommunityHealthMetrics, *Response, error) { u := fmt.Sprintf("repos/%v/%v/community/profile", owner, repo) req, err := s.client.NewRequest("GET", u, nil) diff --git a/github/repos_contents.go b/github/repos_contents.go index cfb4a6da22f..9539a5c4296 100644 --- a/github/repos_contents.go +++ b/github/repos_contents.go @@ -4,7 +4,7 @@ // license that can be found in the LICENSE file. // Repository contents API methods. -// GitHub API docs: https://docs.github.com/en/rest/repos/contents/ +// GitHub API docs: https://docs.github.com/rest/repos/contents/ package github @@ -100,7 +100,9 @@ func (r *RepositoryContent) GetContent() (string, error) { // GetReadme gets the Readme file for the repository. // -// GitHub API docs: https://docs.github.com/en/rest/repos/contents#get-a-repository-readme +// GitHub API docs: https://docs.github.com/rest/repos/contents#get-a-repository-readme +// +//meta:operation GET /repos/{owner}/{repo}/readme func (s *RepositoriesService) GetReadme(ctx context.Context, owner, repo string, opts *RepositoryContentGetOptions) (*RepositoryContent, *Response, error) { u := fmt.Sprintf("repos/%v/%v/readme", owner, repo) u, err := addOptions(u, opts) @@ -130,6 +132,10 @@ func (s *RepositoriesService) GetReadme(ctx context.Context, owner, repo string, // It is possible for the download to result in a failed response when the // returned error is nil. Callers should check the returned Response status // code to verify the content is from a successful response. +// +// GitHub API docs: https://docs.github.com/rest/repos/contents#get-repository-content +// +//meta:operation GET /repos/{owner}/{repo}/contents/{path} func (s *RepositoriesService) DownloadContents(ctx context.Context, owner, repo, filepath string, opts *RepositoryContentGetOptions) (io.ReadCloser, *Response, error) { dir := path.Dir(filepath) filename := path.Base(filepath) @@ -164,6 +170,10 @@ func (s *RepositoriesService) DownloadContents(ctx context.Context, owner, repo, // It is possible for the download to result in a failed response when the // returned error is nil. Callers should check the returned Response status // code to verify the content is from a successful response. +// +// GitHub API docs: https://docs.github.com/rest/repos/contents#get-repository-content +// +//meta:operation GET /repos/{owner}/{repo}/contents/{path} func (s *RepositoriesService) DownloadContentsWithMeta(ctx context.Context, owner, repo, filepath string, opts *RepositoryContentGetOptions) (io.ReadCloser, *RepositoryContent, *Response, error) { dir := path.Dir(filepath) filename := path.Base(filepath) @@ -200,7 +210,9 @@ func (s *RepositoriesService) DownloadContentsWithMeta(ctx context.Context, owne // Due to an auth vulnerability issue in the GitHub v3 API, ".." is not allowed // to appear anywhere in the "path" or this method will return an error. // -// GitHub API docs: https://docs.github.com/en/rest/repos/contents#get-repository-content +// GitHub API docs: https://docs.github.com/rest/repos/contents#get-repository-content +// +//meta:operation GET /repos/{owner}/{repo}/contents/{path} func (s *RepositoriesService) GetContents(ctx context.Context, owner, repo, path string, opts *RepositoryContentGetOptions) (fileContent *RepositoryContent, directoryContent []*RepositoryContent, resp *Response, err error) { if strings.Contains(path, "..") { return nil, nil, nil, ErrPathForbidden @@ -240,7 +252,9 @@ func (s *RepositoriesService) GetContents(ctx context.Context, owner, repo, path // CreateFile creates a new file in a repository at the given path and returns // the commit and file metadata. // -// GitHub API docs: https://docs.github.com/en/rest/repos/contents#create-or-update-file-contents +// GitHub API docs: https://docs.github.com/rest/repos/contents#create-or-update-file-contents +// +//meta:operation PUT /repos/{owner}/{repo}/contents/{path} func (s *RepositoriesService) CreateFile(ctx context.Context, owner, repo, path string, opts *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error) { u := fmt.Sprintf("repos/%s/%s/contents/%s", owner, repo, path) req, err := s.client.NewRequest("PUT", u, opts) @@ -260,7 +274,9 @@ func (s *RepositoriesService) CreateFile(ctx context.Context, owner, repo, path // UpdateFile updates a file in a repository at the given path and returns the // commit and file metadata. Requires the blob SHA of the file being updated. // -// GitHub API docs: https://docs.github.com/en/rest/repos/contents#create-or-update-file-contents +// GitHub API docs: https://docs.github.com/rest/repos/contents#create-or-update-file-contents +// +//meta:operation PUT /repos/{owner}/{repo}/contents/{path} func (s *RepositoriesService) UpdateFile(ctx context.Context, owner, repo, path string, opts *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error) { u := fmt.Sprintf("repos/%s/%s/contents/%s", owner, repo, path) req, err := s.client.NewRequest("PUT", u, opts) @@ -280,7 +296,9 @@ func (s *RepositoriesService) UpdateFile(ctx context.Context, owner, repo, path // DeleteFile deletes a file from a repository and returns the commit. // Requires the blob SHA of the file to be deleted. // -// GitHub API docs: https://docs.github.com/en/rest/repos/contents#delete-a-file +// GitHub API docs: https://docs.github.com/rest/repos/contents#delete-a-file +// +//meta:operation DELETE /repos/{owner}/{repo}/contents/{path} func (s *RepositoriesService) DeleteFile(ctx context.Context, owner, repo, path string, opts *RepositoryContentFileOptions) (*RepositoryContentResponse, *Response, error) { u := fmt.Sprintf("repos/%s/%s/contents/%s", owner, repo, path) req, err := s.client.NewRequest("DELETE", u, opts) @@ -312,7 +330,11 @@ const ( // repository. The archiveFormat can be specified by either the github.Tarball // or github.Zipball constant. // -// GitHub API docs: https://docs.github.com/en/rest/repos/contents/#get-archive-link +// GitHub API docs: https://docs.github.com/rest/repos/contents#download-a-repository-archive-tar +// GitHub API docs: https://docs.github.com/rest/repos/contents#download-a-repository-archive-zip +// +//meta:operation GET /repos/{owner}/{repo}/tarball/{ref} +//meta:operation GET /repos/{owner}/{repo}/zipball/{ref} func (s *RepositoriesService) GetArchiveLink(ctx context.Context, owner, repo string, archiveformat ArchiveFormat, opts *RepositoryContentGetOptions, maxRedirects int) (*url.URL, *Response, error) { u := fmt.Sprintf("repos/%s/%s/%s", owner, repo, archiveformat) if opts != nil && opts.Ref != "" { diff --git a/github/repos_deployment_branch_policies.go b/github/repos_deployment_branch_policies.go index 32bf72ccab5..77ac73e44e1 100644 --- a/github/repos_deployment_branch_policies.go +++ b/github/repos_deployment_branch_policies.go @@ -32,7 +32,9 @@ type DeploymentBranchPolicyRequest struct { // ListDeploymentBranchPolicies lists the deployment branch policies for an environment. // -// GitHub API docs: https://docs.github.com/en/rest/deployments/branch-policies#list-deployment-branch-policies +// GitHub API docs: https://docs.github.com/rest/deployments/branch-policies#list-deployment-branch-policies +// +//meta:operation GET /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies func (s *RepositoriesService) ListDeploymentBranchPolicies(ctx context.Context, owner, repo, environment string) (*DeploymentBranchPolicyResponse, *Response, error) { u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment-branch-policies", owner, repo, environment) @@ -52,7 +54,9 @@ func (s *RepositoriesService) ListDeploymentBranchPolicies(ctx context.Context, // GetDeploymentBranchPolicy gets a deployment branch policy for an environment. // -// GitHub API docs: https://docs.github.com/en/rest/deployments/branch-policies#get-a-deployment-branch-policy +// GitHub API docs: https://docs.github.com/rest/deployments/branch-policies#get-a-deployment-branch-policy +// +//meta:operation GET /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id} func (s *RepositoriesService) GetDeploymentBranchPolicy(ctx context.Context, owner, repo, environment string, branchPolicyID int64) (*DeploymentBranchPolicy, *Response, error) { u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment-branch-policies/%v", owner, repo, environment, branchPolicyID) @@ -72,7 +76,9 @@ func (s *RepositoriesService) GetDeploymentBranchPolicy(ctx context.Context, own // CreateDeploymentBranchPolicy creates a deployment branch policy for an environment. // -// GitHub API docs: https://docs.github.com/en/rest/deployments/branch-policies#create-a-deployment-branch-policy +// GitHub API docs: https://docs.github.com/rest/deployments/branch-policies#create-a-deployment-branch-policy +// +//meta:operation POST /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies func (s *RepositoriesService) CreateDeploymentBranchPolicy(ctx context.Context, owner, repo, environment string, request *DeploymentBranchPolicyRequest) (*DeploymentBranchPolicy, *Response, error) { u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment-branch-policies", owner, repo, environment) @@ -92,7 +98,9 @@ func (s *RepositoriesService) CreateDeploymentBranchPolicy(ctx context.Context, // UpdateDeploymentBranchPolicy updates a deployment branch policy for an environment. // -// GitHub API docs: https://docs.github.com/en/rest/deployments/branch-policies#update-a-deployment-branch-policy +// GitHub API docs: https://docs.github.com/rest/deployments/branch-policies#update-a-deployment-branch-policy +// +//meta:operation PUT /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id} func (s *RepositoriesService) UpdateDeploymentBranchPolicy(ctx context.Context, owner, repo, environment string, branchPolicyID int64, request *DeploymentBranchPolicyRequest) (*DeploymentBranchPolicy, *Response, error) { u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment-branch-policies/%v", owner, repo, environment, branchPolicyID) @@ -112,7 +120,9 @@ func (s *RepositoriesService) UpdateDeploymentBranchPolicy(ctx context.Context, // DeleteDeploymentBranchPolicy deletes a deployment branch policy for an environment. // -// GitHub API docs: https://docs.github.com/en/rest/deployments/branch-policies#delete-a-deployment-branch-policy +// GitHub API docs: https://docs.github.com/rest/deployments/branch-policies#delete-a-deployment-branch-policy +// +//meta:operation DELETE /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id} func (s *RepositoriesService) DeleteDeploymentBranchPolicy(ctx context.Context, owner, repo, environment string, branchPolicyID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment-branch-policies/%v", owner, repo, environment, branchPolicyID) diff --git a/github/repos_deployments.go b/github/repos_deployments.go index 36445f895e2..d8c0b63218e 100644 --- a/github/repos_deployments.go +++ b/github/repos_deployments.go @@ -63,7 +63,9 @@ type DeploymentsListOptions struct { // ListDeployments lists the deployments of a repository. // -// GitHub API docs: https://docs.github.com/en/rest/deployments/deployments#list-deployments +// GitHub API docs: https://docs.github.com/rest/deployments/deployments#list-deployments +// +//meta:operation GET /repos/{owner}/{repo}/deployments func (s *RepositoriesService) ListDeployments(ctx context.Context, owner, repo string, opts *DeploymentsListOptions) ([]*Deployment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/deployments", owner, repo) u, err := addOptions(u, opts) @@ -87,7 +89,9 @@ func (s *RepositoriesService) ListDeployments(ctx context.Context, owner, repo s // GetDeployment returns a single deployment of a repository. // -// GitHub API docs: https://docs.github.com/en/rest/deployments/deployments#get-a-deployment +// GitHub API docs: https://docs.github.com/rest/deployments/deployments#get-a-deployment +// +//meta:operation GET /repos/{owner}/{repo}/deployments/{deployment_id} func (s *RepositoriesService) GetDeployment(ctx context.Context, owner, repo string, deploymentID int64) (*Deployment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/deployments/%v", owner, repo, deploymentID) @@ -107,7 +111,9 @@ func (s *RepositoriesService) GetDeployment(ctx context.Context, owner, repo str // CreateDeployment creates a new deployment for a repository. // -// GitHub API docs: https://docs.github.com/en/rest/deployments/deployments#create-a-deployment +// GitHub API docs: https://docs.github.com/rest/deployments/deployments#create-a-deployment +// +//meta:operation POST /repos/{owner}/{repo}/deployments func (s *RepositoriesService) CreateDeployment(ctx context.Context, owner, repo string, request *DeploymentRequest) (*Deployment, *Response, error) { u := fmt.Sprintf("repos/%v/%v/deployments", owner, repo) @@ -131,7 +137,9 @@ func (s *RepositoriesService) CreateDeployment(ctx context.Context, owner, repo // DeleteDeployment deletes an existing deployment for a repository. // -// GitHub API docs: https://docs.github.com/en/rest/deployments/deployments#delete-a-deployment +// GitHub API docs: https://docs.github.com/rest/deployments/deployments#delete-a-deployment +// +//meta:operation DELETE /repos/{owner}/{repo}/deployments/{deployment_id} func (s *RepositoriesService) DeleteDeployment(ctx context.Context, owner, repo string, deploymentID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/deployments/%v", owner, repo, deploymentID) req, err := s.client.NewRequest("DELETE", u, nil) @@ -175,7 +183,9 @@ type DeploymentStatusRequest struct { // ListDeploymentStatuses lists the statuses of a given deployment of a repository. // -// GitHub API docs: https://docs.github.com/en/rest/deployments/statuses#list-deployment-statuses +// GitHub API docs: https://docs.github.com/rest/deployments/statuses#list-deployment-statuses +// +//meta:operation GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses func (s *RepositoriesService) ListDeploymentStatuses(ctx context.Context, owner, repo string, deployment int64, opts *ListOptions) ([]*DeploymentStatus, *Response, error) { u := fmt.Sprintf("repos/%v/%v/deployments/%v/statuses", owner, repo, deployment) u, err := addOptions(u, opts) @@ -203,7 +213,9 @@ func (s *RepositoriesService) ListDeploymentStatuses(ctx context.Context, owner, // GetDeploymentStatus returns a single deployment status of a repository. // -// GitHub API docs: https://docs.github.com/en/rest/deployments/statuses#get-a-deployment-status +// GitHub API docs: https://docs.github.com/rest/deployments/statuses#get-a-deployment-status +// +//meta:operation GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses/{status_id} func (s *RepositoriesService) GetDeploymentStatus(ctx context.Context, owner, repo string, deploymentID, deploymentStatusID int64) (*DeploymentStatus, *Response, error) { u := fmt.Sprintf("repos/%v/%v/deployments/%v/statuses/%v", owner, repo, deploymentID, deploymentStatusID) @@ -227,7 +239,9 @@ func (s *RepositoriesService) GetDeploymentStatus(ctx context.Context, owner, re // CreateDeploymentStatus creates a new status for a deployment. // -// GitHub API docs: https://docs.github.com/en/rest/deployments/statuses#create-a-deployment-status +// GitHub API docs: https://docs.github.com/rest/deployments/statuses#create-a-deployment-status +// +//meta:operation POST /repos/{owner}/{repo}/deployments/{deployment_id}/statuses func (s *RepositoriesService) CreateDeploymentStatus(ctx context.Context, owner, repo string, deployment int64, request *DeploymentStatusRequest) (*DeploymentStatus, *Response, error) { u := fmt.Sprintf("repos/%v/%v/deployments/%v/statuses", owner, repo, deployment) diff --git a/github/repos_environments.go b/github/repos_environments.go index e22ca5cd1be..ed81e3a1f95 100644 --- a/github/repos_environments.go +++ b/github/repos_environments.go @@ -107,7 +107,9 @@ func (r *RequiredReviewer) UnmarshalJSON(data []byte) error { // ListEnvironments lists all environments for a repository. // -// GitHub API docs: https://docs.github.com/en/rest/deployments/environments#get-all-environments +// GitHub API docs: https://docs.github.com/rest/deployments/environments#list-environments +// +//meta:operation GET /repos/{owner}/{repo}/environments func (s *RepositoriesService) ListEnvironments(ctx context.Context, owner, repo string, opts *EnvironmentListOptions) (*EnvResponse, *Response, error) { u := fmt.Sprintf("repos/%s/%s/environments", owner, repo) u, err := addOptions(u, opts) @@ -130,7 +132,9 @@ func (s *RepositoriesService) ListEnvironments(ctx context.Context, owner, repo // GetEnvironment get a single environment for a repository. // -// GitHub API docs: https://docs.github.com/en/rest/deployments/environments#get-an-environment +// GitHub API docs: https://docs.github.com/rest/deployments/environments#get-an-environment +// +//meta:operation GET /repos/{owner}/{repo}/environments/{environment_name} func (s *RepositoriesService) GetEnvironment(ctx context.Context, owner, repo, name string) (*Environment, *Response, error) { u := fmt.Sprintf("repos/%s/%s/environments/%s", owner, repo, name) @@ -178,7 +182,7 @@ type CreateUpdateEnvironment struct { } // createUpdateEnvironmentNoEnterprise represents the fields accepted for Pro/Teams private repos. -// Ref: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment +// Ref: https://docs.github.com/actions/deployment/targeting-different-environments/using-environments-for-deployment // See https://github.com/google/go-github/issues/2602 for more information. type createUpdateEnvironmentNoEnterprise struct { DeploymentBranchPolicy *BranchPolicy `json:"deployment_branch_policy"` @@ -186,7 +190,9 @@ type createUpdateEnvironmentNoEnterprise struct { // CreateUpdateEnvironment create or update a new environment for a repository. // -// GitHub API docs: https://docs.github.com/en/rest/deployments/environments#create-or-update-an-environment +// GitHub API docs: https://docs.github.com/rest/deployments/environments#create-or-update-an-environment +// +//meta:operation PUT /repos/{owner}/{repo}/environments/{environment_name} func (s *RepositoriesService) CreateUpdateEnvironment(ctx context.Context, owner, repo, name string, environment *CreateUpdateEnvironment) (*Environment, *Response, error) { u := fmt.Sprintf("repos/%s/%s/environments/%s", owner, repo, name) @@ -232,7 +238,9 @@ func (s *RepositoriesService) createNewEnvNoEnterprise(ctx context.Context, u st // DeleteEnvironment delete an environment from a repository. // -// GitHub API docs: https://docs.github.com/en/rest/deployments/environments#delete-an-environment +// GitHub API docs: https://docs.github.com/rest/deployments/environments#delete-an-environment +// +//meta:operation DELETE /repos/{owner}/{repo}/environments/{environment_name} func (s *RepositoriesService) DeleteEnvironment(ctx context.Context, owner, repo, name string) (*Response, error) { u := fmt.Sprintf("repos/%s/%s/environments/%s", owner, repo, name) diff --git a/github/repos_forks.go b/github/repos_forks.go index f175dfe3b03..60fb49da5ab 100644 --- a/github/repos_forks.go +++ b/github/repos_forks.go @@ -23,7 +23,9 @@ type RepositoryListForksOptions struct { // ListForks lists the forks of the specified repository. // -// GitHub API docs: https://docs.github.com/en/rest/repos/forks#list-forks +// GitHub API docs: https://docs.github.com/rest/repos/forks#list-forks +// +//meta:operation GET /repos/{owner}/{repo}/forks func (s *RepositoriesService) ListForks(ctx context.Context, owner, repo string, opts *RepositoryListForksOptions) ([]*Repository, *Response, error) { u := fmt.Sprintf("repos/%v/%v/forks", owner, repo) u, err := addOptions(u, opts) @@ -66,7 +68,9 @@ type RepositoryCreateForkOptions struct { // A follow up request, after a delay of a second or so, should result // in a successful request. // -// GitHub API docs: https://docs.github.com/en/rest/repos/forks#create-a-fork +// GitHub API docs: https://docs.github.com/rest/repos/forks#create-a-fork +// +//meta:operation POST /repos/{owner}/{repo}/forks func (s *RepositoriesService) CreateFork(ctx context.Context, owner, repo string, opts *RepositoryCreateForkOptions) (*Repository, *Response, error) { u := fmt.Sprintf("repos/%v/%v/forks", owner, repo) diff --git a/github/repos_hooks.go b/github/repos_hooks.go index ba229e7bca8..8768d603d2b 100644 --- a/github/repos_hooks.go +++ b/github/repos_hooks.go @@ -79,7 +79,9 @@ type createHookRequest struct { // Note that only a subset of the hook fields are used and hook must // not be nil. // -// GitHub API docs: https://docs.github.com/en/rest/webhooks/repos#create-a-repository-webhook +// GitHub API docs: https://docs.github.com/rest/webhooks/repos#create-a-repository-webhook +// +//meta:operation POST /repos/{owner}/{repo}/hooks func (s *RepositoriesService) CreateHook(ctx context.Context, owner, repo string, hook *Hook) (*Hook, *Response, error) { u := fmt.Sprintf("repos/%v/%v/hooks", owner, repo) @@ -106,7 +108,9 @@ func (s *RepositoriesService) CreateHook(ctx context.Context, owner, repo string // ListHooks lists all Hooks for the specified repository. // -// GitHub API docs: https://docs.github.com/en/rest/webhooks/repos#list-repository-webhooks +// GitHub API docs: https://docs.github.com/rest/webhooks/repos#list-repository-webhooks +// +//meta:operation GET /repos/{owner}/{repo}/hooks func (s *RepositoriesService) ListHooks(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Hook, *Response, error) { u := fmt.Sprintf("repos/%v/%v/hooks", owner, repo) u, err := addOptions(u, opts) @@ -130,7 +134,9 @@ func (s *RepositoriesService) ListHooks(ctx context.Context, owner, repo string, // GetHook returns a single specified Hook. // -// GitHub API docs: https://docs.github.com/en/rest/webhooks/repos#get-a-repository-webhook +// GitHub API docs: https://docs.github.com/rest/webhooks/repos#get-a-repository-webhook +// +//meta:operation GET /repos/{owner}/{repo}/hooks/{hook_id} func (s *RepositoriesService) GetHook(ctx context.Context, owner, repo string, id int64) (*Hook, *Response, error) { u := fmt.Sprintf("repos/%v/%v/hooks/%d", owner, repo, id) req, err := s.client.NewRequest("GET", u, nil) @@ -148,7 +154,9 @@ func (s *RepositoriesService) GetHook(ctx context.Context, owner, repo string, i // EditHook updates a specified Hook. // -// GitHub API docs: https://docs.github.com/en/rest/webhooks/repos#update-a-repository-webhook +// GitHub API docs: https://docs.github.com/rest/webhooks/repos#update-a-repository-webhook +// +//meta:operation PATCH /repos/{owner}/{repo}/hooks/{hook_id} func (s *RepositoriesService) EditHook(ctx context.Context, owner, repo string, id int64, hook *Hook) (*Hook, *Response, error) { u := fmt.Sprintf("repos/%v/%v/hooks/%d", owner, repo, id) req, err := s.client.NewRequest("PATCH", u, hook) @@ -166,7 +174,9 @@ func (s *RepositoriesService) EditHook(ctx context.Context, owner, repo string, // DeleteHook deletes a specified Hook. // -// GitHub API docs: https://docs.github.com/en/rest/webhooks/repos#delete-a-repository-webhook +// GitHub API docs: https://docs.github.com/rest/webhooks/repos#delete-a-repository-webhook +// +//meta:operation DELETE /repos/{owner}/{repo}/hooks/{hook_id} func (s *RepositoriesService) DeleteHook(ctx context.Context, owner, repo string, id int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/hooks/%d", owner, repo, id) req, err := s.client.NewRequest("DELETE", u, nil) @@ -178,7 +188,9 @@ func (s *RepositoriesService) DeleteHook(ctx context.Context, owner, repo string // PingHook triggers a 'ping' event to be sent to the Hook. // -// GitHub API docs: https://docs.github.com/en/rest/webhooks/repos#ping-a-repository-webhook +// GitHub API docs: https://docs.github.com/rest/webhooks/repos#ping-a-repository-webhook +// +//meta:operation POST /repos/{owner}/{repo}/hooks/{hook_id}/pings func (s *RepositoriesService) PingHook(ctx context.Context, owner, repo string, id int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/hooks/%d/pings", owner, repo, id) req, err := s.client.NewRequest("POST", u, nil) @@ -190,7 +202,9 @@ func (s *RepositoriesService) PingHook(ctx context.Context, owner, repo string, // TestHook triggers a test Hook by github. // -// GitHub API docs: https://docs.github.com/en/rest/webhooks/repos#test-the-push-repository-webhook +// GitHub API docs: https://docs.github.com/rest/webhooks/repos#test-the-push-repository-webhook +// +//meta:operation POST /repos/{owner}/{repo}/hooks/{hook_id}/tests func (s *RepositoriesService) TestHook(ctx context.Context, owner, repo string, id int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/hooks/%d/tests", owner, repo, id) req, err := s.client.NewRequest("POST", u, nil) @@ -202,7 +216,9 @@ func (s *RepositoriesService) TestHook(ctx context.Context, owner, repo string, // Subscribe lets servers register to receive updates when a topic is updated. // -// GitHub API docs: https://docs.github.com/en/rest/webhooks#pubsubhubbub +// GitHub API docs: https://docs.github.com/webhooks/about-webhooks-for-repositories#pubsubhubbub +// +//meta:operation POST /hub func (s *RepositoriesService) Subscribe(ctx context.Context, owner, repo, event, callback string, secret []byte) (*Response, error) { req, err := s.createWebSubRequest("subscribe", owner, repo, event, callback, secret) if err != nil { @@ -214,7 +230,9 @@ func (s *RepositoriesService) Subscribe(ctx context.Context, owner, repo, event, // Unsubscribe lets servers unregister to no longer receive updates when a topic is updated. // -// GitHub API docs: https://docs.github.com/en/rest/webhooks#pubsubhubbub +// GitHub API docs: https://docs.github.com/webhooks/about-webhooks-for-repositories#pubsubhubbub +// +//meta:operation POST /hub func (s *RepositoriesService) Unsubscribe(ctx context.Context, owner, repo, event, callback string, secret []byte) (*Response, error) { req, err := s.createWebSubRequest("unsubscribe", owner, repo, event, callback, secret) if err != nil { diff --git a/github/repos_hooks_configuration.go b/github/repos_hooks_configuration.go index 5aadfb645e1..2203d7614f5 100644 --- a/github/repos_hooks_configuration.go +++ b/github/repos_hooks_configuration.go @@ -12,7 +12,9 @@ import ( // GetHookConfiguration returns the configuration for the specified repository webhook. // -// GitHub API docs: https://docs.github.com/en/rest/webhooks/repo-config?apiVersion=2022-11-28#get-a-webhook-configuration-for-a-repository +// GitHub API docs: https://docs.github.com/rest/webhooks/repo-config#get-a-webhook-configuration-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/hooks/{hook_id}/config func (s *RepositoriesService) GetHookConfiguration(ctx context.Context, owner, repo string, id int64) (*HookConfig, *Response, error) { u := fmt.Sprintf("repos/%v/%v/hooks/%v/config", owner, repo, id) req, err := s.client.NewRequest("GET", u, nil) @@ -31,7 +33,9 @@ func (s *RepositoriesService) GetHookConfiguration(ctx context.Context, owner, r // EditHookConfiguration updates the configuration for the specified repository webhook. // -// GitHub API docs: https://docs.github.com/en/rest/webhooks/repo-config?apiVersion=2022-11-28#update-a-webhook-configuration-for-a-repository +// GitHub API docs: https://docs.github.com/rest/webhooks/repo-config#update-a-webhook-configuration-for-a-repository +// +//meta:operation PATCH /repos/{owner}/{repo}/hooks/{hook_id}/config func (s *RepositoriesService) EditHookConfiguration(ctx context.Context, owner, repo string, id int64, config *HookConfig) (*HookConfig, *Response, error) { u := fmt.Sprintf("repos/%v/%v/hooks/%v/config", owner, repo, id) req, err := s.client.NewRequest("PATCH", u, config) diff --git a/github/repos_hooks_deliveries.go b/github/repos_hooks_deliveries.go index 5f2f8807e4b..6e1fd86f99b 100644 --- a/github/repos_hooks_deliveries.go +++ b/github/repos_hooks_deliveries.go @@ -14,8 +14,8 @@ import ( // HookDelivery represents the data that is received from GitHub's Webhook Delivery API // // GitHub API docs: -// - https://docs.github.com/en/rest/webhooks/repo-deliveries#list-deliveries-for-a-repository-webhook -// - https://docs.github.com/en/rest/webhooks/repo-deliveries#get-a-delivery-for-a-repository-webhook +// - https://docs.github.com/rest/webhooks/repo-deliveries#list-deliveries-for-a-repository-webhook +// - https://docs.github.com/rest/webhooks/repo-deliveries#get-a-delivery-for-a-repository-webhook type HookDelivery struct { ID *int64 `json:"id,omitempty"` GUID *string `json:"guid,omitempty"` @@ -63,7 +63,9 @@ func (r HookResponse) String() string { // ListHookDeliveries lists webhook deliveries for a webhook configured in a repository. // -// GitHub API docs: https://docs.github.com/en/rest/webhooks/repo-deliveries#list-deliveries-for-a-repository-webhook +// GitHub API docs: https://docs.github.com/rest/webhooks/repo-deliveries#list-deliveries-for-a-repository-webhook +// +//meta:operation GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries func (s *RepositoriesService) ListHookDeliveries(ctx context.Context, owner, repo string, id int64, opts *ListCursorOptions) ([]*HookDelivery, *Response, error) { u := fmt.Sprintf("repos/%v/%v/hooks/%v/deliveries", owner, repo, id) u, err := addOptions(u, opts) @@ -87,7 +89,9 @@ func (s *RepositoriesService) ListHookDeliveries(ctx context.Context, owner, rep // GetHookDelivery returns a delivery for a webhook configured in a repository. // -// GitHub API docs: https://docs.github.com/en/rest/webhooks/repo-deliveries#get-a-delivery-for-a-repository-webhook +// GitHub API docs: https://docs.github.com/rest/webhooks/repo-deliveries#get-a-delivery-for-a-repository-webhook +// +//meta:operation GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries/{delivery_id} func (s *RepositoriesService) GetHookDelivery(ctx context.Context, owner, repo string, hookID, deliveryID int64) (*HookDelivery, *Response, error) { u := fmt.Sprintf("repos/%v/%v/hooks/%v/deliveries/%v", owner, repo, hookID, deliveryID) req, err := s.client.NewRequest("GET", u, nil) @@ -106,7 +110,9 @@ func (s *RepositoriesService) GetHookDelivery(ctx context.Context, owner, repo s // RedeliverHookDelivery redelivers a delivery for a webhook configured in a repository. // -// GitHub API docs: https://docs.github.com/en/rest/webhooks/repo-deliveries#redeliver-a-delivery-for-a-repository-webhook +// GitHub API docs: https://docs.github.com/rest/webhooks/repo-deliveries#redeliver-a-delivery-for-a-repository-webhook +// +//meta:operation POST /repos/{owner}/{repo}/hooks/{hook_id}/deliveries/{delivery_id}/attempts func (s *RepositoriesService) RedeliverHookDelivery(ctx context.Context, owner, repo string, hookID, deliveryID int64) (*HookDelivery, *Response, error) { u := fmt.Sprintf("repos/%v/%v/hooks/%v/deliveries/%v/attempts", owner, repo, hookID, deliveryID) req, err := s.client.NewRequest("POST", u, nil) diff --git a/github/repos_invitations.go b/github/repos_invitations.go index 81956cd49c9..4922e0b298c 100644 --- a/github/repos_invitations.go +++ b/github/repos_invitations.go @@ -27,7 +27,9 @@ type RepositoryInvitation struct { // ListInvitations lists all currently-open repository invitations. // -// GitHub API docs: https://docs.github.com/en/rest/collaborators/invitations#list-repository-invitations +// GitHub API docs: https://docs.github.com/rest/collaborators/invitations#list-repository-invitations +// +//meta:operation GET /repos/{owner}/{repo}/invitations func (s *RepositoriesService) ListInvitations(ctx context.Context, owner, repo string, opts *ListOptions) ([]*RepositoryInvitation, *Response, error) { u := fmt.Sprintf("repos/%v/%v/invitations", owner, repo) u, err := addOptions(u, opts) @@ -51,7 +53,9 @@ func (s *RepositoriesService) ListInvitations(ctx context.Context, owner, repo s // DeleteInvitation deletes a repository invitation. // -// GitHub API docs: https://docs.github.com/en/rest/collaborators/invitations#delete-a-repository-invitation +// GitHub API docs: https://docs.github.com/rest/collaborators/invitations#delete-a-repository-invitation +// +//meta:operation DELETE /repos/{owner}/{repo}/invitations/{invitation_id} func (s *RepositoriesService) DeleteInvitation(ctx context.Context, owner, repo string, invitationID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/invitations/%v", owner, repo, invitationID) req, err := s.client.NewRequest("DELETE", u, nil) @@ -68,7 +72,9 @@ func (s *RepositoriesService) DeleteInvitation(ctx context.Context, owner, repo // permissions represents the permissions that the associated user will have // on the repository. Possible values are: "read", "write", "admin". // -// GitHub API docs: https://docs.github.com/en/rest/collaborators/invitations#update-a-repository-invitation +// GitHub API docs: https://docs.github.com/rest/collaborators/invitations#update-a-repository-invitation +// +//meta:operation PATCH /repos/{owner}/{repo}/invitations/{invitation_id} func (s *RepositoriesService) UpdateInvitation(ctx context.Context, owner, repo string, invitationID int64, permissions string) (*RepositoryInvitation, *Response, error) { opts := &struct { Permissions string `json:"permissions"` diff --git a/github/repos_keys.go b/github/repos_keys.go index 42c5de49709..cc86f8bbd09 100644 --- a/github/repos_keys.go +++ b/github/repos_keys.go @@ -14,7 +14,9 @@ import ( // ListKeys lists the deploy keys for a repository. // -// GitHub API docs: https://docs.github.com/en/rest/deploy-keys#list-deploy-keys +// GitHub API docs: https://docs.github.com/rest/deploy-keys/deploy-keys#list-deploy-keys +// +//meta:operation GET /repos/{owner}/{repo}/keys func (s *RepositoriesService) ListKeys(ctx context.Context, owner string, repo string, opts *ListOptions) ([]*Key, *Response, error) { u := fmt.Sprintf("repos/%v/%v/keys", owner, repo) u, err := addOptions(u, opts) @@ -38,7 +40,9 @@ func (s *RepositoriesService) ListKeys(ctx context.Context, owner string, repo s // GetKey fetches a single deploy key. // -// GitHub API docs: https://docs.github.com/en/rest/deploy-keys#get-a-deploy-key +// GitHub API docs: https://docs.github.com/rest/deploy-keys/deploy-keys#get-a-deploy-key +// +//meta:operation GET /repos/{owner}/{repo}/keys/{key_id} func (s *RepositoriesService) GetKey(ctx context.Context, owner string, repo string, id int64) (*Key, *Response, error) { u := fmt.Sprintf("repos/%v/%v/keys/%v", owner, repo, id) @@ -58,7 +62,9 @@ func (s *RepositoriesService) GetKey(ctx context.Context, owner string, repo str // CreateKey adds a deploy key for a repository. // -// GitHub API docs: https://docs.github.com/en/rest/deploy-keys#create-a-deploy-key +// GitHub API docs: https://docs.github.com/rest/deploy-keys/deploy-keys#create-a-deploy-key +// +//meta:operation POST /repos/{owner}/{repo}/keys func (s *RepositoriesService) CreateKey(ctx context.Context, owner string, repo string, key *Key) (*Key, *Response, error) { u := fmt.Sprintf("repos/%v/%v/keys", owner, repo) @@ -78,7 +84,9 @@ func (s *RepositoriesService) CreateKey(ctx context.Context, owner string, repo // DeleteKey deletes a deploy key. // -// GitHub API docs: https://docs.github.com/en/rest/deploy-keys#delete-a-deploy-key +// GitHub API docs: https://docs.github.com/rest/deploy-keys/deploy-keys#delete-a-deploy-key +// +//meta:operation DELETE /repos/{owner}/{repo}/keys/{key_id} func (s *RepositoriesService) DeleteKey(ctx context.Context, owner string, repo string, id int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/keys/%v", owner, repo, id) diff --git a/github/repos_lfs.go b/github/repos_lfs.go index 6ac2e5a8778..f0153c08086 100644 --- a/github/repos_lfs.go +++ b/github/repos_lfs.go @@ -12,7 +12,9 @@ import ( // EnableLFS turns the LFS (Large File Storage) feature ON for the selected repo. // -// GitHub API docs: https://docs.github.com/en/rest/repos/lfs#enable-git-lfs-for-a-repository +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/repos/lfs#enable-git-lfs-for-a-repository +// +//meta:operation PUT /repos/{owner}/{repo}/lfs func (s *RepositoriesService) EnableLFS(ctx context.Context, owner, repo string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/lfs", owner, repo) @@ -31,7 +33,9 @@ func (s *RepositoriesService) EnableLFS(ctx context.Context, owner, repo string) // DisableLFS turns the LFS (Large File Storage) feature OFF for the selected repo. // -// GitHub API docs: https://docs.github.com/en/rest/repos/lfs#disable-git-lfs-for-a-repository +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/repos/lfs#disable-git-lfs-for-a-repository +// +//meta:operation DELETE /repos/{owner}/{repo}/lfs func (s *RepositoriesService) DisableLFS(ctx context.Context, owner, repo string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/lfs", owner, repo) diff --git a/github/repos_merging.go b/github/repos_merging.go index 66e88452e86..b26e5da1af6 100644 --- a/github/repos_merging.go +++ b/github/repos_merging.go @@ -34,7 +34,9 @@ type RepoMergeUpstreamResult struct { // Merge a branch in the specified repository. // -// GitHub API docs: https://docs.github.com/en/rest/branches/branches#merge-a-branch +// GitHub API docs: https://docs.github.com/rest/branches/branches#merge-a-branch +// +//meta:operation POST /repos/{owner}/{repo}/merges func (s *RepositoriesService) Merge(ctx context.Context, owner, repo string, request *RepositoryMergeRequest) (*RepositoryCommit, *Response, error) { u := fmt.Sprintf("repos/%v/%v/merges", owner, repo) req, err := s.client.NewRequest("POST", u, request) @@ -54,7 +56,9 @@ func (s *RepositoriesService) Merge(ctx context.Context, owner, repo string, req // MergeUpstream syncs a branch of a forked repository to keep it up-to-date // with the upstream repository. // -// GitHub API docs: https://docs.github.com/en/rest/branches/branches#sync-a-fork-branch-with-the-upstream-repository +// GitHub API docs: https://docs.github.com/rest/branches/branches#sync-a-fork-branch-with-the-upstream-repository +// +//meta:operation POST /repos/{owner}/{repo}/merge-upstream func (s *RepositoriesService) MergeUpstream(ctx context.Context, owner, repo string, request *RepoMergeUpstreamRequest) (*RepoMergeUpstreamResult, *Response, error) { u := fmt.Sprintf("repos/%v/%v/merge-upstream", owner, repo) req, err := s.client.NewRequest("POST", u, request) diff --git a/github/repos_pages.go b/github/repos_pages.go index 060f6eb8b1d..6b9ba76e44d 100644 --- a/github/repos_pages.go +++ b/github/repos_pages.go @@ -103,7 +103,9 @@ type createPagesRequest struct { // EnablePages enables GitHub Pages for the named repo. // -// GitHub API docs: https://docs.github.com/en/rest/pages#create-a-github-pages-site +// GitHub API docs: https://docs.github.com/rest/pages/pages#create-a-github-pages-site +// +//meta:operation POST /repos/{owner}/{repo}/pages func (s *RepositoriesService) EnablePages(ctx context.Context, owner, repo string, pages *Pages) (*Pages, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pages", owner, repo) @@ -153,7 +155,9 @@ type PagesUpdate struct { // UpdatePages updates GitHub Pages for the named repo. // -// GitHub API docs: https://docs.github.com/en/rest/pages#update-information-about-a-github-pages-site +// GitHub API docs: https://docs.github.com/rest/pages/pages#update-information-about-a-github-pages-site +// +//meta:operation PUT /repos/{owner}/{repo}/pages func (s *RepositoriesService) UpdatePages(ctx context.Context, owner, repo string, opts *PagesUpdate) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/pages", owner, repo) @@ -172,7 +176,9 @@ func (s *RepositoriesService) UpdatePages(ctx context.Context, owner, repo strin // DisablePages disables GitHub Pages for the named repo. // -// GitHub API docs: https://docs.github.com/en/rest/pages#delete-a-github-pages-site +// GitHub API docs: https://docs.github.com/rest/pages/pages#delete-a-github-pages-site +// +//meta:operation DELETE /repos/{owner}/{repo}/pages func (s *RepositoriesService) DisablePages(ctx context.Context, owner, repo string) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/pages", owner, repo) req, err := s.client.NewRequest("DELETE", u, nil) @@ -188,7 +194,9 @@ func (s *RepositoriesService) DisablePages(ctx context.Context, owner, repo stri // GetPagesInfo fetches information about a GitHub Pages site. // -// GitHub API docs: https://docs.github.com/en/rest/pages#get-a-github-pages-site +// GitHub API docs: https://docs.github.com/rest/pages/pages#get-a-github-pages-site +// +//meta:operation GET /repos/{owner}/{repo}/pages func (s *RepositoriesService) GetPagesInfo(ctx context.Context, owner, repo string) (*Pages, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pages", owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -207,7 +215,9 @@ func (s *RepositoriesService) GetPagesInfo(ctx context.Context, owner, repo stri // ListPagesBuilds lists the builds for a GitHub Pages site. // -// GitHub API docs: https://docs.github.com/en/rest/pages#list-github-pages-builds +// GitHub API docs: https://docs.github.com/rest/pages/pages#list-github-pages-builds +// +//meta:operation GET /repos/{owner}/{repo}/pages/builds func (s *RepositoriesService) ListPagesBuilds(ctx context.Context, owner, repo string, opts *ListOptions) ([]*PagesBuild, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pages/builds", owner, repo) u, err := addOptions(u, opts) @@ -231,7 +241,9 @@ func (s *RepositoriesService) ListPagesBuilds(ctx context.Context, owner, repo s // GetLatestPagesBuild fetches the latest build information for a GitHub pages site. // -// GitHub API docs: https://docs.github.com/en/rest/pages#get-latest-pages-build +// GitHub API docs: https://docs.github.com/rest/pages/pages#get-latest-pages-build +// +//meta:operation GET /repos/{owner}/{repo}/pages/builds/latest func (s *RepositoriesService) GetLatestPagesBuild(ctx context.Context, owner, repo string) (*PagesBuild, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pages/builds/latest", owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -250,7 +262,9 @@ func (s *RepositoriesService) GetLatestPagesBuild(ctx context.Context, owner, re // GetPageBuild fetches the specific build information for a GitHub pages site. // -// GitHub API docs: https://docs.github.com/en/rest/pages#get-github-pages-build +// GitHub API docs: https://docs.github.com/rest/pages/pages#get-github-pages-build +// +//meta:operation GET /repos/{owner}/{repo}/pages/builds/{build_id} func (s *RepositoriesService) GetPageBuild(ctx context.Context, owner, repo string, id int64) (*PagesBuild, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pages/builds/%v", owner, repo, id) req, err := s.client.NewRequest("GET", u, nil) @@ -269,7 +283,9 @@ func (s *RepositoriesService) GetPageBuild(ctx context.Context, owner, repo stri // RequestPageBuild requests a build of a GitHub Pages site without needing to push new commit. // -// GitHub API docs: https://docs.github.com/en/rest/pages#request-a-github-pages-build +// GitHub API docs: https://docs.github.com/rest/pages/pages#request-a-github-pages-build +// +//meta:operation POST /repos/{owner}/{repo}/pages/builds func (s *RepositoriesService) RequestPageBuild(ctx context.Context, owner, repo string) (*PagesBuild, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pages/builds", owner, repo) req, err := s.client.NewRequest("POST", u, nil) @@ -288,7 +304,9 @@ func (s *RepositoriesService) RequestPageBuild(ctx context.Context, owner, repo // GetPageHealthCheck gets a DNS health check for the CNAME record configured for a repository's GitHub Pages. // -// GitHub API docs: https://docs.github.com/en/rest/pages#get-a-dns-health-check-for-github-pages +// GitHub API docs: https://docs.github.com/rest/pages/pages#get-a-dns-health-check-for-github-pages +// +//meta:operation GET /repos/{owner}/{repo}/pages/health func (s *RepositoriesService) GetPageHealthCheck(ctx context.Context, owner, repo string) (*PagesHealthCheckResponse, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pages/health", owner, repo) req, err := s.client.NewRequest("GET", u, nil) diff --git a/github/repos_prereceive_hooks.go b/github/repos_prereceive_hooks.go index 1ce6478d33b..e8361383f57 100644 --- a/github/repos_prereceive_hooks.go +++ b/github/repos_prereceive_hooks.go @@ -24,7 +24,9 @@ func (p PreReceiveHook) String() string { // ListPreReceiveHooks lists all pre-receive hooks for the specified repository. // -// GitHub API docs: https://developer.github.com/enterprise/2.13/v3/repos/pre_receive_hooks/#list-pre-receive-hooks +// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/repo-pre-receive-hooks#list-pre-receive-hooks-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/pre-receive-hooks func (s *RepositoriesService) ListPreReceiveHooks(ctx context.Context, owner, repo string, opts *ListOptions) ([]*PreReceiveHook, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pre-receive-hooks", owner, repo) u, err := addOptions(u, opts) @@ -51,7 +53,9 @@ func (s *RepositoriesService) ListPreReceiveHooks(ctx context.Context, owner, re // GetPreReceiveHook returns a single specified pre-receive hook. // -// GitHub API docs: https://developer.github.com/enterprise/2.13/v3/repos/pre_receive_hooks/#get-a-single-pre-receive-hook +// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/repo-pre-receive-hooks#get-a-pre-receive-hook-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/pre-receive-hooks/{pre_receive_hook_id} func (s *RepositoriesService) GetPreReceiveHook(ctx context.Context, owner, repo string, id int64) (*PreReceiveHook, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pre-receive-hooks/%d", owner, repo, id) req, err := s.client.NewRequest("GET", u, nil) @@ -73,7 +77,9 @@ func (s *RepositoriesService) GetPreReceiveHook(ctx context.Context, owner, repo // UpdatePreReceiveHook updates a specified pre-receive hook. // -// GitHub API docs: https://developer.github.com/enterprise/2.13/v3/repos/pre_receive_hooks/#update-pre-receive-hook-enforcement +// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/repo-pre-receive-hooks#update-pre-receive-hook-enforcement-for-a-repository +// +//meta:operation PATCH /repos/{owner}/{repo}/pre-receive-hooks/{pre_receive_hook_id} func (s *RepositoriesService) UpdatePreReceiveHook(ctx context.Context, owner, repo string, id int64, hook *PreReceiveHook) (*PreReceiveHook, *Response, error) { u := fmt.Sprintf("repos/%v/%v/pre-receive-hooks/%d", owner, repo, id) req, err := s.client.NewRequest("PATCH", u, hook) @@ -95,7 +101,9 @@ func (s *RepositoriesService) UpdatePreReceiveHook(ctx context.Context, owner, r // DeletePreReceiveHook deletes a specified pre-receive hook. // -// GitHub API docs: https://developer.github.com/enterprise/2.13/v3/repos/pre_receive_hooks/#remove-enforcement-overrides-for-a-pre-receive-hook +// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/repo-pre-receive-hooks#remove-pre-receive-hook-enforcement-for-a-repository +// +//meta:operation DELETE /repos/{owner}/{repo}/pre-receive-hooks/{pre_receive_hook_id} func (s *RepositoriesService) DeletePreReceiveHook(ctx context.Context, owner, repo string, id int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/pre-receive-hooks/%d", owner, repo, id) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/repos_projects.go b/github/repos_projects.go index a3001dee988..9269d4e95c0 100644 --- a/github/repos_projects.go +++ b/github/repos_projects.go @@ -21,7 +21,9 @@ type ProjectListOptions struct { // ListProjects lists the projects for a repo. // -// GitHub API docs: https://docs.github.com/en/rest/projects/projects#list-repository-projects +// GitHub API docs: https://docs.github.com/rest/projects/projects#list-repository-projects +// +//meta:operation GET /repos/{owner}/{repo}/projects func (s *RepositoriesService) ListProjects(ctx context.Context, owner, repo string, opts *ProjectListOptions) ([]*Project, *Response, error) { u := fmt.Sprintf("repos/%v/%v/projects", owner, repo) u, err := addOptions(u, opts) @@ -48,7 +50,9 @@ func (s *RepositoriesService) ListProjects(ctx context.Context, owner, repo stri // CreateProject creates a GitHub Project for the specified repository. // -// GitHub API docs: https://docs.github.com/en/rest/projects/projects#create-a-repository-project +// GitHub API docs: https://docs.github.com/rest/projects/projects#create-a-repository-project +// +//meta:operation POST /repos/{owner}/{repo}/projects func (s *RepositoriesService) CreateProject(ctx context.Context, owner, repo string, opts *ProjectOptions) (*Project, *Response, error) { u := fmt.Sprintf("repos/%v/%v/projects", owner, repo) req, err := s.client.NewRequest("POST", u, opts) diff --git a/github/repos_releases.go b/github/repos_releases.go index e2aa845af2f..7231db6d9ea 100644 --- a/github/repos_releases.go +++ b/github/repos_releases.go @@ -87,7 +87,9 @@ func (r ReleaseAsset) String() string { // ListReleases lists the releases for a repository. // -// GitHub API docs: https://docs.github.com/en/rest/releases/releases#list-releases +// GitHub API docs: https://docs.github.com/rest/releases/releases#list-releases +// +//meta:operation GET /repos/{owner}/{repo}/releases func (s *RepositoriesService) ListReleases(ctx context.Context, owner, repo string, opts *ListOptions) ([]*RepositoryRelease, *Response, error) { u := fmt.Sprintf("repos/%s/%s/releases", owner, repo) u, err := addOptions(u, opts) @@ -110,7 +112,9 @@ func (s *RepositoriesService) ListReleases(ctx context.Context, owner, repo stri // GetRelease fetches a single release. // -// GitHub API docs: https://docs.github.com/en/rest/releases/releases#get-a-release +// GitHub API docs: https://docs.github.com/rest/releases/releases#get-a-release +// +//meta:operation GET /repos/{owner}/{repo}/releases/{release_id} func (s *RepositoriesService) GetRelease(ctx context.Context, owner, repo string, id int64) (*RepositoryRelease, *Response, error) { u := fmt.Sprintf("repos/%s/%s/releases/%d", owner, repo, id) return s.getSingleRelease(ctx, u) @@ -118,7 +122,9 @@ func (s *RepositoriesService) GetRelease(ctx context.Context, owner, repo string // GetLatestRelease fetches the latest published release for the repository. // -// GitHub API docs: https://docs.github.com/en/rest/releases/releases#get-the-latest-release +// GitHub API docs: https://docs.github.com/rest/releases/releases#get-the-latest-release +// +//meta:operation GET /repos/{owner}/{repo}/releases/latest func (s *RepositoriesService) GetLatestRelease(ctx context.Context, owner, repo string) (*RepositoryRelease, *Response, error) { u := fmt.Sprintf("repos/%s/%s/releases/latest", owner, repo) return s.getSingleRelease(ctx, u) @@ -126,7 +132,9 @@ func (s *RepositoriesService) GetLatestRelease(ctx context.Context, owner, repo // GetReleaseByTag fetches a release with the specified tag. // -// GitHub API docs: https://docs.github.com/en/rest/releases/releases#get-a-release-by-tag-name +// GitHub API docs: https://docs.github.com/rest/releases/releases#get-a-release-by-tag-name +// +//meta:operation GET /repos/{owner}/{repo}/releases/tags/{tag} func (s *RepositoriesService) GetReleaseByTag(ctx context.Context, owner, repo, tag string) (*RepositoryRelease, *Response, error) { u := fmt.Sprintf("repos/%s/%s/releases/tags/%s", owner, repo, tag) return s.getSingleRelease(ctx, u) @@ -134,7 +142,9 @@ func (s *RepositoriesService) GetReleaseByTag(ctx context.Context, owner, repo, // GenerateReleaseNotes generates the release notes for the given tag. // -// GitHub API docs: https://docs.github.com/en/rest/releases/releases#generate-release-notes-content-for-a-release +// GitHub API docs: https://docs.github.com/rest/releases/releases#generate-release-notes-content-for-a-release +// +//meta:operation POST /repos/{owner}/{repo}/releases/generate-notes func (s *RepositoriesService) GenerateReleaseNotes(ctx context.Context, owner, repo string, opts *GenerateNotesOptions) (*RepositoryReleaseNotes, *Response, error) { u := fmt.Sprintf("repos/%s/%s/releases/generate-notes", owner, repo) req, err := s.client.NewRequest("POST", u, opts) @@ -188,7 +198,9 @@ type repositoryReleaseRequest struct { // Note that only a subset of the release fields are used. // See RepositoryRelease for more information. // -// GitHub API docs: https://docs.github.com/en/rest/releases/releases#create-a-release +// GitHub API docs: https://docs.github.com/rest/releases/releases#create-a-release +// +//meta:operation POST /repos/{owner}/{repo}/releases func (s *RepositoriesService) CreateRelease(ctx context.Context, owner, repo string, release *RepositoryRelease) (*RepositoryRelease, *Response, error) { u := fmt.Sprintf("repos/%s/%s/releases", owner, repo) @@ -222,7 +234,9 @@ func (s *RepositoriesService) CreateRelease(ctx context.Context, owner, repo str // Note that only a subset of the release fields are used. // See RepositoryRelease for more information. // -// GitHub API docs: https://docs.github.com/en/rest/releases/releases#update-a-release +// GitHub API docs: https://docs.github.com/rest/releases/releases#update-a-release +// +//meta:operation PATCH /repos/{owner}/{repo}/releases/{release_id} func (s *RepositoriesService) EditRelease(ctx context.Context, owner, repo string, id int64, release *RepositoryRelease) (*RepositoryRelease, *Response, error) { u := fmt.Sprintf("repos/%s/%s/releases/%d", owner, repo, id) @@ -252,7 +266,9 @@ func (s *RepositoriesService) EditRelease(ctx context.Context, owner, repo strin // DeleteRelease delete a single release from a repository. // -// GitHub API docs: https://docs.github.com/en/rest/releases/releases#delete-a-release +// GitHub API docs: https://docs.github.com/rest/releases/releases#delete-a-release +// +//meta:operation DELETE /repos/{owner}/{repo}/releases/{release_id} func (s *RepositoriesService) DeleteRelease(ctx context.Context, owner, repo string, id int64) (*Response, error) { u := fmt.Sprintf("repos/%s/%s/releases/%d", owner, repo, id) @@ -265,7 +281,9 @@ func (s *RepositoriesService) DeleteRelease(ctx context.Context, owner, repo str // ListReleaseAssets lists the release's assets. // -// GitHub API docs: https://docs.github.com/en/rest/releases/assets#list-release-assets +// GitHub API docs: https://docs.github.com/rest/releases/assets#list-release-assets +// +//meta:operation GET /repos/{owner}/{repo}/releases/{release_id}/assets func (s *RepositoriesService) ListReleaseAssets(ctx context.Context, owner, repo string, id int64, opts *ListOptions) ([]*ReleaseAsset, *Response, error) { u := fmt.Sprintf("repos/%s/%s/releases/%d/assets", owner, repo, id) u, err := addOptions(u, opts) @@ -288,7 +306,9 @@ func (s *RepositoriesService) ListReleaseAssets(ctx context.Context, owner, repo // GetReleaseAsset fetches a single release asset. // -// GitHub API docs: https://docs.github.com/en/rest/releases/assets#get-a-release-asset +// GitHub API docs: https://docs.github.com/rest/releases/assets#get-a-release-asset +// +//meta:operation GET /repos/{owner}/{repo}/releases/assets/{asset_id} func (s *RepositoriesService) GetReleaseAsset(ctx context.Context, owner, repo string, id int64) (*ReleaseAsset, *Response, error) { u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id) @@ -317,7 +337,9 @@ func (s *RepositoriesService) GetReleaseAsset(ctx context.Context, owner, repo s // exist, but it's possible to pass any http.Client. If nil is passed the // redirectURL will be returned instead. // -// GitHub API docs: https://docs.github.com/en/rest/releases/assets#get-a-release-asset +// GitHub API docs: https://docs.github.com/rest/releases/assets#get-a-release-asset +// +//meta:operation GET /repos/{owner}/{repo}/releases/assets/{asset_id} func (s *RepositoriesService) DownloadReleaseAsset(ctx context.Context, owner, repo string, id int64, followRedirectsClient *http.Client) (rc io.ReadCloser, redirectURL string, err error) { u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id) @@ -379,7 +401,9 @@ func (s *RepositoriesService) downloadReleaseAssetFromURL(ctx context.Context, f // EditReleaseAsset edits a repository release asset. // -// GitHub API docs: https://docs.github.com/en/rest/releases/assets#update-a-release-asset +// GitHub API docs: https://docs.github.com/rest/releases/assets#update-a-release-asset +// +//meta:operation PATCH /repos/{owner}/{repo}/releases/assets/{asset_id} func (s *RepositoriesService) EditReleaseAsset(ctx context.Context, owner, repo string, id int64, release *ReleaseAsset) (*ReleaseAsset, *Response, error) { u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id) @@ -398,7 +422,9 @@ func (s *RepositoriesService) EditReleaseAsset(ctx context.Context, owner, repo // DeleteReleaseAsset delete a single release asset from a repository. // -// GitHub API docs: https://docs.github.com/en/rest/releases/assets#delete-a-release-asset +// GitHub API docs: https://docs.github.com/rest/releases/assets#delete-a-release-asset +// +//meta:operation DELETE /repos/{owner}/{repo}/releases/assets/{asset_id} func (s *RepositoriesService) DeleteReleaseAsset(ctx context.Context, owner, repo string, id int64) (*Response, error) { u := fmt.Sprintf("repos/%s/%s/releases/assets/%d", owner, repo, id) @@ -412,7 +438,9 @@ func (s *RepositoriesService) DeleteReleaseAsset(ctx context.Context, owner, rep // UploadReleaseAsset creates an asset by uploading a file into a release repository. // To upload assets that cannot be represented by an os.File, call NewUploadRequest directly. // -// GitHub API docs: https://docs.github.com/en/rest/releases/assets#upload-a-release-asset +// GitHub API docs: https://docs.github.com/rest/releases/assets#upload-a-release-asset +// +//meta:operation POST /repos/{owner}/{repo}/releases/{release_id}/assets func (s *RepositoriesService) UploadReleaseAsset(ctx context.Context, owner, repo string, id int64, opts *UploadOptions, file *os.File) (*ReleaseAsset, *Response, error) { u := fmt.Sprintf("repos/%s/%s/releases/%d/assets", owner, repo, id) u, err := addOptions(u, opts) diff --git a/github/repos_rules.go b/github/repos_rules.go index 2c24f8c27b3..b47b37038ed 100644 --- a/github/repos_rules.go +++ b/github/repos_rules.go @@ -349,7 +349,9 @@ type Ruleset struct { // GetRulesForBranch gets all the rules that apply to the specified branch. // -// GitHub API docs: https://docs.github.com/en/rest/repos/rules#get-rules-for-a-branch +// GitHub API docs: https://docs.github.com/rest/repos/rules#get-rules-for-a-branch +// +//meta:operation GET /repos/{owner}/{repo}/rules/branches/{branch} func (s *RepositoriesService) GetRulesForBranch(ctx context.Context, owner, repo, branch string) ([]*RepositoryRule, *Response, error) { u := fmt.Sprintf("repos/%v/%v/rules/branches/%v", owner, repo, branch) @@ -370,7 +372,9 @@ func (s *RepositoriesService) GetRulesForBranch(ctx context.Context, owner, repo // GetAllRulesets gets all the rules that apply to the specified repository. // If includesParents is true, rulesets configured at the organization level that apply to the repository will be returned. // -// GitHub API docs: https://docs.github.com/en/rest/repos/rules#get-all-repository-rulesets +// GitHub API docs: https://docs.github.com/rest/repos/rules#get-all-repository-rulesets +// +//meta:operation GET /repos/{owner}/{repo}/rulesets func (s *RepositoriesService) GetAllRulesets(ctx context.Context, owner, repo string, includesParents bool) ([]*Ruleset, *Response, error) { u := fmt.Sprintf("repos/%v/%v/rulesets?includes_parents=%v", owner, repo, includesParents) @@ -390,7 +394,9 @@ func (s *RepositoriesService) GetAllRulesets(ctx context.Context, owner, repo st // CreateRuleset creates a ruleset for the specified repository. // -// GitHub API docs: https://docs.github.com/en/rest/repos/rules#create-a-repository-ruleset +// GitHub API docs: https://docs.github.com/rest/repos/rules#create-a-repository-ruleset +// +//meta:operation POST /repos/{owner}/{repo}/rulesets func (s *RepositoriesService) CreateRuleset(ctx context.Context, owner, repo string, rs *Ruleset) (*Ruleset, *Response, error) { u := fmt.Sprintf("repos/%v/%v/rulesets", owner, repo) @@ -411,7 +417,9 @@ func (s *RepositoriesService) CreateRuleset(ctx context.Context, owner, repo str // GetRuleset gets a ruleset for the specified repository. // If includesParents is true, rulesets configured at the organization level that apply to the repository will be returned. // -// GitHub API docs: https://docs.github.com/en/rest/repos/rules#get-a-repository-ruleset +// GitHub API docs: https://docs.github.com/rest/repos/rules#get-a-repository-ruleset +// +//meta:operation GET /repos/{owner}/{repo}/rulesets/{ruleset_id} func (s *RepositoriesService) GetRuleset(ctx context.Context, owner, repo string, rulesetID int64, includesParents bool) (*Ruleset, *Response, error) { u := fmt.Sprintf("repos/%v/%v/rulesets/%v?includes_parents=%v", owner, repo, rulesetID, includesParents) @@ -431,7 +439,9 @@ func (s *RepositoriesService) GetRuleset(ctx context.Context, owner, repo string // UpdateRuleset updates a ruleset for the specified repository. // -// GitHub API docs: https://docs.github.com/en/rest/repos/rules#update-a-repository-ruleset +// GitHub API docs: https://docs.github.com/rest/repos/rules#update-a-repository-ruleset +// +//meta:operation PUT /repos/{owner}/{repo}/rulesets/{ruleset_id} func (s *RepositoriesService) UpdateRuleset(ctx context.Context, owner, repo string, rulesetID int64, rs *Ruleset) (*Ruleset, *Response, error) { u := fmt.Sprintf("repos/%v/%v/rulesets/%v", owner, repo, rulesetID) @@ -451,7 +461,9 @@ func (s *RepositoriesService) UpdateRuleset(ctx context.Context, owner, repo str // DeleteRuleset deletes a ruleset for the specified repository. // -// GitHub API docs: https://docs.github.com/en/rest/repos/rules#delete-a-repository-ruleset +// GitHub API docs: https://docs.github.com/rest/repos/rules#delete-a-repository-ruleset +// +//meta:operation DELETE /repos/{owner}/{repo}/rulesets/{ruleset_id} func (s *RepositoriesService) DeleteRuleset(ctx context.Context, owner, repo string, rulesetID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/rulesets/%v", owner, repo, rulesetID) diff --git a/github/repos_stats.go b/github/repos_stats.go index 3df0a8f6deb..898693f7864 100644 --- a/github/repos_stats.go +++ b/github/repos_stats.go @@ -45,7 +45,9 @@ func (w WeeklyStats) String() string { // it is now computing the requested statistics. A follow up request, after a // delay of a second or so, should result in a successful request. // -// GitHub API docs: https://docs.github.com/en/rest/metrics/statistics#get-all-contributor-commit-activity +// GitHub API docs: https://docs.github.com/rest/metrics/statistics#get-all-contributor-commit-activity +// +//meta:operation GET /repos/{owner}/{repo}/stats/contributors func (s *RepositoriesService) ListContributorsStats(ctx context.Context, owner, repo string) ([]*ContributorStats, *Response, error) { u := fmt.Sprintf("repos/%v/%v/stats/contributors", owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -84,7 +86,9 @@ func (w WeeklyCommitActivity) String() string { // it is now computing the requested statistics. A follow up request, after a // delay of a second or so, should result in a successful request. // -// GitHub API docs: https://docs.github.com/en/rest/metrics/statistics#get-the-last-year-of-commit-activity +// GitHub API docs: https://docs.github.com/rest/metrics/statistics#get-the-last-year-of-commit-activity +// +//meta:operation GET /repos/{owner}/{repo}/stats/commit_activity func (s *RepositoriesService) ListCommitActivity(ctx context.Context, owner, repo string) ([]*WeeklyCommitActivity, *Response, error) { u := fmt.Sprintf("repos/%v/%v/stats/commit_activity", owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -111,7 +115,9 @@ func (s *RepositoriesService) ListCommitActivity(ctx context.Context, owner, rep // it is now computing the requested statistics. A follow up request, after a // delay of a second or so, should result in a successful request. // -// GitHub API docs: https://docs.github.com/en/rest/metrics/statistics#get-the-weekly-commit-activity +// GitHub API docs: https://docs.github.com/rest/metrics/statistics#get-the-weekly-commit-activity +// +//meta:operation GET /repos/{owner}/{repo}/stats/code_frequency func (s *RepositoriesService) ListCodeFrequency(ctx context.Context, owner, repo string) ([]*WeeklyStats, *Response, error) { u := fmt.Sprintf("repos/%v/%v/stats/code_frequency", owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -167,7 +173,9 @@ func (r RepositoryParticipation) String() string { // it is now computing the requested statistics. A follow up request, after a // delay of a second or so, should result in a successful request. // -// GitHub API docs: https://docs.github.com/en/rest/metrics/statistics#get-the-weekly-commit-count +// GitHub API docs: https://docs.github.com/rest/metrics/statistics#get-the-weekly-commit-count +// +//meta:operation GET /repos/{owner}/{repo}/stats/participation func (s *RepositoriesService) ListParticipation(ctx context.Context, owner, repo string) (*RepositoryParticipation, *Response, error) { u := fmt.Sprintf("repos/%v/%v/stats/participation", owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -200,7 +208,9 @@ type PunchCard struct { // it is now computing the requested statistics. A follow up request, after a // delay of a second or so, should result in a successful request. // -// GitHub API docs: https://docs.github.com/en/rest/metrics/statistics#get-the-hourly-commit-count-for-each-day +// GitHub API docs: https://docs.github.com/rest/metrics/statistics#get-the-hourly-commit-count-for-each-day +// +//meta:operation GET /repos/{owner}/{repo}/stats/punch_card func (s *RepositoriesService) ListPunchCard(ctx context.Context, owner, repo string) ([]*PunchCard, *Response, error) { u := fmt.Sprintf("repos/%v/%v/stats/punch_card", owner, repo) req, err := s.client.NewRequest("GET", u, nil) diff --git a/github/repos_statuses.go b/github/repos_statuses.go index ea3d166c753..e7b03047521 100644 --- a/github/repos_statuses.go +++ b/github/repos_statuses.go @@ -45,7 +45,9 @@ func (r RepoStatus) String() string { // ListStatuses lists the statuses of a repository at the specified // reference. ref can be a SHA, a branch name, or a tag name. // -// GitHub API docs: https://docs.github.com/en/rest/commits/statuses#list-commit-statuses-for-a-reference +// GitHub API docs: https://docs.github.com/rest/commits/statuses#list-commit-statuses-for-a-reference +// +//meta:operation GET /repos/{owner}/{repo}/commits/{ref}/statuses func (s *RepositoriesService) ListStatuses(ctx context.Context, owner, repo, ref string, opts *ListOptions) ([]*RepoStatus, *Response, error) { u := fmt.Sprintf("repos/%v/%v/commits/%v/statuses", owner, repo, refURLEscape(ref)) u, err := addOptions(u, opts) @@ -70,7 +72,9 @@ func (s *RepositoriesService) ListStatuses(ctx context.Context, owner, repo, ref // CreateStatus creates a new status for a repository at the specified // reference. Ref can be a SHA, a branch name, or a tag name. // -// GitHub API docs: https://docs.github.com/en/rest/commits/statuses#create-a-commit-status +// GitHub API docs: https://docs.github.com/rest/commits/statuses#create-a-commit-status +// +//meta:operation POST /repos/{owner}/{repo}/statuses/{sha} func (s *RepositoriesService) CreateStatus(ctx context.Context, owner, repo, ref string, status *RepoStatus) (*RepoStatus, *Response, error) { u := fmt.Sprintf("repos/%v/%v/statuses/%v", owner, repo, refURLEscape(ref)) req, err := s.client.NewRequest("POST", u, status) @@ -109,7 +113,9 @@ func (s CombinedStatus) String() string { // GetCombinedStatus returns the combined status of a repository at the specified // reference. ref can be a SHA, a branch name, or a tag name. // -// GitHub API docs: https://docs.github.com/en/rest/commits/statuses#get-the-combined-status-for-a-specific-reference +// GitHub API docs: https://docs.github.com/rest/commits/statuses#get-the-combined-status-for-a-specific-reference +// +//meta:operation GET /repos/{owner}/{repo}/commits/{ref}/status func (s *RepositoriesService) GetCombinedStatus(ctx context.Context, owner, repo, ref string, opts *ListOptions) (*CombinedStatus, *Response, error) { u := fmt.Sprintf("repos/%v/%v/commits/%v/status", owner, repo, refURLEscape(ref)) u, err := addOptions(u, opts) diff --git a/github/repos_tags.go b/github/repos_tags.go index ff46d90c731..93164dd1b8e 100644 --- a/github/repos_tags.go +++ b/github/repos_tags.go @@ -24,7 +24,9 @@ type tagProtectionRequest struct { // ListTagProtection lists tag protection of the specified repository. // -// GitHub API docs: https://docs.github.com/en/rest/repos/tags#list-tag-protection-states-for-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/tags#list-tag-protection-states-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/tags/protection func (s *RepositoriesService) ListTagProtection(ctx context.Context, owner, repo string) ([]*TagProtection, *Response, error) { u := fmt.Sprintf("repos/%v/%v/tags/protection", owner, repo) @@ -44,7 +46,9 @@ func (s *RepositoriesService) ListTagProtection(ctx context.Context, owner, repo // CreateTagProtection creates the tag protection of the specified repository. // -// GitHub API docs: https://docs.github.com/en/rest/repos/tags#create-a-tag-protection-state-for-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/tags#create-a-tag-protection-state-for-a-repository +// +//meta:operation POST /repos/{owner}/{repo}/tags/protection func (s *RepositoriesService) CreateTagProtection(ctx context.Context, owner, repo, pattern string) (*TagProtection, *Response, error) { u := fmt.Sprintf("repos/%v/%v/tags/protection", owner, repo) r := &tagProtectionRequest{Pattern: pattern} @@ -64,7 +68,9 @@ func (s *RepositoriesService) CreateTagProtection(ctx context.Context, owner, re // DeleteTagProtection deletes a tag protection from the specified repository. // -// GitHub API docs: https://docs.github.com/en/rest/repos/tags#delete-a-tag-protection-state-for-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/tags#delete-a-tag-protection-state-for-a-repository +// +//meta:operation DELETE /repos/{owner}/{repo}/tags/protection/{tag_protection_id} func (s *RepositoriesService) DeleteTagProtection(ctx context.Context, owner, repo string, tagProtectionID int64) (*Response, error) { u := fmt.Sprintf("repos/%v/%v/tags/protection/%v", owner, repo, tagProtectionID) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/repos_traffic.go b/github/repos_traffic.go index bf093c03ea7..ae2f1a86bd7 100644 --- a/github/repos_traffic.go +++ b/github/repos_traffic.go @@ -54,7 +54,9 @@ type TrafficBreakdownOptions struct { // ListTrafficReferrers list the top 10 referrers over the last 14 days. // -// GitHub API docs: https://docs.github.com/en/rest/metrics/traffic#get-top-referral-sources +// GitHub API docs: https://docs.github.com/rest/metrics/traffic#get-top-referral-sources +// +//meta:operation GET /repos/{owner}/{repo}/traffic/popular/referrers func (s *RepositoriesService) ListTrafficReferrers(ctx context.Context, owner, repo string) ([]*TrafficReferrer, *Response, error) { u := fmt.Sprintf("repos/%v/%v/traffic/popular/referrers", owner, repo) @@ -74,7 +76,9 @@ func (s *RepositoriesService) ListTrafficReferrers(ctx context.Context, owner, r // ListTrafficPaths list the top 10 popular content over the last 14 days. // -// GitHub API docs: https://docs.github.com/en/rest/metrics/traffic#get-top-referral-paths +// GitHub API docs: https://docs.github.com/rest/metrics/traffic#get-top-referral-paths +// +//meta:operation GET /repos/{owner}/{repo}/traffic/popular/paths func (s *RepositoriesService) ListTrafficPaths(ctx context.Context, owner, repo string) ([]*TrafficPath, *Response, error) { u := fmt.Sprintf("repos/%v/%v/traffic/popular/paths", owner, repo) @@ -94,7 +98,9 @@ func (s *RepositoriesService) ListTrafficPaths(ctx context.Context, owner, repo // ListTrafficViews get total number of views for the last 14 days and breaks it down either per day or week. // -// GitHub API docs: https://docs.github.com/en/rest/metrics/traffic#get-page-views +// GitHub API docs: https://docs.github.com/rest/metrics/traffic#get-page-views +// +//meta:operation GET /repos/{owner}/{repo}/traffic/views func (s *RepositoriesService) ListTrafficViews(ctx context.Context, owner, repo string, opts *TrafficBreakdownOptions) (*TrafficViews, *Response, error) { u := fmt.Sprintf("repos/%v/%v/traffic/views", owner, repo) u, err := addOptions(u, opts) @@ -118,7 +124,9 @@ func (s *RepositoriesService) ListTrafficViews(ctx context.Context, owner, repo // ListTrafficClones get total number of clones for the last 14 days and breaks it down either per day or week for the last 14 days. // -// GitHub API docs: https://docs.github.com/en/rest/metrics/traffic#get-repository-clones +// GitHub API docs: https://docs.github.com/rest/metrics/traffic#get-repository-clones +// +//meta:operation GET /repos/{owner}/{repo}/traffic/clones func (s *RepositoriesService) ListTrafficClones(ctx context.Context, owner, repo string, opts *TrafficBreakdownOptions) (*TrafficClones, *Response, error) { u := fmt.Sprintf("repos/%v/%v/traffic/clones", owner, repo) u, err := addOptions(u, opts) diff --git a/github/scim.go b/github/scim.go index 7deee6be4b5..02136d7ef91 100644 --- a/github/scim.go +++ b/github/scim.go @@ -14,12 +14,12 @@ import ( // SCIMService provides access to SCIM related functions in the // GitHub API. // -// GitHub API docs: https://docs.github.com/en/rest/scim +// GitHub API docs: https://docs.github.com/rest/scim type SCIMService service // SCIMUserAttributes represents supported SCIM User attributes. // -// GitHub API docs: https://docs.github.com/en/rest/scim#supported-scim-user-attributes +// GitHub API docs: https://docs.github.com/rest/scim#supported-scim-user-attributes type SCIMUserAttributes struct { UserName string `json:"userName"` // Configured by the admin. Could be an email, login, or username. (Required.) Name SCIMUserName `json:"name"` // (Required.) @@ -67,7 +67,7 @@ type SCIMProvisionedIdentities struct { // ListSCIMProvisionedIdentitiesOptions represents options for ListSCIMProvisionedIdentities. // -// Github API docs: https://docs.github.com/en/rest/scim#list-scim-provisioned-identities--parameters +// GitHub API docs: https://docs.github.com/rest/scim#list-scim-provisioned-identities--parameters type ListSCIMProvisionedIdentitiesOptions struct { StartIndex *int `url:"startIndex,omitempty"` // Used for pagination: the index of the first result to return. (Optional.) Count *int `url:"count,omitempty"` // Used for pagination: the number of results to return. (Optional.) @@ -81,7 +81,9 @@ type ListSCIMProvisionedIdentitiesOptions struct { // ListSCIMProvisionedIdentities lists SCIM provisioned identities. // -// GitHub API docs: https://docs.github.com/en/rest/scim#list-scim-provisioned-identities +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/scim/scim#list-scim-provisioned-identities +// +//meta:operation GET /scim/v2/organizations/{org}/Users func (s *SCIMService) ListSCIMProvisionedIdentities(ctx context.Context, org string, opts *ListSCIMProvisionedIdentitiesOptions) (*SCIMProvisionedIdentities, *Response, error) { u := fmt.Sprintf("scim/v2/organizations/%v/Users", org) u, err := addOptions(u, opts) @@ -105,7 +107,9 @@ func (s *SCIMService) ListSCIMProvisionedIdentities(ctx context.Context, org str // ProvisionAndInviteSCIMUser provisions organization membership for a user, and sends an activation email to the email address. // -// GitHub API docs: https://docs.github.com/en/rest/scim#provision-and-invite-a-scim-user +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/scim/scim#provision-and-invite-a-scim-user +// +//meta:operation POST /scim/v2/organizations/{org}/Users func (s *SCIMService) ProvisionAndInviteSCIMUser(ctx context.Context, org string, opts *SCIMUserAttributes) (*Response, error) { u := fmt.Sprintf("scim/v2/organizations/%v/Users", org) u, err := addOptions(u, opts) @@ -123,7 +127,9 @@ func (s *SCIMService) ProvisionAndInviteSCIMUser(ctx context.Context, org string // GetSCIMProvisioningInfoForUser returns SCIM provisioning information for a user. // -// GitHub API docs: https://docs.github.com/en/rest/scim#supported-scim-user-attributes +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/scim/scim#get-scim-provisioning-information-for-a-user +// +//meta:operation GET /scim/v2/organizations/{org}/Users/{scim_user_id} func (s *SCIMService) GetSCIMProvisioningInfoForUser(ctx context.Context, org, scimUserID string) (*SCIMUserAttributes, *Response, error) { u := fmt.Sprintf("scim/v2/organizations/%v/Users/%v", org, scimUserID) req, err := s.client.NewRequest("GET", u, nil) @@ -142,7 +148,9 @@ func (s *SCIMService) GetSCIMProvisioningInfoForUser(ctx context.Context, org, s // UpdateProvisionedOrgMembership updates a provisioned organization membership. // -// GitHub API docs: https://docs.github.com/en/rest/scim#update-a-provisioned-organization-membership +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/scim/scim#update-a-provisioned-organization-membership +// +//meta:operation PUT /scim/v2/organizations/{org}/Users/{scim_user_id} func (s *SCIMService) UpdateProvisionedOrgMembership(ctx context.Context, org, scimUserID string, opts *SCIMUserAttributes) (*Response, error) { u := fmt.Sprintf("scim/v2/organizations/%v/Users/%v", org, scimUserID) u, err := addOptions(u, opts) @@ -160,7 +168,7 @@ func (s *SCIMService) UpdateProvisionedOrgMembership(ctx context.Context, org, s // UpdateAttributeForSCIMUserOptions represents options for UpdateAttributeForSCIMUser. // -// GitHub API docs: https://docs.github.com/en/rest/scim#update-an-attribute-for-a-scim-user--parameters +// GitHub API docs: https://docs.github.com/rest/scim#update-an-attribute-for-a-scim-user--parameters type UpdateAttributeForSCIMUserOptions struct { Schemas []string `json:"schemas,omitempty"` // (Optional.) Operations UpdateAttributeForSCIMUserOperations `json:"operations"` // Set of operations to be performed. (Required.) @@ -175,7 +183,9 @@ type UpdateAttributeForSCIMUserOperations struct { // UpdateAttributeForSCIMUser updates an attribute for an SCIM user. // -// GitHub API docs: https://docs.github.com/en/rest/scim#update-an-attribute-for-a-scim-user +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/scim/scim#update-an-attribute-for-a-scim-user +// +//meta:operation PATCH /scim/v2/organizations/{org}/Users/{scim_user_id} func (s *SCIMService) UpdateAttributeForSCIMUser(ctx context.Context, org, scimUserID string, opts *UpdateAttributeForSCIMUserOptions) (*Response, error) { u := fmt.Sprintf("scim/v2/organizations/%v/Users/%v", org, scimUserID) u, err := addOptions(u, opts) @@ -193,7 +203,9 @@ func (s *SCIMService) UpdateAttributeForSCIMUser(ctx context.Context, org, scimU // DeleteSCIMUserFromOrg deletes SCIM user from an organization. // -// GitHub API docs: https://docs.github.com/en/rest/scim#delete-a-scim-user-from-an-organization +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/scim/scim#delete-a-scim-user-from-an-organization +// +//meta:operation DELETE /scim/v2/organizations/{org}/Users/{scim_user_id} func (s *SCIMService) DeleteSCIMUserFromOrg(ctx context.Context, org, scimUserID string) (*Response, error) { u := fmt.Sprintf("scim/v2/organizations/%v/Users/%v", org, scimUserID) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/search.go b/github/search.go index adb832d0d8f..71efe87a039 100644 --- a/github/search.go +++ b/github/search.go @@ -32,7 +32,7 @@ import ( // For example, querying with "language:c++" and "leveldb", then query should be // "language:c++ leveldb" but not "language:c+++leveldb". // -// GitHub API docs: https://docs.github.com/en/rest/search/ +// GitHub API docs: https://docs.github.com/rest/search/ type SearchService service // SearchOptions specifies optional parameters to the SearchService methods. @@ -72,7 +72,9 @@ type RepositoriesSearchResult struct { // Repositories searches repositories via various criteria. // -// GitHub API docs: https://docs.github.com/en/rest/search#search-repositories +// GitHub API docs: https://docs.github.com/rest/search/search#search-repositories +// +//meta:operation GET /search/repositories func (s *SearchService) Repositories(ctx context.Context, query string, opts *SearchOptions) (*RepositoriesSearchResult, *Response, error) { result := new(RepositoriesSearchResult) resp, err := s.search(ctx, "repositories", &searchParameters{Query: query}, opts, result) @@ -104,10 +106,12 @@ type TopicResult struct { } // Topics finds topics via various criteria. Results are sorted by best match. -// Please see https://help.github.com/en/articles/searching-topics for more +// Please see https://help.github.com/articles/searching-topics for more // information about search qualifiers. // -// GitHub API docs: https://docs.github.com/en/rest/search#search-topics +// GitHub API docs: https://docs.github.com/rest/search/search#search-topics +// +//meta:operation GET /search/topics func (s *SearchService) Topics(ctx context.Context, query string, opts *SearchOptions) (*TopicsSearchResult, *Response, error) { result := new(TopicsSearchResult) resp, err := s.search(ctx, "topics", &searchParameters{Query: query}, opts, result) @@ -142,7 +146,9 @@ type CommitResult struct { // Commits searches commits via various criteria. // -// GitHub API docs: https://docs.github.com/en/rest/search#search-commits +// GitHub API docs: https://docs.github.com/rest/search/search#search-commits +// +//meta:operation GET /search/commits func (s *SearchService) Commits(ctx context.Context, query string, opts *SearchOptions) (*CommitsSearchResult, *Response, error) { result := new(CommitsSearchResult) resp, err := s.search(ctx, "commits", &searchParameters{Query: query}, opts, result) @@ -162,7 +168,9 @@ type IssuesSearchResult struct { // Issues searches issues via various criteria. // -// GitHub API docs: https://docs.github.com/en/rest/search#search-issues-and-pull-requests +// GitHub API docs: https://docs.github.com/rest/search/search#search-issues-and-pull-requests +// +//meta:operation GET /search/issues func (s *SearchService) Issues(ctx context.Context, query string, opts *SearchOptions) (*IssuesSearchResult, *Response, error) { result := new(IssuesSearchResult) resp, err := s.search(ctx, "issues", &searchParameters{Query: query}, opts, result) @@ -182,7 +190,9 @@ type UsersSearchResult struct { // Users searches users via various criteria. // -// GitHub API docs: https://docs.github.com/en/rest/search#search-users +// GitHub API docs: https://docs.github.com/rest/search/search#search-users +// +//meta:operation GET /search/users func (s *SearchService) Users(ctx context.Context, query string, opts *SearchOptions) (*UsersSearchResult, *Response, error) { result := new(UsersSearchResult) resp, err := s.search(ctx, "users", &searchParameters{Query: query}, opts, result) @@ -235,7 +245,9 @@ func (c CodeResult) String() string { // Code searches code via various criteria. // -// GitHub API docs: https://docs.github.com/en/rest/search#search-code +// GitHub API docs: https://docs.github.com/rest/search/search#search-code +// +//meta:operation GET /search/code func (s *SearchService) Code(ctx context.Context, query string, opts *SearchOptions) (*CodeSearchResult, *Response, error) { result := new(CodeSearchResult) resp, err := s.search(ctx, "code", &searchParameters{Query: query}, opts, result) @@ -270,7 +282,9 @@ func (l LabelResult) String() string { // Labels searches labels in the repository with ID repoID via various criteria. // -// GitHub API docs: https://docs.github.com/en/rest/search#search-labels +// GitHub API docs: https://docs.github.com/rest/search/search#search-labels +// +//meta:operation GET /search/labels func (s *SearchService) Labels(ctx context.Context, repoID int64, query string, opts *SearchOptions) (*LabelsSearchResult, *Response, error) { result := new(LabelsSearchResult) resp, err := s.search(ctx, "labels", &searchParameters{RepositoryID: &repoID, Query: query}, opts, result) @@ -321,7 +335,7 @@ func (s *SearchService) search(ctx context.Context, searchType string, parameter // TODO: remove custom Accept header when this API fully launches. acceptHeaders = append(acceptHeaders, mediaTypeReactionsPreview) } - // https://docs.github.com/en/rest/search#search-repositories + // https://docs.github.com/rest/search#search-repositories // Accept header defaults to "application/vnd.github.v3+json" // We change it here to fetch back text-match metadata if opts != nil && opts.TextMatch { diff --git a/github/secret_scanning.go b/github/secret_scanning.go index ddcbfc1b667..9b2ad8cd0d2 100644 --- a/github/secret_scanning.go +++ b/github/secret_scanning.go @@ -72,9 +72,9 @@ type SecretScanningAlertListOptions struct { // List options can vary on the Enterprise type. // On Enterprise Cloud, Secret Scan alerts support requesting by page number // along with providing a cursor for an "after" param. - // See: https://docs.github.com/en/enterprise-cloud@latest/rest/secret-scanning#list-secret-scanning-alerts-for-an-organization + // See: https://docs.github.com/enterprise-cloud@latest/rest/secret-scanning#list-secret-scanning-alerts-for-an-organization // Whereas on Enterprise Server, pagination is by index. - // See: https://docs.github.com/en/enterprise-server@3.6/rest/secret-scanning#list-secret-scanning-alerts-for-an-organization + // See: https://docs.github.com/enterprise-server@3.6/rest/secret-scanning#list-secret-scanning-alerts-for-an-organization ListOptions } @@ -95,7 +95,9 @@ type SecretScanningAlertUpdateOptions struct { // To use this endpoint, you must be a member of the enterprise, and you must use an access token with the repo scope or // security_events scope. Alerts are only returned for organizations in the enterprise for which you are an organization owner or a security manager. // -// GitHub API docs: https://docs.github.com/en/enterprise-server@3.5/rest/secret-scanning#list-secret-scanning-alerts-for-an-enterprise +// GitHub API docs: https://docs.github.com/rest/secret-scanning/secret-scanning#list-secret-scanning-alerts-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/secret-scanning/alerts func (s *SecretScanningService) ListAlertsForEnterprise(ctx context.Context, enterprise string, opts *SecretScanningAlertListOptions) ([]*SecretScanningAlert, *Response, error) { u := fmt.Sprintf("enterprises/%v/secret-scanning/alerts", enterprise) u, err := addOptions(u, opts) @@ -122,7 +124,9 @@ func (s *SecretScanningService) ListAlertsForEnterprise(ctx context.Context, ent // To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with // the repo scope or security_events scope. // -// GitHub API docs: https://docs.github.com/en/enterprise-server@3.5/rest/secret-scanning#list-secret-scanning-alerts-for-an-organization +// GitHub API docs: https://docs.github.com/rest/secret-scanning/secret-scanning#list-secret-scanning-alerts-for-an-organization +// +//meta:operation GET /orgs/{org}/secret-scanning/alerts func (s *SecretScanningService) ListAlertsForOrg(ctx context.Context, org string, opts *SecretScanningAlertListOptions) ([]*SecretScanningAlert, *Response, error) { u := fmt.Sprintf("orgs/%v/secret-scanning/alerts", org) u, err := addOptions(u, opts) @@ -149,7 +153,9 @@ func (s *SecretScanningService) ListAlertsForOrg(ctx context.Context, org string // To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with // the repo scope or security_events scope. // -// GitHub API docs: https://docs.github.com/en/enterprise-server@3.5/rest/secret-scanning#list-secret-scanning-alerts-for-a-repository +// GitHub API docs: https://docs.github.com/rest/secret-scanning/secret-scanning#list-secret-scanning-alerts-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/secret-scanning/alerts func (s *SecretScanningService) ListAlertsForRepo(ctx context.Context, owner, repo string, opts *SecretScanningAlertListOptions) ([]*SecretScanningAlert, *Response, error) { u := fmt.Sprintf("repos/%v/%v/secret-scanning/alerts", owner, repo) u, err := addOptions(u, opts) @@ -176,7 +182,9 @@ func (s *SecretScanningService) ListAlertsForRepo(ctx context.Context, owner, re // To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with // the repo scope or security_events scope. // -// GitHub API docs: https://docs.github.com/en/enterprise-server@3.5/rest/secret-scanning#get-a-secret-scanning-alert +// GitHub API docs: https://docs.github.com/rest/secret-scanning/secret-scanning#get-a-secret-scanning-alert +// +//meta:operation GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number} func (s *SecretScanningService) GetAlert(ctx context.Context, owner, repo string, number int64) (*SecretScanningAlert, *Response, error) { u := fmt.Sprintf("repos/%v/%v/secret-scanning/alerts/%v", owner, repo, number) @@ -199,7 +207,9 @@ func (s *SecretScanningService) GetAlert(ctx context.Context, owner, repo string // To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with // the repo scope or security_events scope. // -// GitHub API docs: https://docs.github.com/en/enterprise-server@3.5/rest/secret-scanning#update-a-secret-scanning-alert +// GitHub API docs: https://docs.github.com/rest/secret-scanning/secret-scanning#update-a-secret-scanning-alert +// +//meta:operation PATCH /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number} func (s *SecretScanningService) UpdateAlert(ctx context.Context, owner, repo string, number int64, opts *SecretScanningAlertUpdateOptions) (*SecretScanningAlert, *Response, error) { u := fmt.Sprintf("repos/%v/%v/secret-scanning/alerts/%v", owner, repo, number) @@ -222,7 +232,9 @@ func (s *SecretScanningService) UpdateAlert(ctx context.Context, owner, repo str // To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with // the repo scope or security_events scope. // -// GitHub API docs: https://docs.github.com/en/enterprise-server@3.5/rest/secret-scanning#list-locations-for-a-secret-scanning-alert +// GitHub API docs: https://docs.github.com/rest/secret-scanning/secret-scanning#list-locations-for-a-secret-scanning-alert +// +//meta:operation GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}/locations func (s *SecretScanningService) ListLocationsForAlert(ctx context.Context, owner, repo string, number int64, opts *ListOptions) ([]*SecretScanningAlertLocation, *Response, error) { u := fmt.Sprintf("repos/%v/%v/secret-scanning/alerts/%v/locations", owner, repo, number) u, err := addOptions(u, opts) diff --git a/github/security_advisories.go b/github/security_advisories.go index 681d0cd4bd5..66e7dba15ac 100644 --- a/github/security_advisories.go +++ b/github/security_advisories.go @@ -50,7 +50,9 @@ type ListRepositorySecurityAdvisoriesOptions struct { // RequestCVE requests a Common Vulnerabilities and Exposures (CVE) for a repository security advisory. // The ghsaID is the GitHub Security Advisory identifier of the advisory. // -// GitHub API docs: https://docs.github.com/en/rest/security-advisories/repository-advisories#request-a-cve-for-a-repository-security-advisory +// GitHub API docs: https://docs.github.com/rest/security-advisories/repository-advisories#request-a-cve-for-a-repository-security-advisory +// +//meta:operation POST /repos/{owner}/{repo}/security-advisories/{ghsa_id}/cve func (s *SecurityAdvisoriesService) RequestCVE(ctx context.Context, owner, repo, ghsaID string) (*Response, error) { url := fmt.Sprintf("repos/%v/%v/security-advisories/%v/cve", owner, repo, ghsaID) @@ -73,7 +75,9 @@ func (s *SecurityAdvisoriesService) RequestCVE(ctx context.Context, owner, repo, // ListRepositorySecurityAdvisoriesForOrg lists the repository security advisories for an organization. // -// GitHub API docs: https://docs.github.com/en/rest/security-advisories/repository-advisories?apiVersion=2022-11-28#list-repository-security-advisories-for-an-organization +// GitHub API docs: https://docs.github.com/rest/security-advisories/repository-advisories#list-repository-security-advisories-for-an-organization +// +//meta:operation GET /orgs/{org}/security-advisories func (s *SecurityAdvisoriesService) ListRepositorySecurityAdvisoriesForOrg(ctx context.Context, org string, opt *ListRepositorySecurityAdvisoriesOptions) ([]*SecurityAdvisory, *Response, error) { url := fmt.Sprintf("orgs/%v/security-advisories", org) url, err := addOptions(url, opt) @@ -97,7 +101,9 @@ func (s *SecurityAdvisoriesService) ListRepositorySecurityAdvisoriesForOrg(ctx c // ListRepositorySecurityAdvisories lists the security advisories in a repository. // -// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/security-advisories/repository-advisories?apiVersion=2022-11-28#list-repository-security-advisories +// GitHub API docs: https://docs.github.com/rest/security-advisories/repository-advisories#list-repository-security-advisories +// +//meta:operation GET /repos/{owner}/{repo}/security-advisories func (s *SecurityAdvisoriesService) ListRepositorySecurityAdvisories(ctx context.Context, owner, repo string, opt *ListRepositorySecurityAdvisoriesOptions) ([]*SecurityAdvisory, *Response, error) { url := fmt.Sprintf("repos/%v/%v/security-advisories", owner, repo) url, err := addOptions(url, opt) diff --git a/github/teams.go b/github/teams.go index 0ee7c200792..fd22b792a66 100644 --- a/github/teams.go +++ b/github/teams.go @@ -15,7 +15,7 @@ import ( // TeamsService provides access to the team-related functions // in the GitHub API. // -// GitHub API docs: https://docs.github.com/en/rest/teams/ +// GitHub API docs: https://docs.github.com/rest/teams/ type TeamsService service // Team represents a team within a GitHub organization. Teams are used to @@ -81,7 +81,9 @@ func (i Invitation) String() string { // ListTeams lists all of the teams for an organization. // -// GitHub API docs: https://docs.github.com/en/rest/teams/teams#list-teams +// GitHub API docs: https://docs.github.com/rest/teams/teams#list-teams +// +//meta:operation GET /orgs/{org}/teams func (s *TeamsService) ListTeams(ctx context.Context, org string, opts *ListOptions) ([]*Team, *Response, error) { u := fmt.Sprintf("orgs/%v/teams", org) u, err := addOptions(u, opts) @@ -105,7 +107,9 @@ func (s *TeamsService) ListTeams(ctx context.Context, org string, opts *ListOpti // GetTeamByID fetches a team, given a specified organization ID, by ID. // -// GitHub API docs: https://docs.github.com/en/rest/teams/teams#get-a-team-by-name +// GitHub API docs: https://docs.github.com/rest/teams/teams#get-a-team-by-name +// +//meta:operation GET /orgs/{org}/teams/{team_slug} func (s *TeamsService) GetTeamByID(ctx context.Context, orgID, teamID int64) (*Team, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v", orgID, teamID) req, err := s.client.NewRequest("GET", u, nil) @@ -124,7 +128,9 @@ func (s *TeamsService) GetTeamByID(ctx context.Context, orgID, teamID int64) (*T // GetTeamBySlug fetches a team, given a specified organization name, by slug. // -// GitHub API docs: https://docs.github.com/en/rest/teams/teams#get-a-team-by-name +// GitHub API docs: https://docs.github.com/rest/teams/teams#get-a-team-by-name +// +//meta:operation GET /orgs/{org}/teams/{team_slug} func (s *TeamsService) GetTeamBySlug(ctx context.Context, org, slug string) (*Team, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v", org, slug) req, err := s.client.NewRequest("GET", u, nil) @@ -174,7 +180,9 @@ func (s NewTeam) String() string { // CreateTeam creates a new team within an organization. // -// GitHub API docs: https://docs.github.com/en/rest/teams/teams#create-a-team +// GitHub API docs: https://docs.github.com/rest/teams/teams#create-a-team +// +//meta:operation POST /orgs/{org}/teams func (s *TeamsService) CreateTeam(ctx context.Context, org string, team NewTeam) (*Team, *Response, error) { u := fmt.Sprintf("orgs/%v/teams", org) req, err := s.client.NewRequest("POST", u, team) @@ -220,7 +228,9 @@ func copyNewTeamWithoutParent(team *NewTeam) *newTeamNoParent { // EditTeamByID edits a team, given an organization ID, selected by ID. // -// GitHub API docs: https://docs.github.com/en/rest/teams/teams#update-a-team +// GitHub API docs: https://docs.github.com/rest/teams/teams#update-a-team +// +//meta:operation PATCH /orgs/{org}/teams/{team_slug} func (s *TeamsService) EditTeamByID(ctx context.Context, orgID, teamID int64, team NewTeam, removeParent bool) (*Team, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v", orgID, teamID) @@ -247,7 +257,9 @@ func (s *TeamsService) EditTeamByID(ctx context.Context, orgID, teamID int64, te // EditTeamBySlug edits a team, given an organization name, by slug. // -// GitHub API docs: https://docs.github.com/en/rest/teams/teams#update-a-team +// GitHub API docs: https://docs.github.com/rest/teams/teams#update-a-team +// +//meta:operation PATCH /orgs/{org}/teams/{team_slug} func (s *TeamsService) EditTeamBySlug(ctx context.Context, org, slug string, team NewTeam, removeParent bool) (*Team, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v", org, slug) @@ -274,7 +286,9 @@ func (s *TeamsService) EditTeamBySlug(ctx context.Context, org, slug string, tea // DeleteTeamByID deletes a team referenced by ID. // -// GitHub API docs: https://docs.github.com/en/rest/teams/teams#delete-a-team +// GitHub API docs: https://docs.github.com/rest/teams/teams#delete-a-team +// +//meta:operation DELETE /orgs/{org}/teams/{team_slug} func (s *TeamsService) DeleteTeamByID(ctx context.Context, orgID, teamID int64) (*Response, error) { u := fmt.Sprintf("organizations/%v/team/%v", orgID, teamID) req, err := s.client.NewRequest("DELETE", u, nil) @@ -287,7 +301,9 @@ func (s *TeamsService) DeleteTeamByID(ctx context.Context, orgID, teamID int64) // DeleteTeamBySlug deletes a team reference by slug. // -// GitHub API docs: https://docs.github.com/en/rest/teams/teams#delete-a-team +// GitHub API docs: https://docs.github.com/rest/teams/teams#delete-a-team +// +//meta:operation DELETE /orgs/{org}/teams/{team_slug} func (s *TeamsService) DeleteTeamBySlug(ctx context.Context, org, slug string) (*Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v", org, slug) req, err := s.client.NewRequest("DELETE", u, nil) @@ -300,7 +316,9 @@ func (s *TeamsService) DeleteTeamBySlug(ctx context.Context, org, slug string) ( // ListChildTeamsByParentID lists child teams for a parent team given parent ID. // -// GitHub API docs: https://docs.github.com/en/rest/teams/teams#list-child-teams +// GitHub API docs: https://docs.github.com/rest/teams/teams#list-child-teams +// +//meta:operation GET /orgs/{org}/teams/{team_slug}/teams func (s *TeamsService) ListChildTeamsByParentID(ctx context.Context, orgID, teamID int64, opts *ListOptions) ([]*Team, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/teams", orgID, teamID) u, err := addOptions(u, opts) @@ -324,7 +342,9 @@ func (s *TeamsService) ListChildTeamsByParentID(ctx context.Context, orgID, team // ListChildTeamsByParentSlug lists child teams for a parent team given parent slug. // -// GitHub API docs: https://docs.github.com/en/rest/teams/teams#list-child-teams +// GitHub API docs: https://docs.github.com/rest/teams/teams#list-child-teams +// +//meta:operation GET /orgs/{org}/teams/{team_slug}/teams func (s *TeamsService) ListChildTeamsByParentSlug(ctx context.Context, org, slug string, opts *ListOptions) ([]*Team, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/teams", org, slug) u, err := addOptions(u, opts) @@ -348,7 +368,9 @@ func (s *TeamsService) ListChildTeamsByParentSlug(ctx context.Context, org, slug // ListTeamReposByID lists the repositories given a team ID that the specified team has access to. // -// GitHub API docs: https://docs.github.com/en/rest/teams/teams#list-team-repositories +// GitHub API docs: https://docs.github.com/rest/teams/teams#list-team-repositories +// +//meta:operation GET /orgs/{org}/teams/{team_slug}/repos func (s *TeamsService) ListTeamReposByID(ctx context.Context, orgID, teamID int64, opts *ListOptions) ([]*Repository, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/repos", orgID, teamID) u, err := addOptions(u, opts) @@ -376,7 +398,9 @@ func (s *TeamsService) ListTeamReposByID(ctx context.Context, orgID, teamID int6 // ListTeamReposBySlug lists the repositories given a team slug that the specified team has access to. // -// GitHub API docs: https://docs.github.com/en/rest/teams/teams#list-team-repositories +// GitHub API docs: https://docs.github.com/rest/teams/teams#list-team-repositories +// +//meta:operation GET /orgs/{org}/teams/{team_slug}/repos func (s *TeamsService) ListTeamReposBySlug(ctx context.Context, org, slug string, opts *ListOptions) ([]*Repository, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/repos", org, slug) u, err := addOptions(u, opts) @@ -406,7 +430,9 @@ func (s *TeamsService) ListTeamReposBySlug(ctx context.Context, org, slug string // repository is managed by team, a Repository is returned which includes the // permissions team has for that repo. // -// GitHub API docs: https://docs.github.com/en/rest/teams/teams#check-team-permissions-for-a-repository +// GitHub API docs: https://docs.github.com/rest/teams/teams#check-team-permissions-for-a-repository +// +//meta:operation GET /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} func (s *TeamsService) IsTeamRepoByID(ctx context.Context, orgID, teamID int64, owner, repo string) (*Repository, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/repos/%v/%v", orgID, teamID, owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -430,7 +456,9 @@ func (s *TeamsService) IsTeamRepoByID(ctx context.Context, orgID, teamID int64, // repository is managed by team, a Repository is returned which includes the // permissions team has for that repo. // -// GitHub API docs: https://docs.github.com/en/rest/teams/teams#check-team-permissions-for-a-repository +// GitHub API docs: https://docs.github.com/rest/teams/teams#check-team-permissions-for-a-repository +// +//meta:operation GET /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} func (s *TeamsService) IsTeamRepoBySlug(ctx context.Context, org, slug, owner, repo string) (*Repository, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/repos/%v/%v", org, slug, owner, repo) req, err := s.client.NewRequest("GET", u, nil) @@ -469,7 +497,9 @@ type TeamAddTeamRepoOptions struct { // The specified repository must be owned by the organization to which the team // belongs, or a direct fork of a repository owned by the organization. // -// GitHub API docs: https://docs.github.com/en/rest/teams/teams#add-or-update-team-repository-permissions +// GitHub API docs: https://docs.github.com/rest/teams/teams#add-or-update-team-repository-permissions +// +//meta:operation PUT /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} func (s *TeamsService) AddTeamRepoByID(ctx context.Context, orgID, teamID int64, owner, repo string, opts *TeamAddTeamRepoOptions) (*Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/repos/%v/%v", orgID, teamID, owner, repo) req, err := s.client.NewRequest("PUT", u, opts) @@ -484,7 +514,9 @@ func (s *TeamsService) AddTeamRepoByID(ctx context.Context, orgID, teamID int64, // The specified repository must be owned by the organization to which the team // belongs, or a direct fork of a repository owned by the organization. // -// GitHub API docs: https://docs.github.com/en/rest/teams/teams#add-or-update-team-repository-permissions +// GitHub API docs: https://docs.github.com/rest/teams/teams#add-or-update-team-repository-permissions +// +//meta:operation PUT /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} func (s *TeamsService) AddTeamRepoBySlug(ctx context.Context, org, slug, owner, repo string, opts *TeamAddTeamRepoOptions) (*Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/repos/%v/%v", org, slug, owner, repo) req, err := s.client.NewRequest("PUT", u, opts) @@ -499,7 +531,9 @@ func (s *TeamsService) AddTeamRepoBySlug(ctx context.Context, org, slug, owner, // team given the team ID. Note that this does not delete the repository, it // just removes it from the team. // -// GitHub API docs: https://docs.github.com/en/rest/teams/teams#remove-a-repository-from-a-team +// GitHub API docs: https://docs.github.com/rest/teams/teams#remove-a-repository-from-a-team +// +//meta:operation DELETE /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} func (s *TeamsService) RemoveTeamRepoByID(ctx context.Context, orgID, teamID int64, owner, repo string) (*Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/repos/%v/%v", orgID, teamID, owner, repo) req, err := s.client.NewRequest("DELETE", u, nil) @@ -514,7 +548,9 @@ func (s *TeamsService) RemoveTeamRepoByID(ctx context.Context, orgID, teamID int // team given the team slug. Note that this does not delete the repository, it // just removes it from the team. // -// GitHub API docs: https://docs.github.com/en/rest/teams/teams#remove-a-repository-from-a-team +// GitHub API docs: https://docs.github.com/rest/teams/teams#remove-a-repository-from-a-team +// +//meta:operation DELETE /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} func (s *TeamsService) RemoveTeamRepoBySlug(ctx context.Context, org, slug, owner, repo string) (*Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/repos/%v/%v", org, slug, owner, repo) req, err := s.client.NewRequest("DELETE", u, nil) @@ -526,7 +562,10 @@ func (s *TeamsService) RemoveTeamRepoBySlug(ctx context.Context, org, slug, owne } // ListUserTeams lists a user's teams -// GitHub API docs: https://docs.github.com/en/rest/teams/teams#list-teams-for-the-authenticated-user +// +// GitHub API docs: https://docs.github.com/rest/teams/teams#list-teams-for-the-authenticated-user +// +//meta:operation GET /user/teams func (s *TeamsService) ListUserTeams(ctx context.Context, opts *ListOptions) ([]*Team, *Response, error) { u := "user/teams" u, err := addOptions(u, opts) @@ -550,7 +589,9 @@ func (s *TeamsService) ListUserTeams(ctx context.Context, opts *ListOptions) ([] // ListTeamProjectsByID lists the organization projects for a team given the team ID. // -// GitHub API docs: https://docs.github.com/en/rest/teams/teams#list-team-projects +// GitHub API docs: https://docs.github.com/rest/teams/teams#list-team-projects +// +//meta:operation GET /orgs/{org}/teams/{team_slug}/projects func (s *TeamsService) ListTeamProjectsByID(ctx context.Context, orgID, teamID int64) ([]*Project, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/projects", orgID, teamID) @@ -574,7 +615,9 @@ func (s *TeamsService) ListTeamProjectsByID(ctx context.Context, orgID, teamID i // ListTeamProjectsBySlug lists the organization projects for a team given the team slug. // -// GitHub API docs: https://docs.github.com/en/rest/teams/teams#list-team-projects +// GitHub API docs: https://docs.github.com/rest/teams/teams#list-team-projects +// +//meta:operation GET /orgs/{org}/teams/{team_slug}/projects func (s *TeamsService) ListTeamProjectsBySlug(ctx context.Context, org, slug string) ([]*Project, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/projects", org, slug) @@ -599,7 +642,9 @@ func (s *TeamsService) ListTeamProjectsBySlug(ctx context.Context, org, slug str // ReviewTeamProjectsByID checks whether a team, given its ID, has read, write, or admin // permissions for an organization project. // -// GitHub API docs: https://docs.github.com/en/rest/teams/teams#check-team-permissions-for-a-project +// GitHub API docs: https://docs.github.com/rest/teams/teams#check-team-permissions-for-a-project +// +//meta:operation GET /orgs/{org}/teams/{team_slug}/projects/{project_id} func (s *TeamsService) ReviewTeamProjectsByID(ctx context.Context, orgID, teamID, projectID int64) (*Project, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/projects/%v", orgID, teamID, projectID) req, err := s.client.NewRequest("GET", u, nil) @@ -623,7 +668,9 @@ func (s *TeamsService) ReviewTeamProjectsByID(ctx context.Context, orgID, teamID // ReviewTeamProjectsBySlug checks whether a team, given its slug, has read, write, or admin // permissions for an organization project. // -// GitHub API docs: https://docs.github.com/en/rest/teams/teams#check-team-permissions-for-a-project +// GitHub API docs: https://docs.github.com/rest/teams/teams#check-team-permissions-for-a-project +// +//meta:operation GET /orgs/{org}/teams/{team_slug}/projects/{project_id} func (s *TeamsService) ReviewTeamProjectsBySlug(ctx context.Context, org, slug string, projectID int64) (*Project, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/projects/%v", org, slug, projectID) req, err := s.client.NewRequest("GET", u, nil) @@ -660,7 +707,9 @@ type TeamProjectOptions struct { // To add a project to a team or update the team's permission on a project, the // authenticated user must have admin permissions for the project. // -// GitHub API docs: https://docs.github.com/en/rest/teams/teams#add-or-update-team-project-permissions +// GitHub API docs: https://docs.github.com/rest/teams/teams#add-or-update-team-project-permissions +// +//meta:operation PUT /orgs/{org}/teams/{team_slug}/projects/{project_id} func (s *TeamsService) AddTeamProjectByID(ctx context.Context, orgID, teamID, projectID int64, opts *TeamProjectOptions) (*Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/projects/%v", orgID, teamID, projectID) req, err := s.client.NewRequest("PUT", u, opts) @@ -679,7 +728,9 @@ func (s *TeamsService) AddTeamProjectByID(ctx context.Context, orgID, teamID, pr // To add a project to a team or update the team's permission on a project, the // authenticated user must have admin permissions for the project. // -// GitHub API docs: https://docs.github.com/en/rest/teams/teams#add-or-update-team-project-permissions +// GitHub API docs: https://docs.github.com/rest/teams/teams#add-or-update-team-project-permissions +// +//meta:operation PUT /orgs/{org}/teams/{team_slug}/projects/{project_id} func (s *TeamsService) AddTeamProjectBySlug(ctx context.Context, org, slug string, projectID int64, opts *TeamProjectOptions) (*Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/projects/%v", org, slug, projectID) req, err := s.client.NewRequest("PUT", u, opts) @@ -701,7 +752,9 @@ func (s *TeamsService) AddTeamProjectBySlug(ctx context.Context, org, slug strin // or project. // Note: This endpoint removes the project from the team, but does not delete it. // -// GitHub API docs: https://docs.github.com/en/rest/teams/teams#remove-a-project-from-a-team +// GitHub API docs: https://docs.github.com/rest/teams/teams#remove-a-project-from-a-team +// +//meta:operation DELETE /orgs/{org}/teams/{team_slug}/projects/{project_id} func (s *TeamsService) RemoveTeamProjectByID(ctx context.Context, orgID, teamID, projectID int64) (*Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/projects/%v", orgID, teamID, projectID) req, err := s.client.NewRequest("DELETE", u, nil) @@ -723,7 +776,9 @@ func (s *TeamsService) RemoveTeamProjectByID(ctx context.Context, orgID, teamID, // or project. // Note: This endpoint removes the project from the team, but does not delete it. // -// GitHub API docs: https://docs.github.com/en/rest/teams/teams#remove-a-project-from-a-team +// GitHub API docs: https://docs.github.com/rest/teams/teams#remove-a-project-from-a-team +// +//meta:operation DELETE /orgs/{org}/teams/{team_slug}/projects/{project_id} func (s *TeamsService) RemoveTeamProjectBySlug(ctx context.Context, org, slug string, projectID int64) (*Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/projects/%v", org, slug, projectID) req, err := s.client.NewRequest("DELETE", u, nil) @@ -752,7 +807,9 @@ type IDPGroup struct { // ListIDPGroupsInOrganization lists IDP groups available in an organization. // -// GitHub API docs: https://docs.github.com/en/rest/teams/team-sync#list-idp-groups-for-an-organization +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/team-sync#list-idp-groups-for-an-organization +// +//meta:operation GET /orgs/{org}/team-sync/groups func (s *TeamsService) ListIDPGroupsInOrganization(ctx context.Context, org string, opts *ListCursorOptions) (*IDPGroupList, *Response, error) { u := fmt.Sprintf("orgs/%v/team-sync/groups", org) u, err := addOptions(u, opts) @@ -777,7 +834,9 @@ func (s *TeamsService) ListIDPGroupsInOrganization(ctx context.Context, org stri // ListIDPGroupsForTeamByID lists IDP groups connected to a team on GitHub // given organization and team IDs. // -// GitHub API docs: https://docs.github.com/en/rest/teams/team-sync#list-idp-groups-for-a-team +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/team-sync#list-idp-groups-for-a-team +// +//meta:operation GET /orgs/{org}/teams/{team_slug}/team-sync/group-mappings func (s *TeamsService) ListIDPGroupsForTeamByID(ctx context.Context, orgID, teamID int64) (*IDPGroupList, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/team-sync/group-mappings", orgID, teamID) @@ -798,7 +857,9 @@ func (s *TeamsService) ListIDPGroupsForTeamByID(ctx context.Context, orgID, team // ListIDPGroupsForTeamBySlug lists IDP groups connected to a team on GitHub // given organization name and team slug. // -// GitHub API docs: https://docs.github.com/en/rest/teams/team-sync#list-idp-groups-for-a-team +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/team-sync#list-idp-groups-for-a-team +// +//meta:operation GET /orgs/{org}/teams/{team_slug}/team-sync/group-mappings func (s *TeamsService) ListIDPGroupsForTeamBySlug(ctx context.Context, org, slug string) (*IDPGroupList, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/team-sync/group-mappings", org, slug) @@ -819,7 +880,9 @@ func (s *TeamsService) ListIDPGroupsForTeamBySlug(ctx context.Context, org, slug // CreateOrUpdateIDPGroupConnectionsByID creates, updates, or removes a connection // between a team and an IDP group given organization and team IDs. // -// GitHub API docs: https://docs.github.com/en/rest/teams/team-sync#create-or-update-idp-group-connections +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/team-sync#create-or-update-idp-group-connections +// +//meta:operation PATCH /orgs/{org}/teams/{team_slug}/team-sync/group-mappings func (s *TeamsService) CreateOrUpdateIDPGroupConnectionsByID(ctx context.Context, orgID, teamID int64, opts IDPGroupList) (*IDPGroupList, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/team-sync/group-mappings", orgID, teamID) @@ -840,7 +903,9 @@ func (s *TeamsService) CreateOrUpdateIDPGroupConnectionsByID(ctx context.Context // CreateOrUpdateIDPGroupConnectionsBySlug creates, updates, or removes a connection // between a team and an IDP group given organization name and team slug. // -// GitHub API docs: https://docs.github.com/en/rest/teams/team-sync#create-or-update-idp-group-connections +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/team-sync#create-or-update-idp-group-connections +// +//meta:operation PATCH /orgs/{org}/teams/{team_slug}/team-sync/group-mappings func (s *TeamsService) CreateOrUpdateIDPGroupConnectionsBySlug(ctx context.Context, org, slug string, opts IDPGroupList) (*IDPGroupList, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/team-sync/group-mappings", org, slug) @@ -888,7 +953,9 @@ type ExternalGroupList struct { // GetExternalGroup fetches an external group. // -// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/teams/external-groups#get-an-external-group +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/external-groups#get-an-external-group +// +//meta:operation GET /orgs/{org}/external-group/{group_id} func (s *TeamsService) GetExternalGroup(ctx context.Context, org string, groupID int64) (*ExternalGroup, *Response, error) { u := fmt.Sprintf("orgs/%v/external-group/%v", org, groupID) req, err := s.client.NewRequest("GET", u, nil) @@ -915,7 +982,9 @@ type ListExternalGroupsOptions struct { // ListExternalGroups lists external groups in an organization on GitHub. // -// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/teams/external-groups#list-external-groups-in-an-organization +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/external-groups#list-external-groups-in-an-organization +// +//meta:operation GET /orgs/{org}/external-groups func (s *TeamsService) ListExternalGroups(ctx context.Context, org string, opts *ListExternalGroupsOptions) (*ExternalGroupList, *Response, error) { u := fmt.Sprintf("orgs/%v/external-groups", org) u, err := addOptions(u, opts) @@ -939,7 +1008,9 @@ func (s *TeamsService) ListExternalGroups(ctx context.Context, org string, opts // ListExternalGroupsForTeamBySlug lists external groups connected to a team on GitHub. // -// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/teams/external-groups#list-a-connection-between-an-external-group-and-a-team +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/external-groups#list-a-connection-between-an-external-group-and-a-team +// +//meta:operation GET /orgs/{org}/teams/{team_slug}/external-groups func (s *TeamsService) ListExternalGroupsForTeamBySlug(ctx context.Context, org, slug string) (*ExternalGroupList, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/external-groups", org, slug) @@ -959,7 +1030,9 @@ func (s *TeamsService) ListExternalGroupsForTeamBySlug(ctx context.Context, org, // UpdateConnectedExternalGroup updates the connection between an external group and a team. // -// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/teams/external-groups#update-the-connection-between-an-external-group-and-a-team +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/external-groups#update-the-connection-between-an-external-group-and-a-team +// +//meta:operation PATCH /orgs/{org}/teams/{team_slug}/external-groups func (s *TeamsService) UpdateConnectedExternalGroup(ctx context.Context, org, slug string, eg *ExternalGroup) (*ExternalGroup, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/external-groups", org, slug) @@ -979,7 +1052,9 @@ func (s *TeamsService) UpdateConnectedExternalGroup(ctx context.Context, org, sl // RemoveConnectedExternalGroup removes the connection between an external group and a team. // -// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/teams/external-groups#remove-the-connection-between-an-external-group-and-a-team +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/teams/external-groups#remove-the-connection-between-an-external-group-and-a-team +// +//meta:operation DELETE /orgs/{org}/teams/{team_slug}/external-groups func (s *TeamsService) RemoveConnectedExternalGroup(ctx context.Context, org, slug string) (*Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/external-groups", org, slug) diff --git a/github/teams_discussion_comments.go b/github/teams_discussion_comments.go index f3a1cc4dc00..ad3818c13fb 100644 --- a/github/teams_discussion_comments.go +++ b/github/teams_discussion_comments.go @@ -43,7 +43,9 @@ type DiscussionCommentListOptions struct { // ListCommentsByID lists all comments on a team discussion by team ID. // Authenticated user must grant read:discussion scope. // -// GitHub API docs: https://docs.github.com/en/rest/teams/discussion-comments#list-discussion-comments +// GitHub API docs: https://docs.github.com/rest/teams/discussion-comments#list-discussion-comments +// +//meta:operation GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments func (s *TeamsService) ListCommentsByID(ctx context.Context, orgID, teamID int64, discussionNumber int, options *DiscussionCommentListOptions) ([]*DiscussionComment, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments", orgID, teamID, discussionNumber) u, err := addOptions(u, options) @@ -68,7 +70,9 @@ func (s *TeamsService) ListCommentsByID(ctx context.Context, orgID, teamID int64 // ListCommentsBySlug lists all comments on a team discussion by team slug. // Authenticated user must grant read:discussion scope. // -// GitHub API docs: https://docs.github.com/en/rest/teams/discussion-comments#list-discussion-comments +// GitHub API docs: https://docs.github.com/rest/teams/discussion-comments#list-discussion-comments +// +//meta:operation GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments func (s *TeamsService) ListCommentsBySlug(ctx context.Context, org, slug string, discussionNumber int, options *DiscussionCommentListOptions) ([]*DiscussionComment, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments", org, slug, discussionNumber) u, err := addOptions(u, options) @@ -93,7 +97,9 @@ func (s *TeamsService) ListCommentsBySlug(ctx context.Context, org, slug string, // GetCommentByID gets a specific comment on a team discussion by team ID. // Authenticated user must grant read:discussion scope. // -// GitHub API docs: https://docs.github.com/en/rest/teams/discussion-comments#get-a-discussion-comment +// GitHub API docs: https://docs.github.com/rest/teams/discussion-comments#get-a-discussion-comment +// +//meta:operation GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number} func (s *TeamsService) GetCommentByID(ctx context.Context, orgID, teamID int64, discussionNumber, commentNumber int) (*DiscussionComment, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments/%v", orgID, teamID, discussionNumber, commentNumber) req, err := s.client.NewRequest("GET", u, nil) @@ -113,7 +119,9 @@ func (s *TeamsService) GetCommentByID(ctx context.Context, orgID, teamID int64, // GetCommentBySlug gets a specific comment on a team discussion by team slug. // Authenticated user must grant read:discussion scope. // -// GitHub API docs: https://docs.github.com/en/rest/teams/discussion-comments#get-a-discussion-comment +// GitHub API docs: https://docs.github.com/rest/teams/discussion-comments#get-a-discussion-comment +// +//meta:operation GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number} func (s *TeamsService) GetCommentBySlug(ctx context.Context, org, slug string, discussionNumber, commentNumber int) (*DiscussionComment, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments/%v", org, slug, discussionNumber, commentNumber) @@ -134,7 +142,9 @@ func (s *TeamsService) GetCommentBySlug(ctx context.Context, org, slug string, d // CreateCommentByID creates a new comment on a team discussion by team ID. // Authenticated user must grant write:discussion scope. // -// GitHub API docs: https://docs.github.com/en/rest/teams/discussion-comments#create-a-discussion-comment +// GitHub API docs: https://docs.github.com/rest/teams/discussion-comments#create-a-discussion-comment +// +//meta:operation POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments func (s *TeamsService) CreateCommentByID(ctx context.Context, orgID, teamID int64, discsusionNumber int, comment DiscussionComment) (*DiscussionComment, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments", orgID, teamID, discsusionNumber) req, err := s.client.NewRequest("POST", u, comment) @@ -154,7 +164,9 @@ func (s *TeamsService) CreateCommentByID(ctx context.Context, orgID, teamID int6 // CreateCommentBySlug creates a new comment on a team discussion by team slug. // Authenticated user must grant write:discussion scope. // -// GitHub API docs: https://docs.github.com/en/rest/teams/discussion-comments#create-a-discussion-comment +// GitHub API docs: https://docs.github.com/rest/teams/discussion-comments#create-a-discussion-comment +// +//meta:operation POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments func (s *TeamsService) CreateCommentBySlug(ctx context.Context, org, slug string, discsusionNumber int, comment DiscussionComment) (*DiscussionComment, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments", org, slug, discsusionNumber) req, err := s.client.NewRequest("POST", u, comment) @@ -175,7 +187,9 @@ func (s *TeamsService) CreateCommentBySlug(ctx context.Context, org, slug string // Authenticated user must grant write:discussion scope. // User is allowed to edit body of a comment only. // -// GitHub API docs: https://docs.github.com/en/rest/teams/discussion-comments#update-a-discussion-comment +// GitHub API docs: https://docs.github.com/rest/teams/discussion-comments#update-a-discussion-comment +// +//meta:operation PATCH /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number} func (s *TeamsService) EditCommentByID(ctx context.Context, orgID, teamID int64, discussionNumber, commentNumber int, comment DiscussionComment) (*DiscussionComment, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments/%v", orgID, teamID, discussionNumber, commentNumber) req, err := s.client.NewRequest("PATCH", u, comment) @@ -196,7 +210,9 @@ func (s *TeamsService) EditCommentByID(ctx context.Context, orgID, teamID int64, // Authenticated user must grant write:discussion scope. // User is allowed to edit body of a comment only. // -// GitHub API docs: https://docs.github.com/en/rest/teams/discussion-comments#update-a-discussion-comment +// GitHub API docs: https://docs.github.com/rest/teams/discussion-comments#update-a-discussion-comment +// +//meta:operation PATCH /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number} func (s *TeamsService) EditCommentBySlug(ctx context.Context, org, slug string, discussionNumber, commentNumber int, comment DiscussionComment) (*DiscussionComment, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments/%v", org, slug, discussionNumber, commentNumber) req, err := s.client.NewRequest("PATCH", u, comment) @@ -216,7 +232,9 @@ func (s *TeamsService) EditCommentBySlug(ctx context.Context, org, slug string, // DeleteCommentByID deletes a comment on a team discussion by team ID. // Authenticated user must grant write:discussion scope. // -// GitHub API docs: https://docs.github.com/en/rest/teams/discussion-comments#delete-a-discussion-comment +// GitHub API docs: https://docs.github.com/rest/teams/discussion-comments#delete-a-discussion-comment +// +//meta:operation DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number} func (s *TeamsService) DeleteCommentByID(ctx context.Context, orgID, teamID int64, discussionNumber, commentNumber int) (*Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments/%v", orgID, teamID, discussionNumber, commentNumber) req, err := s.client.NewRequest("DELETE", u, nil) @@ -230,7 +248,9 @@ func (s *TeamsService) DeleteCommentByID(ctx context.Context, orgID, teamID int6 // DeleteCommentBySlug deletes a comment on a team discussion by team slug. // Authenticated user must grant write:discussion scope. // -// GitHub API docs: https://docs.github.com/en/rest/teams/discussion-comments#delete-a-discussion-comment +// GitHub API docs: https://docs.github.com/rest/teams/discussion-comments#delete-a-discussion-comment +// +//meta:operation DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number} func (s *TeamsService) DeleteCommentBySlug(ctx context.Context, org, slug string, discussionNumber, commentNumber int) (*Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments/%v", org, slug, discussionNumber, commentNumber) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/teams_discussions.go b/github/teams_discussions.go index 69a3ebd51ff..ee78c032a61 100644 --- a/github/teams_discussions.go +++ b/github/teams_discussions.go @@ -49,7 +49,9 @@ type DiscussionListOptions struct { // ListDiscussionsByID lists all discussions on team's page given Organization and Team ID. // Authenticated user must grant read:discussion scope. // -// GitHub API docs: https://docs.github.com/en/rest/teams/discussions#list-discussions +// GitHub API docs: https://docs.github.com/rest/teams/discussions#list-discussions +// +//meta:operation GET /orgs/{org}/teams/{team_slug}/discussions func (s *TeamsService) ListDiscussionsByID(ctx context.Context, orgID, teamID int64, opts *DiscussionListOptions) ([]*TeamDiscussion, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/discussions", orgID, teamID) u, err := addOptions(u, opts) @@ -74,7 +76,9 @@ func (s *TeamsService) ListDiscussionsByID(ctx context.Context, orgID, teamID in // ListDiscussionsBySlug lists all discussions on team's page given Organization name and Team's slug. // Authenticated user must grant read:discussion scope. // -// GitHub API docs: https://docs.github.com/en/rest/teams/discussions#list-discussions +// GitHub API docs: https://docs.github.com/rest/teams/discussions#list-discussions +// +//meta:operation GET /orgs/{org}/teams/{team_slug}/discussions func (s *TeamsService) ListDiscussionsBySlug(ctx context.Context, org, slug string, opts *DiscussionListOptions) ([]*TeamDiscussion, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions", org, slug) u, err := addOptions(u, opts) @@ -99,7 +103,9 @@ func (s *TeamsService) ListDiscussionsBySlug(ctx context.Context, org, slug stri // GetDiscussionByID gets a specific discussion on a team's page given Organization and Team ID. // Authenticated user must grant read:discussion scope. // -// GitHub API docs: https://docs.github.com/en/rest/teams/discussions#get-a-discussion +// GitHub API docs: https://docs.github.com/rest/teams/discussions#get-a-discussion +// +//meta:operation GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number} func (s *TeamsService) GetDiscussionByID(ctx context.Context, orgID, teamID int64, discussionNumber int) (*TeamDiscussion, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v", orgID, teamID, discussionNumber) req, err := s.client.NewRequest("GET", u, nil) @@ -119,7 +125,9 @@ func (s *TeamsService) GetDiscussionByID(ctx context.Context, orgID, teamID int6 // GetDiscussionBySlug gets a specific discussion on a team's page given Organization name and Team's slug. // Authenticated user must grant read:discussion scope. // -// GitHub API docs: https://docs.github.com/en/rest/teams/discussions#get-a-discussion +// GitHub API docs: https://docs.github.com/rest/teams/discussions#get-a-discussion +// +//meta:operation GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number} func (s *TeamsService) GetDiscussionBySlug(ctx context.Context, org, slug string, discussionNumber int) (*TeamDiscussion, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v", org, slug, discussionNumber) req, err := s.client.NewRequest("GET", u, nil) @@ -139,7 +147,9 @@ func (s *TeamsService) GetDiscussionBySlug(ctx context.Context, org, slug string // CreateDiscussionByID creates a new discussion post on a team's page given Organization and Team ID. // Authenticated user must grant write:discussion scope. // -// GitHub API docs: https://docs.github.com/en/rest/teams/discussions#create-a-discussion +// GitHub API docs: https://docs.github.com/rest/teams/discussions#create-a-discussion +// +//meta:operation POST /orgs/{org}/teams/{team_slug}/discussions func (s *TeamsService) CreateDiscussionByID(ctx context.Context, orgID, teamID int64, discussion TeamDiscussion) (*TeamDiscussion, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/discussions", orgID, teamID) req, err := s.client.NewRequest("POST", u, discussion) @@ -159,7 +169,9 @@ func (s *TeamsService) CreateDiscussionByID(ctx context.Context, orgID, teamID i // CreateDiscussionBySlug creates a new discussion post on a team's page given Organization name and Team's slug. // Authenticated user must grant write:discussion scope. // -// GitHub API docs: https://docs.github.com/en/rest/teams/discussions#create-a-discussion +// GitHub API docs: https://docs.github.com/rest/teams/discussions#create-a-discussion +// +//meta:operation POST /orgs/{org}/teams/{team_slug}/discussions func (s *TeamsService) CreateDiscussionBySlug(ctx context.Context, org, slug string, discussion TeamDiscussion) (*TeamDiscussion, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions", org, slug) req, err := s.client.NewRequest("POST", u, discussion) @@ -180,7 +192,9 @@ func (s *TeamsService) CreateDiscussionBySlug(ctx context.Context, org, slug str // Authenticated user must grant write:discussion scope. // User is allowed to change Title and Body of a discussion only. // -// GitHub API docs: https://docs.github.com/en/rest/teams/discussions#update-a-discussion +// GitHub API docs: https://docs.github.com/rest/teams/discussions#update-a-discussion +// +//meta:operation PATCH /orgs/{org}/teams/{team_slug}/discussions/{discussion_number} func (s *TeamsService) EditDiscussionByID(ctx context.Context, orgID, teamID int64, discussionNumber int, discussion TeamDiscussion) (*TeamDiscussion, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v", orgID, teamID, discussionNumber) req, err := s.client.NewRequest("PATCH", u, discussion) @@ -201,7 +215,9 @@ func (s *TeamsService) EditDiscussionByID(ctx context.Context, orgID, teamID int // Authenticated user must grant write:discussion scope. // User is allowed to change Title and Body of a discussion only. // -// GitHub API docs: https://docs.github.com/en/rest/teams/discussions#update-a-discussion +// GitHub API docs: https://docs.github.com/rest/teams/discussions#update-a-discussion +// +//meta:operation PATCH /orgs/{org}/teams/{team_slug}/discussions/{discussion_number} func (s *TeamsService) EditDiscussionBySlug(ctx context.Context, org, slug string, discussionNumber int, discussion TeamDiscussion) (*TeamDiscussion, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v", org, slug, discussionNumber) req, err := s.client.NewRequest("PATCH", u, discussion) @@ -221,7 +237,9 @@ func (s *TeamsService) EditDiscussionBySlug(ctx context.Context, org, slug strin // DeleteDiscussionByID deletes a discussion from team's page given Organization and Team ID. // Authenticated user must grant write:discussion scope. // -// GitHub API docs: https://docs.github.com/en/rest/teams/discussions#delete-a-discussion +// GitHub API docs: https://docs.github.com/rest/teams/discussions#delete-a-discussion +// +//meta:operation DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number} func (s *TeamsService) DeleteDiscussionByID(ctx context.Context, orgID, teamID int64, discussionNumber int) (*Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/discussions/%v", orgID, teamID, discussionNumber) req, err := s.client.NewRequest("DELETE", u, nil) @@ -235,7 +253,9 @@ func (s *TeamsService) DeleteDiscussionByID(ctx context.Context, orgID, teamID i // DeleteDiscussionBySlug deletes a discussion from team's page given Organization name and Team's slug. // Authenticated user must grant write:discussion scope. // -// GitHub API docs: https://docs.github.com/en/rest/teams/discussions#delete-a-discussion +// GitHub API docs: https://docs.github.com/rest/teams/discussions#delete-a-discussion +// +//meta:operation DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number} func (s *TeamsService) DeleteDiscussionBySlug(ctx context.Context, org, slug string, discussionNumber int) (*Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v", org, slug, discussionNumber) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/teams_members.go b/github/teams_members.go index 58cb79744e1..059d993a3e6 100644 --- a/github/teams_members.go +++ b/github/teams_members.go @@ -23,7 +23,9 @@ type TeamListTeamMembersOptions struct { // ListTeamMembersByID lists all of the users who are members of a team, given a specified // organization ID, by team ID. // -// GitHub API docs: https://docs.github.com/en/rest/teams/members#list-team-members +// GitHub API docs: https://docs.github.com/rest/teams/members#list-team-members +// +//meta:operation GET /orgs/{org}/teams/{team_slug}/members func (s *TeamsService) ListTeamMembersByID(ctx context.Context, orgID, teamID int64, opts *TeamListTeamMembersOptions) ([]*User, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/members", orgID, teamID) u, err := addOptions(u, opts) @@ -48,7 +50,9 @@ func (s *TeamsService) ListTeamMembersByID(ctx context.Context, orgID, teamID in // ListTeamMembersBySlug lists all of the users who are members of a team, given a specified // organization name, by team slug. // -// GitHub API docs: https://docs.github.com/en/rest/teams/members#list-team-members +// GitHub API docs: https://docs.github.com/rest/teams/members#list-team-members +// +//meta:operation GET /orgs/{org}/teams/{team_slug}/members func (s *TeamsService) ListTeamMembersBySlug(ctx context.Context, org, slug string, opts *TeamListTeamMembersOptions) ([]*User, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/members", org, slug) u, err := addOptions(u, opts) @@ -73,7 +77,9 @@ func (s *TeamsService) ListTeamMembersBySlug(ctx context.Context, org, slug stri // GetTeamMembershipByID returns the membership status for a user in a team, given a specified // organization ID, by team ID. // -// GitHub API docs: https://docs.github.com/en/rest/teams/members#list-team-members +// GitHub API docs: https://docs.github.com/rest/teams/members#list-team-members +// +//meta:operation GET /orgs/{org}/teams/{team_slug}/members func (s *TeamsService) GetTeamMembershipByID(ctx context.Context, orgID, teamID int64, user string) (*Membership, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/memberships/%v", orgID, teamID, user) req, err := s.client.NewRequest("GET", u, nil) @@ -93,7 +99,9 @@ func (s *TeamsService) GetTeamMembershipByID(ctx context.Context, orgID, teamID // GetTeamMembershipBySlug returns the membership status for a user in a team, given a specified // organization name, by team slug. // -// GitHub API docs: https://docs.github.com/en/rest/teams/members#get-team-membership-for-a-user +// GitHub API docs: https://docs.github.com/rest/teams/members#get-team-membership-for-a-user +// +//meta:operation GET /orgs/{org}/teams/{team_slug}/memberships/{username} func (s *TeamsService) GetTeamMembershipBySlug(ctx context.Context, org, slug, user string) (*Membership, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/memberships/%v", org, slug, user) req, err := s.client.NewRequest("GET", u, nil) @@ -127,7 +135,9 @@ type TeamAddTeamMembershipOptions struct { // AddTeamMembershipByID adds or invites a user to a team, given a specified // organization ID, by team ID. // -// GitHub API docs: https://docs.github.com/en/rest/teams/members#add-or-update-team-membership-for-a-user +// GitHub API docs: https://docs.github.com/rest/teams/members#add-or-update-team-membership-for-a-user +// +//meta:operation PUT /orgs/{org}/teams/{team_slug}/memberships/{username} func (s *TeamsService) AddTeamMembershipByID(ctx context.Context, orgID, teamID int64, user string, opts *TeamAddTeamMembershipOptions) (*Membership, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/memberships/%v", orgID, teamID, user) req, err := s.client.NewRequest("PUT", u, opts) @@ -147,7 +157,9 @@ func (s *TeamsService) AddTeamMembershipByID(ctx context.Context, orgID, teamID // AddTeamMembershipBySlug adds or invites a user to a team, given a specified // organization name, by team slug. // -// GitHub API docs: https://docs.github.com/en/rest/teams/members#add-or-update-team-membership-for-a-user +// GitHub API docs: https://docs.github.com/rest/teams/members#add-or-update-team-membership-for-a-user +// +//meta:operation PUT /orgs/{org}/teams/{team_slug}/memberships/{username} func (s *TeamsService) AddTeamMembershipBySlug(ctx context.Context, org, slug, user string, opts *TeamAddTeamMembershipOptions) (*Membership, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/memberships/%v", org, slug, user) req, err := s.client.NewRequest("PUT", u, opts) @@ -167,7 +179,9 @@ func (s *TeamsService) AddTeamMembershipBySlug(ctx context.Context, org, slug, u // RemoveTeamMembershipByID removes a user from a team, given a specified // organization ID, by team ID. // -// GitHub API docs: https://docs.github.com/en/rest/teams/members#remove-team-membership-for-a-user +// GitHub API docs: https://docs.github.com/rest/teams/members#remove-team-membership-for-a-user +// +//meta:operation DELETE /orgs/{org}/teams/{team_slug}/memberships/{username} func (s *TeamsService) RemoveTeamMembershipByID(ctx context.Context, orgID, teamID int64, user string) (*Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/memberships/%v", orgID, teamID, user) req, err := s.client.NewRequest("DELETE", u, nil) @@ -181,7 +195,9 @@ func (s *TeamsService) RemoveTeamMembershipByID(ctx context.Context, orgID, team // RemoveTeamMembershipBySlug removes a user from a team, given a specified // organization name, by team slug. // -// GitHub API docs: https://docs.github.com/en/rest/teams/members#remove-team-membership-for-a-user +// GitHub API docs: https://docs.github.com/rest/teams/members#remove-team-membership-for-a-user +// +//meta:operation DELETE /orgs/{org}/teams/{team_slug}/memberships/{username} func (s *TeamsService) RemoveTeamMembershipBySlug(ctx context.Context, org, slug, user string) (*Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/memberships/%v", org, slug, user) req, err := s.client.NewRequest("DELETE", u, nil) @@ -195,7 +211,9 @@ func (s *TeamsService) RemoveTeamMembershipBySlug(ctx context.Context, org, slug // ListPendingTeamInvitationsByID gets pending invitation list of a team, given a specified // organization ID, by team ID. // -// GitHub API docs: https://docs.github.com/en/rest/teams/members#list-pending-team-invitations +// GitHub API docs: https://docs.github.com/rest/teams/members#list-pending-team-invitations +// +//meta:operation GET /orgs/{org}/teams/{team_slug}/invitations func (s *TeamsService) ListPendingTeamInvitationsByID(ctx context.Context, orgID, teamID int64, opts *ListOptions) ([]*Invitation, *Response, error) { u := fmt.Sprintf("organizations/%v/team/%v/invitations", orgID, teamID) u, err := addOptions(u, opts) @@ -220,7 +238,9 @@ func (s *TeamsService) ListPendingTeamInvitationsByID(ctx context.Context, orgID // ListPendingTeamInvitationsBySlug get pending invitation list of a team, given a specified // organization name, by team slug. // -// GitHub API docs: https://docs.github.com/en/rest/teams/members#list-pending-team-invitations +// GitHub API docs: https://docs.github.com/rest/teams/members#list-pending-team-invitations +// +//meta:operation GET /orgs/{org}/teams/{team_slug}/invitations func (s *TeamsService) ListPendingTeamInvitationsBySlug(ctx context.Context, org, slug string, opts *ListOptions) ([]*Invitation, *Response, error) { u := fmt.Sprintf("orgs/%v/teams/%v/invitations", org, slug) u, err := addOptions(u, opts) diff --git a/github/users.go b/github/users.go index 1b0670103b3..51b2b2193bc 100644 --- a/github/users.go +++ b/github/users.go @@ -13,7 +13,7 @@ import ( // UsersService handles communication with the user related // methods of the GitHub API. // -// GitHub API docs: https://docs.github.com/en/rest/users/ +// GitHub API docs: https://docs.github.com/rest/users/ type UsersService service // User represents a GitHub user. @@ -63,7 +63,7 @@ type User struct { SubscriptionsURL *string `json:"subscriptions_url,omitempty"` // TextMatches is only populated from search results that request text matches - // See: search.go and https://docs.github.com/en/rest/search/#text-match-metadata + // See: search.go and https://docs.github.com/rest/search/#text-match-metadata TextMatches []*TextMatch `json:"text_matches,omitempty"` // Permissions and RoleName identify the permissions and role that a user has on a given @@ -79,8 +79,11 @@ func (u User) String() string { // Get fetches a user. Passing the empty string will fetch the authenticated // user. // -// GitHub API docs: https://docs.github.com/en/rest/users/users#get-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/rest/users/users#get-a-user +// GitHub API docs: https://docs.github.com/rest/users/users#get-a-user +// GitHub API docs: https://docs.github.com/rest/users/users#get-the-authenticated-user +// +//meta:operation GET /user +//meta:operation GET /users/{username} func (s *UsersService) Get(ctx context.Context, user string) (*User, *Response, error) { var u string if user != "" { @@ -104,7 +107,9 @@ func (s *UsersService) Get(ctx context.Context, user string) (*User, *Response, // GetByID fetches a user. // -// Note: GetByID uses the undocumented GitHub API endpoint /user/:id. +// Note: GetByID uses the undocumented GitHub API endpoint "GET /user/{user_id}". +// +//meta:operation GET /user/{user_id} func (s *UsersService) GetByID(ctx context.Context, id int64) (*User, *Response, error) { u := fmt.Sprintf("user/%d", id) req, err := s.client.NewRequest("GET", u, nil) @@ -123,7 +128,9 @@ func (s *UsersService) GetByID(ctx context.Context, id int64) (*User, *Response, // Edit the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/users/users#update-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/users#update-the-authenticated-user +// +//meta:operation PATCH /user func (s *UsersService) Edit(ctx context.Context, user *User) (*User, *Response, error) { u := "user" req, err := s.client.NewRequest("PATCH", u, user) @@ -165,7 +172,9 @@ type UserContext struct { // GetHovercard fetches contextual information about user. It requires authentication // via Basic Auth or via OAuth with the repo scope. // -// GitHub API docs: https://docs.github.com/en/rest/users/users#get-contextual-information-for-a-user +// GitHub API docs: https://docs.github.com/rest/users/users#get-contextual-information-for-a-user +// +//meta:operation GET /users/{username}/hovercard func (s *UsersService) GetHovercard(ctx context.Context, user string, opts *HovercardOptions) (*Hovercard, *Response, error) { u := fmt.Sprintf("users/%v/hovercard", user) u, err := addOptions(u, opts) @@ -203,7 +212,9 @@ type UserListOptions struct { // // To paginate through all users, populate 'Since' with the ID of the last user. // -// GitHub API docs: https://docs.github.com/en/rest/users/users#list-users +// GitHub API docs: https://docs.github.com/rest/users/users#list-users +// +//meta:operation GET /users func (s *UsersService) ListAll(ctx context.Context, opts *UserListOptions) ([]*User, *Response, error) { u, err := addOptions("users", opts) if err != nil { @@ -227,7 +238,9 @@ func (s *UsersService) ListAll(ctx context.Context, opts *UserListOptions) ([]*U // ListInvitations lists all currently-open repository invitations for the // authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/collaborators/invitations#list-repository-invitations-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/collaborators/invitations#list-repository-invitations-for-the-authenticated-user +// +//meta:operation GET /user/repository_invitations func (s *UsersService) ListInvitations(ctx context.Context, opts *ListOptions) ([]*RepositoryInvitation, *Response, error) { u, err := addOptions("user/repository_invitations", opts) if err != nil { @@ -251,7 +264,9 @@ func (s *UsersService) ListInvitations(ctx context.Context, opts *ListOptions) ( // AcceptInvitation accepts the currently-open repository invitation for the // authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/collaborators/invitations#accept-a-repository-invitation +// GitHub API docs: https://docs.github.com/rest/collaborators/invitations#accept-a-repository-invitation +// +//meta:operation PATCH /user/repository_invitations/{invitation_id} func (s *UsersService) AcceptInvitation(ctx context.Context, invitationID int64) (*Response, error) { u := fmt.Sprintf("user/repository_invitations/%v", invitationID) req, err := s.client.NewRequest("PATCH", u, nil) @@ -265,7 +280,9 @@ func (s *UsersService) AcceptInvitation(ctx context.Context, invitationID int64) // DeclineInvitation declines the currently-open repository invitation for the // authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/collaborators/invitations#decline-a-repository-invitation +// GitHub API docs: https://docs.github.com/rest/collaborators/invitations#decline-a-repository-invitation +// +//meta:operation DELETE /user/repository_invitations/{invitation_id} func (s *UsersService) DeclineInvitation(ctx context.Context, invitationID int64) (*Response, error) { u := fmt.Sprintf("user/repository_invitations/%v", invitationID) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/users_administration.go b/github/users_administration.go index aef947ec451..02cb894bc3b 100644 --- a/github/users_administration.go +++ b/github/users_administration.go @@ -12,7 +12,9 @@ import ( // PromoteSiteAdmin promotes a user to a site administrator of a GitHub Enterprise instance. // -// GitHub API docs: https://developer.github.com/enterprise/v3/enterprise-admin/users/#promote-an-ordinary-user-to-a-site-administrator +// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#promote-a-user-to-be-a-site-administrator +// +//meta:operation PUT /users/{username}/site_admin func (s *UsersService) PromoteSiteAdmin(ctx context.Context, user string) (*Response, error) { u := fmt.Sprintf("users/%v/site_admin", user) @@ -26,7 +28,9 @@ func (s *UsersService) PromoteSiteAdmin(ctx context.Context, user string) (*Resp // DemoteSiteAdmin demotes a user from site administrator of a GitHub Enterprise instance. // -// GitHub API docs: https://developer.github.com/enterprise/v3/enterprise-admin/users/#demote-a-site-administrator-to-an-ordinary-user +// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#demote-a-site-administrator +// +//meta:operation DELETE /users/{username}/site_admin func (s *UsersService) DemoteSiteAdmin(ctx context.Context, user string) (*Response, error) { u := fmt.Sprintf("users/%v/site_admin", user) @@ -45,7 +49,9 @@ type UserSuspendOptions struct { // Suspend a user on a GitHub Enterprise instance. // -// GitHub API docs: https://developer.github.com/enterprise/v3/enterprise-admin/users/#suspend-a-user +// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#suspend-a-user +// +//meta:operation PUT /users/{username}/suspended func (s *UsersService) Suspend(ctx context.Context, user string, opts *UserSuspendOptions) (*Response, error) { u := fmt.Sprintf("users/%v/suspended", user) @@ -59,7 +65,9 @@ func (s *UsersService) Suspend(ctx context.Context, user string, opts *UserSuspe // Unsuspend a user on a GitHub Enterprise instance. // -// GitHub API docs: https://developer.github.com/enterprise/v3/enterprise-admin/users/#unsuspend-a-user +// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#unsuspend-a-user +// +//meta:operation DELETE /users/{username}/suspended func (s *UsersService) Unsuspend(ctx context.Context, user string) (*Response, error) { u := fmt.Sprintf("users/%v/suspended", user) diff --git a/github/users_blocking.go b/github/users_blocking.go index 3d38d947898..3f2af38f6c9 100644 --- a/github/users_blocking.go +++ b/github/users_blocking.go @@ -12,7 +12,9 @@ import ( // ListBlockedUsers lists all the blocked users by the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/users/blocking#list-users-blocked-by-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/blocking#list-users-blocked-by-the-authenticated-user +// +//meta:operation GET /user/blocks func (s *UsersService) ListBlockedUsers(ctx context.Context, opts *ListOptions) ([]*User, *Response, error) { u := "user/blocks" u, err := addOptions(u, opts) @@ -39,7 +41,9 @@ func (s *UsersService) ListBlockedUsers(ctx context.Context, opts *ListOptions) // IsBlocked reports whether specified user is blocked by the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/users/blocking#check-if-a-user-is-blocked-by-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/blocking#check-if-a-user-is-blocked-by-the-authenticated-user +// +//meta:operation GET /user/blocks/{username} func (s *UsersService) IsBlocked(ctx context.Context, user string) (bool, *Response, error) { u := fmt.Sprintf("user/blocks/%v", user) @@ -58,7 +62,9 @@ func (s *UsersService) IsBlocked(ctx context.Context, user string) (bool, *Respo // BlockUser blocks specified user for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/users/blocking#block-a-user +// GitHub API docs: https://docs.github.com/rest/users/blocking#block-a-user +// +//meta:operation PUT /user/blocks/{username} func (s *UsersService) BlockUser(ctx context.Context, user string) (*Response, error) { u := fmt.Sprintf("user/blocks/%v", user) @@ -75,7 +81,9 @@ func (s *UsersService) BlockUser(ctx context.Context, user string) (*Response, e // UnblockUser unblocks specified user for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/users/blocking#unblock-a-user +// GitHub API docs: https://docs.github.com/rest/users/blocking#unblock-a-user +// +//meta:operation DELETE /user/blocks/{username} func (s *UsersService) UnblockUser(ctx context.Context, user string) (*Response, error) { u := fmt.Sprintf("user/blocks/%v", user) diff --git a/github/users_emails.go b/github/users_emails.go index 67bd210e8d5..8386de250b2 100644 --- a/github/users_emails.go +++ b/github/users_emails.go @@ -17,7 +17,9 @@ type UserEmail struct { // ListEmails lists all email addresses for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/users/emails#list-email-addresses-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/emails#list-email-addresses-for-the-authenticated-user +// +//meta:operation GET /user/emails func (s *UsersService) ListEmails(ctx context.Context, opts *ListOptions) ([]*UserEmail, *Response, error) { u := "user/emails" u, err := addOptions(u, opts) @@ -41,7 +43,9 @@ func (s *UsersService) ListEmails(ctx context.Context, opts *ListOptions) ([]*Us // AddEmails adds email addresses of the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/users/emails#add-an-email-address-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/emails#add-an-email-address-for-the-authenticated-user +// +//meta:operation POST /user/emails func (s *UsersService) AddEmails(ctx context.Context, emails []string) ([]*UserEmail, *Response, error) { u := "user/emails" req, err := s.client.NewRequest("POST", u, emails) @@ -60,7 +64,9 @@ func (s *UsersService) AddEmails(ctx context.Context, emails []string) ([]*UserE // DeleteEmails deletes email addresses from authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/users/emails#delete-an-email-address-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/emails#delete-an-email-address-for-the-authenticated-user +// +//meta:operation DELETE /user/emails func (s *UsersService) DeleteEmails(ctx context.Context, emails []string) (*Response, error) { u := "user/emails" req, err := s.client.NewRequest("DELETE", u, emails) @@ -74,7 +80,9 @@ func (s *UsersService) DeleteEmails(ctx context.Context, emails []string) (*Resp // SetEmailVisibility sets the visibility for the primary email address of the authenticated user. // `visibility` can be "private" or "public". // -// GitHub API docs: https://docs.github.com/en/rest/users/emails#set-primary-email-visibility-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/emails#set-primary-email-visibility-for-the-authenticated-user +// +//meta:operation PATCH /user/email/visibility func (s *UsersService) SetEmailVisibility(ctx context.Context, visibility string) ([]*UserEmail, *Response, error) { u := "user/email/visibility" diff --git a/github/users_followers.go b/github/users_followers.go index 1266e0e9ee3..ec6f531eaa4 100644 --- a/github/users_followers.go +++ b/github/users_followers.go @@ -13,8 +13,11 @@ import ( // ListFollowers lists the followers for a user. Passing the empty string will // fetch followers for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/users/followers#list-followers-of-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/rest/users/followers#list-followers-of-a-user +// GitHub API docs: https://docs.github.com/rest/users/followers#list-followers-of-a-user +// GitHub API docs: https://docs.github.com/rest/users/followers#list-followers-of-the-authenticated-user +// +//meta:operation GET /user/followers +//meta:operation GET /users/{username}/followers func (s *UsersService) ListFollowers(ctx context.Context, user string, opts *ListOptions) ([]*User, *Response, error) { var u string if user != "" { @@ -44,8 +47,11 @@ func (s *UsersService) ListFollowers(ctx context.Context, user string, opts *Lis // ListFollowing lists the people that a user is following. Passing the empty // string will list people the authenticated user is following. // -// GitHub API docs: https://docs.github.com/en/rest/users/followers#list-the-people-the-authenticated-user-follows -// GitHub API docs: https://docs.github.com/en/rest/users/followers#list-the-people-a-user-follows +// GitHub API docs: https://docs.github.com/rest/users/followers#list-the-people-a-user-follows +// GitHub API docs: https://docs.github.com/rest/users/followers#list-the-people-the-authenticated-user-follows +// +//meta:operation GET /user/following +//meta:operation GET /users/{username}/following func (s *UsersService) ListFollowing(ctx context.Context, user string, opts *ListOptions) ([]*User, *Response, error) { var u string if user != "" { @@ -75,8 +81,11 @@ func (s *UsersService) ListFollowing(ctx context.Context, user string, opts *Lis // IsFollowing checks if "user" is following "target". Passing the empty // string for "user" will check if the authenticated user is following "target". // -// GitHub API docs: https://docs.github.com/en/rest/users/followers#check-if-a-person-is-followed-by-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/rest/users/followers#check-if-a-user-follows-another-user +// GitHub API docs: https://docs.github.com/rest/users/followers#check-if-a-person-is-followed-by-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/followers#check-if-a-user-follows-another-user +// +//meta:operation GET /user/following/{username} +//meta:operation GET /users/{username}/following/{target_user} func (s *UsersService) IsFollowing(ctx context.Context, user, target string) (bool, *Response, error) { var u string if user != "" { @@ -97,7 +106,9 @@ func (s *UsersService) IsFollowing(ctx context.Context, user, target string) (bo // Follow will cause the authenticated user to follow the specified user. // -// GitHub API docs: https://docs.github.com/en/rest/users/followers#follow-a-user +// GitHub API docs: https://docs.github.com/rest/users/followers#follow-a-user +// +//meta:operation PUT /user/following/{username} func (s *UsersService) Follow(ctx context.Context, user string) (*Response, error) { u := fmt.Sprintf("user/following/%v", user) req, err := s.client.NewRequest("PUT", u, nil) @@ -110,7 +121,9 @@ func (s *UsersService) Follow(ctx context.Context, user string) (*Response, erro // Unfollow will cause the authenticated user to unfollow the specified user. // -// GitHub API docs: https://docs.github.com/en/rest/users/followers#unfollow-a-user +// GitHub API docs: https://docs.github.com/rest/users/followers#unfollow-a-user +// +//meta:operation DELETE /user/following/{username} func (s *UsersService) Unfollow(ctx context.Context, user string) (*Response, error) { u := fmt.Sprintf("user/following/%v", user) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/users_gpg_keys.go b/github/users_gpg_keys.go index 54189b83077..de7caaf1bd0 100644 --- a/github/users_gpg_keys.go +++ b/github/users_gpg_keys.go @@ -44,8 +44,11 @@ type GPGEmail struct { // string will fetch keys for the authenticated user. It requires authentication // via Basic Auth or via OAuth with at least read:gpg_key scope. // -// GitHub API docs: https://docs.github.com/en/rest/users/gpg-keys#list-gpg-keys-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/rest/users/gpg-keys#list-gpg-keys-for-a-user +// GitHub API docs: https://docs.github.com/rest/users/gpg-keys#list-gpg-keys-for-a-user +// GitHub API docs: https://docs.github.com/rest/users/gpg-keys#list-gpg-keys-for-the-authenticated-user +// +//meta:operation GET /user/gpg_keys +//meta:operation GET /users/{username}/gpg_keys func (s *UsersService) ListGPGKeys(ctx context.Context, user string, opts *ListOptions) ([]*GPGKey, *Response, error) { var u string if user != "" { @@ -75,7 +78,9 @@ func (s *UsersService) ListGPGKeys(ctx context.Context, user string, opts *ListO // GetGPGKey gets extended details for a single GPG key. It requires authentication // via Basic Auth or via OAuth with at least read:gpg_key scope. // -// GitHub API docs: https://docs.github.com/en/rest/users/gpg-keys#get-a-gpg-key-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/gpg-keys#get-a-gpg-key-for-the-authenticated-user +// +//meta:operation GET /user/gpg_keys/{gpg_key_id} func (s *UsersService) GetGPGKey(ctx context.Context, id int64) (*GPGKey, *Response, error) { u := fmt.Sprintf("user/gpg_keys/%v", id) req, err := s.client.NewRequest("GET", u, nil) @@ -95,7 +100,9 @@ func (s *UsersService) GetGPGKey(ctx context.Context, id int64) (*GPGKey, *Respo // CreateGPGKey creates a GPG key. It requires authenticatation via Basic Auth // or OAuth with at least write:gpg_key scope. // -// GitHub API docs: https://docs.github.com/en/rest/users/gpg-keys#create-a-gpg-key +// GitHub API docs: https://docs.github.com/rest/users/gpg-keys#create-a-gpg-key-for-the-authenticated-user +// +//meta:operation POST /user/gpg_keys func (s *UsersService) CreateGPGKey(ctx context.Context, armoredPublicKey string) (*GPGKey, *Response, error) { gpgKey := &struct { ArmoredPublicKey string `json:"armored_public_key"` @@ -117,7 +124,9 @@ func (s *UsersService) CreateGPGKey(ctx context.Context, armoredPublicKey string // DeleteGPGKey deletes a GPG key. It requires authentication via Basic Auth or // via OAuth with at least admin:gpg_key scope. // -// GitHub API docs: https://docs.github.com/en/rest/users/gpg-keys#delete-a-gpg-key-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/gpg-keys#delete-a-gpg-key-for-the-authenticated-user +// +//meta:operation DELETE /user/gpg_keys/{gpg_key_id} func (s *UsersService) DeleteGPGKey(ctx context.Context, id int64) (*Response, error) { u := fmt.Sprintf("user/gpg_keys/%v", id) req, err := s.client.NewRequest("DELETE", u, nil) diff --git a/github/users_keys.go b/github/users_keys.go index b49b8e4b4ef..4d42986ed2b 100644 --- a/github/users_keys.go +++ b/github/users_keys.go @@ -30,8 +30,11 @@ func (k Key) String() string { // ListKeys lists the verified public keys for a user. Passing the empty // string will fetch keys for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/users/keys#list-public-ssh-keys-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/rest/users/keys#list-public-keys-for-a-user +// GitHub API docs: https://docs.github.com/rest/users/keys#list-public-keys-for-a-user +// GitHub API docs: https://docs.github.com/rest/users/keys#list-public-ssh-keys-for-the-authenticated-user +// +//meta:operation GET /user/keys +//meta:operation GET /users/{username}/keys func (s *UsersService) ListKeys(ctx context.Context, user string, opts *ListOptions) ([]*Key, *Response, error) { var u string if user != "" { @@ -60,7 +63,9 @@ func (s *UsersService) ListKeys(ctx context.Context, user string, opts *ListOpti // GetKey fetches a single public key. // -// GitHub API docs: https://docs.github.com/en/rest/users/keys#get-a-public-ssh-key-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/keys#get-a-public-ssh-key-for-the-authenticated-user +// +//meta:operation GET /user/keys/{key_id} func (s *UsersService) GetKey(ctx context.Context, id int64) (*Key, *Response, error) { u := fmt.Sprintf("user/keys/%v", id) @@ -80,7 +85,9 @@ func (s *UsersService) GetKey(ctx context.Context, id int64) (*Key, *Response, e // CreateKey adds a public key for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/users/keys#create-a-public-ssh-key-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/keys#create-a-public-ssh-key-for-the-authenticated-user +// +//meta:operation POST /user/keys func (s *UsersService) CreateKey(ctx context.Context, key *Key) (*Key, *Response, error) { u := "user/keys" @@ -100,7 +107,9 @@ func (s *UsersService) CreateKey(ctx context.Context, key *Key) (*Key, *Response // DeleteKey deletes a public key. // -// GitHub API docs: https://docs.github.com/en/rest/users/keys#delete-a-public-ssh-key-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/keys#delete-a-public-ssh-key-for-the-authenticated-user +// +//meta:operation DELETE /user/keys/{key_id} func (s *UsersService) DeleteKey(ctx context.Context, id int64) (*Response, error) { u := fmt.Sprintf("user/keys/%v", id) diff --git a/github/users_packages.go b/github/users_packages.go index c3ffc6ab074..3ccf68a1696 100644 --- a/github/users_packages.go +++ b/github/users_packages.go @@ -13,8 +13,11 @@ import ( // ListPackages lists the packages for a user. Passing the empty string for "user" will // list packages for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/packages#list-packages-for-the-authenticated-users-namespace -// GitHub API docs: https://docs.github.com/en/rest/packages#list-packages-for-a-user +// GitHub API docs: https://docs.github.com/rest/packages/packages#list-packages-for-a-user +// GitHub API docs: https://docs.github.com/rest/packages/packages#list-packages-for-the-authenticated-users-namespace +// +//meta:operation GET /user/packages +//meta:operation GET /users/{username}/packages func (s *UsersService) ListPackages(ctx context.Context, user string, opts *PackageListOptions) ([]*Package, *Response, error) { var u string if user != "" { @@ -44,8 +47,11 @@ func (s *UsersService) ListPackages(ctx context.Context, user string, opts *Pack // GetPackage gets a package by name for a user. Passing the empty string for "user" will // get the package for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/packages#get-a-package-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/rest/packages#get-a-package-for-a-user +// GitHub API docs: https://docs.github.com/rest/packages/packages#get-a-package-for-a-user +// GitHub API docs: https://docs.github.com/rest/packages/packages#get-a-package-for-the-authenticated-user +// +//meta:operation GET /user/packages/{package_type}/{package_name} +//meta:operation GET /users/{username}/packages/{package_type}/{package_name} func (s *UsersService) GetPackage(ctx context.Context, user, packageType, packageName string) (*Package, *Response, error) { var u string if user != "" { @@ -71,8 +77,11 @@ func (s *UsersService) GetPackage(ctx context.Context, user, packageType, packag // DeletePackage deletes a package from a user. Passing the empty string for "user" will // delete the package for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/packages#delete-a-package-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/rest/packages#delete-a-package-for-a-user +// GitHub API docs: https://docs.github.com/rest/packages/packages#delete-a-package-for-a-user +// GitHub API docs: https://docs.github.com/rest/packages/packages#delete-a-package-for-the-authenticated-user +// +//meta:operation DELETE /user/packages/{package_type}/{package_name} +//meta:operation DELETE /users/{username}/packages/{package_type}/{package_name} func (s *UsersService) DeletePackage(ctx context.Context, user, packageType, packageName string) (*Response, error) { var u string if user != "" { @@ -92,8 +101,11 @@ func (s *UsersService) DeletePackage(ctx context.Context, user, packageType, pac // RestorePackage restores a package to a user. Passing the empty string for "user" will // restore the package for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/packages#restore-a-package-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/rest/packages#restore-a-package-for-a-user +// GitHub API docs: https://docs.github.com/rest/packages/packages#restore-a-package-for-a-user +// GitHub API docs: https://docs.github.com/rest/packages/packages#restore-a-package-for-the-authenticated-user +// +//meta:operation POST /user/packages/{package_type}/{package_name}/restore +//meta:operation POST /users/{username}/packages/{package_type}/{package_name}/restore func (s *UsersService) RestorePackage(ctx context.Context, user, packageType, packageName string) (*Response, error) { var u string if user != "" { @@ -113,8 +125,11 @@ func (s *UsersService) RestorePackage(ctx context.Context, user, packageType, pa // PackageGetAllVersions gets all versions of a package for a user. Passing the empty string for "user" will // get versions for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/packages#get-all-package-versions-for-a-package-owned-by-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/rest/packages#get-all-package-versions-for-a-package-owned-by-a-user +// GitHub API docs: https://docs.github.com/rest/packages/packages#list-package-versions-for-a-package-owned-by-a-user +// GitHub API docs: https://docs.github.com/rest/packages/packages#list-package-versions-for-a-package-owned-by-the-authenticated-user +// +//meta:operation GET /user/packages/{package_type}/{package_name}/versions +//meta:operation GET /users/{username}/packages/{package_type}/{package_name}/versions func (s *UsersService) PackageGetAllVersions(ctx context.Context, user, packageType, packageName string, opts *PackageListOptions) ([]*PackageVersion, *Response, error) { var u string if user != "" { @@ -144,8 +159,11 @@ func (s *UsersService) PackageGetAllVersions(ctx context.Context, user, packageT // PackageGetVersion gets a specific version of a package for a user. Passing the empty string for "user" will // get the version for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/packages#get-a-package-version-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/rest/packages#get-a-package-version-for-a-user +// GitHub API docs: https://docs.github.com/rest/packages/packages#get-a-package-version-for-a-user +// GitHub API docs: https://docs.github.com/rest/packages/packages#get-a-package-version-for-the-authenticated-user +// +//meta:operation GET /user/packages/{package_type}/{package_name}/versions/{package_version_id} +//meta:operation GET /users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id} func (s *UsersService) PackageGetVersion(ctx context.Context, user, packageType, packageName string, packageVersionID int64) (*PackageVersion, *Response, error) { var u string if user != "" { @@ -171,8 +189,11 @@ func (s *UsersService) PackageGetVersion(ctx context.Context, user, packageType, // PackageDeleteVersion deletes a package version for a user. Passing the empty string for "user" will // delete the version for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/packages#delete-a-package-version-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/rest/packages#delete-package-version-for-a-user +// GitHub API docs: https://docs.github.com/rest/packages/packages#delete-a-package-version-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/packages/packages#delete-package-version-for-a-user +// +//meta:operation DELETE /user/packages/{package_type}/{package_name}/versions/{package_version_id} +//meta:operation DELETE /users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id} func (s *UsersService) PackageDeleteVersion(ctx context.Context, user, packageType, packageName string, packageVersionID int64) (*Response, error) { var u string if user != "" { @@ -192,8 +213,11 @@ func (s *UsersService) PackageDeleteVersion(ctx context.Context, user, packageTy // PackageRestoreVersion restores a package version to a user. Passing the empty string for "user" will // restore the version for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/packages#restore-a-package-version-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/rest/packages#restore-package-version-for-a-user +// GitHub API docs: https://docs.github.com/rest/packages/packages#restore-a-package-version-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/packages/packages#restore-package-version-for-a-user +// +//meta:operation POST /user/packages/{package_type}/{package_name}/versions/{package_version_id}/restore +//meta:operation POST /users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id}/restore func (s *UsersService) PackageRestoreVersion(ctx context.Context, user, packageType, packageName string, packageVersionID int64) (*Response, error) { var u string if user != "" { diff --git a/github/users_projects.go b/github/users_projects.go index 0cbd61f923c..0ab57e5c23c 100644 --- a/github/users_projects.go +++ b/github/users_projects.go @@ -12,7 +12,9 @@ import ( // ListProjects lists the projects for the specified user. // -// GitHub API docs: https://docs.github.com/en/rest/projects/projects#list-user-projects +// GitHub API docs: https://docs.github.com/rest/projects/projects#list-user-projects +// +//meta:operation GET /users/{username}/projects func (s *UsersService) ListProjects(ctx context.Context, user string, opts *ProjectListOptions) ([]*Project, *Response, error) { u := fmt.Sprintf("users/%v/projects", user) u, err := addOptions(u, opts) @@ -47,7 +49,9 @@ type CreateUserProjectOptions struct { // CreateProject creates a GitHub Project for the current user. // -// GitHub API docs: https://docs.github.com/en/rest/projects/projects#create-a-user-project +// GitHub API docs: https://docs.github.com/rest/projects/projects#create-a-user-project +// +//meta:operation POST /user/projects func (s *UsersService) CreateProject(ctx context.Context, opts *CreateUserProjectOptions) (*Project, *Response, error) { u := "user/projects" req, err := s.client.NewRequest("POST", u, opts) diff --git a/github/users_ssh_signing_keys.go b/github/users_ssh_signing_keys.go index 23e4c36aea3..fcc930be628 100644 --- a/github/users_ssh_signing_keys.go +++ b/github/users_ssh_signing_keys.go @@ -25,8 +25,11 @@ func (k SSHSigningKey) String() string { // ListSSHSigningKeys lists the SSH signing keys for a user. Passing an empty // username string will fetch SSH signing keys for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/users/ssh-signing-keys#list-ssh-signing-keys-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/rest/users/ssh-signing-keys#list-ssh-signing-keys-for-a-user +// GitHub API docs: https://docs.github.com/rest/users/ssh-signing-keys#list-ssh-signing-keys-for-a-user +// GitHub API docs: https://docs.github.com/rest/users/ssh-signing-keys#list-ssh-signing-keys-for-the-authenticated-user +// +//meta:operation GET /user/ssh_signing_keys +//meta:operation GET /users/{username}/ssh_signing_keys func (s *UsersService) ListSSHSigningKeys(ctx context.Context, user string, opts *ListOptions) ([]*SSHSigningKey, *Response, error) { var u string if user != "" { @@ -55,7 +58,9 @@ func (s *UsersService) ListSSHSigningKeys(ctx context.Context, user string, opts // GetSSHSigningKey fetches a single SSH signing key for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/users/ssh-signing-keys#get-an-ssh-signing-key-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/ssh-signing-keys#get-an-ssh-signing-key-for-the-authenticated-user +// +//meta:operation GET /user/ssh_signing_keys/{ssh_signing_key_id} func (s *UsersService) GetSSHSigningKey(ctx context.Context, id int64) (*SSHSigningKey, *Response, error) { u := fmt.Sprintf("user/ssh_signing_keys/%v", id) @@ -75,7 +80,9 @@ func (s *UsersService) GetSSHSigningKey(ctx context.Context, id int64) (*SSHSign // CreateSSHSigningKey adds a SSH signing key for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/users/ssh-signing-keys#create-a-ssh-signing-key-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/ssh-signing-keys#create-a-ssh-signing-key-for-the-authenticated-user +// +//meta:operation POST /user/ssh_signing_keys func (s *UsersService) CreateSSHSigningKey(ctx context.Context, key *Key) (*SSHSigningKey, *Response, error) { u := "user/ssh_signing_keys" @@ -95,7 +102,9 @@ func (s *UsersService) CreateSSHSigningKey(ctx context.Context, key *Key) (*SSHS // DeleteSSHSigningKey deletes a SSH signing key for the authenticated user. // -// GitHub API docs: https://docs.github.com/en/rest/users/ssh-signing-keys#delete-an-ssh-signing-key-for-the-authenticated-user +// GitHub API docs: https://docs.github.com/rest/users/ssh-signing-keys#delete-an-ssh-signing-key-for-the-authenticated-user +// +//meta:operation DELETE /user/ssh_signing_keys/{ssh_signing_key_id} func (s *UsersService) DeleteSSHSigningKey(ctx context.Context, id int64) (*Response, error) { u := fmt.Sprintf("user/ssh_signing_keys/%v", id) diff --git a/openapi_operations.yaml b/openapi_operations.yaml new file mode 100644 index 00000000000..f2b1af28843 --- /dev/null +++ b/openapi_operations.yaml @@ -0,0 +1,6291 @@ +operations: + - name: POST /hub + documentation_url: https://docs.github.com/webhooks/about-webhooks-for-repositories#pubsubhubbub + - name: GET /organizations/{organization_id} + - name: GET /orgs/{org}/actions/required_workflows + documentation_url: https://docs.github.com/actions/using-workflows/required-workflows + - name: POST /orgs/{org}/actions/required_workflows + documentation_url: https://docs.github.com/actions/using-workflows/required-workflows + - name: DELETE /orgs/{org}/actions/required_workflows/{workflow_id} + documentation_url: https://docs.github.com/actions/using-workflows/required-workflows + - name: GET /orgs/{org}/actions/required_workflows/{workflow_id} + documentation_url: https://docs.github.com/actions/using-workflows/required-workflows + - name: PATCH /orgs/{org}/actions/required_workflows/{workflow_id} + documentation_url: https://docs.github.com/actions/using-workflows/required-workflows + - name: GET /orgs/{org}/actions/required_workflows/{workflow_id}/repositories + documentation_url: https://docs.github.com/actions/using-workflows/required-workflows + - name: PUT /orgs/{org}/actions/required_workflows/{workflow_id}/repositories + documentation_url: https://docs.github.com/actions/using-workflows/required-workflows + - name: DELETE /orgs/{org}/actions/required_workflows/{workflow_id}/repositories/{repository_id} + documentation_url: https://docs.github.com/actions/using-workflows/required-workflows + - name: PUT /orgs/{org}/actions/required_workflows/{workflow_id}/repositories/{repository_id} + documentation_url: https://docs.github.com/actions/using-workflows/required-workflows + - name: GET /repos/{owner}/{repo}/actions/required_workflows + documentation_url: https://docs.github.com/actions/using-workflows/required-workflows + - name: GET /repos/{owner}/{repo}/import/issues + documentation_url: https://gist.github.com/jonmagic/5282384165e0f86ef105#check-status-of-multiple-issues + - name: POST /repos/{owner}/{repo}/import/issues + documentation_url: https://gist.github.com/jonmagic/5282384165e0f86ef105#start-an-issue-import + - name: GET /repos/{owner}/{repo}/import/issues/{issue_number} + documentation_url: https://gist.github.com/jonmagic/5282384165e0f86ef105#import-status-request + - name: GET /repositories/{repository_id} + - name: GET /repositories/{repository_id}/installation + - name: GET /user/{user_id} +operation_overrides: + - name: GET /meta + documentation_url: https://docs.github.com/rest/meta/meta#get-github-meta-information + - name: DELETE /repos/{owner}/{repo}/pages + documentation_url: https://docs.github.com/rest/pages/pages#delete-a-github-pages-site + - name: GET /repos/{owner}/{repo}/pages + documentation_url: https://docs.github.com/rest/pages/pages#get-a-github-pages-site + - name: POST /repos/{owner}/{repo}/pages + documentation_url: https://docs.github.com/rest/pages/pages#create-a-github-pages-site + - name: PUT /repos/{owner}/{repo}/pages + documentation_url: https://docs.github.com/rest/pages/pages#update-information-about-a-github-pages-site + - name: GET /repos/{owner}/{repo}/pages/builds + documentation_url: https://docs.github.com/rest/pages/pages#list-github-pages-builds + - name: POST /repos/{owner}/{repo}/pages/builds + documentation_url: https://docs.github.com/rest/pages/pages#request-a-github-pages-build + - name: GET /repos/{owner}/{repo}/pages/builds/{build_id} + documentation_url: https://docs.github.com/rest/pages/pages#get-github-pages-build +openapi_commit: c86f07e1ca0d543d0b8fc7591991b02767e02deb +openapi_operations: + - name: GET / + documentation_url: https://docs.github.com/rest/meta/meta#github-api-root + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /admin/hooks + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/global-webhooks#list-global-webhooks + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /admin/hooks + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/global-webhooks#create-a-global-webhook + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /admin/hooks/{hook_id} + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/global-webhooks#delete-a-global-webhook + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /admin/hooks/{hook_id} + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/global-webhooks#get-a-global-webhook + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /admin/hooks/{hook_id} + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/global-webhooks#update-a-global-webhook + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /admin/hooks/{hook_id}/pings + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/global-webhooks#ping-a-global-webhook + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /admin/keys + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#list-public-keys + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /admin/keys/{key_ids} + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#delete-a-public-key + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /admin/ldap/teams/{team_id}/mapping + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-team + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /admin/ldap/teams/{team_id}/sync + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/ldap#sync-ldap-mapping-for-a-team + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /admin/ldap/users/{username}/mapping + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-user + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /admin/ldap/users/{username}/sync + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/ldap#sync-ldap-mapping-for-a-user + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /admin/organizations + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/orgs#create-an-organization + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /admin/organizations/{org} + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/orgs#update-an-organization-name + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /admin/pre-receive-environments + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/pre-receive-environments#list-pre-receive-environments + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /admin/pre-receive-environments + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/pre-receive-environments#create-a-pre-receive-environment + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /admin/pre-receive-environments/{pre_receive_environment_id} + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/pre-receive-environments#delete-a-pre-receive-environment + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /admin/pre-receive-environments/{pre_receive_environment_id} + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/pre-receive-environments#get-a-pre-receive-environment + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /admin/pre-receive-environments/{pre_receive_environment_id} + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/pre-receive-environments#update-a-pre-receive-environment + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /admin/pre-receive-environments/{pre_receive_environment_id}/downloads + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/pre-receive-environments#start-a-pre-receive-environment-download + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /admin/pre-receive-environments/{pre_receive_environment_id}/downloads/latest + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/pre-receive-environments#get-the-download-status-for-a-pre-receive-environment + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /admin/pre-receive-hooks + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/pre-receive-hooks#list-pre-receive-hooks + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /admin/pre-receive-hooks + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/pre-receive-hooks#create-a-pre-receive-hook + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /admin/pre-receive-hooks/{pre_receive_hook_id} + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/pre-receive-hooks#delete-a-pre-receive-hook + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /admin/pre-receive-hooks/{pre_receive_hook_id} + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/pre-receive-hooks#get-a-pre-receive-hook + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /admin/pre-receive-hooks/{pre_receive_hook_id} + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/pre-receive-hooks#update-a-pre-receive-hook + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /admin/tokens + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#list-personal-access-tokens + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /admin/tokens/{token_id} + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#delete-a-personal-access-token + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /admin/users + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#create-a-user + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /admin/users/{username} + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#delete-a-user + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /admin/users/{username} + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#update-the-username-for-a-user + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /admin/users/{username}/authorizations + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#delete-an-impersonation-oauth-token + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /admin/users/{username}/authorizations + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#create-an-impersonation-oauth-token + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /advisories + documentation_url: https://docs.github.com/rest/security-advisories/global-advisories#list-global-security-advisories + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /advisories/{ghsa_id} + documentation_url: https://docs.github.com/rest/security-advisories/global-advisories#get-a-global-security-advisory + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /app + documentation_url: https://docs.github.com/rest/apps/apps#get-the-authenticated-app + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /app-manifests/{code}/conversions + documentation_url: https://docs.github.com/rest/apps/apps#create-a-github-app-from-a-manifest + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /app/hook/config + documentation_url: https://docs.github.com/rest/apps/webhooks#get-a-webhook-configuration-for-an-app + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /app/hook/config + documentation_url: https://docs.github.com/rest/apps/webhooks#update-a-webhook-configuration-for-an-app + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /app/hook/deliveries + documentation_url: https://docs.github.com/rest/apps/webhooks#list-deliveries-for-an-app-webhook + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /app/hook/deliveries/{delivery_id} + documentation_url: https://docs.github.com/rest/apps/webhooks#get-a-delivery-for-an-app-webhook + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /app/hook/deliveries/{delivery_id}/attempts + documentation_url: https://docs.github.com/rest/apps/webhooks#redeliver-a-delivery-for-an-app-webhook + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /app/installation-requests + documentation_url: https://docs.github.com/rest/apps/apps#list-installation-requests-for-the-authenticated-app + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /app/installations + documentation_url: https://docs.github.com/rest/apps/apps#list-installations-for-the-authenticated-app + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /app/installations/{installation_id} + documentation_url: https://docs.github.com/rest/apps/apps#delete-an-installation-for-the-authenticated-app + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /app/installations/{installation_id} + documentation_url: https://docs.github.com/rest/apps/apps#get-an-installation-for-the-authenticated-app + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /app/installations/{installation_id}/access_tokens + documentation_url: https://docs.github.com/rest/apps/apps#create-an-installation-access-token-for-an-app + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /app/installations/{installation_id}/suspended + documentation_url: https://docs.github.com/rest/apps/apps#unsuspend-an-app-installation + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /app/installations/{installation_id}/suspended + documentation_url: https://docs.github.com/rest/apps/apps#suspend-an-app-installation + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /applications/grants + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/oauth-authorizations/oauth-authorizations#list-your-grants + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /applications/grants/{grant_id} + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/oauth-authorizations/oauth-authorizations#delete-a-grant + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /applications/grants/{grant_id} + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/oauth-authorizations/oauth-authorizations#get-a-single-grant + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /applications/{client_id}/grant + documentation_url: https://docs.github.com/rest/apps/oauth-applications#delete-an-app-authorization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /applications/{client_id}/grants/{access_token} + documentation_url: https://docs.github.com/enterprise-server@3.3/rest/reference/apps#revoke-a-grant-for-an-application + openapi_files: + - descriptions/ghes-3.3/ghes-3.3.json + - name: DELETE /applications/{client_id}/token + documentation_url: https://docs.github.com/rest/apps/oauth-applications#delete-an-app-token + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /applications/{client_id}/token + documentation_url: https://docs.github.com/rest/apps/oauth-applications#reset-a-token + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /applications/{client_id}/token + documentation_url: https://docs.github.com/rest/apps/oauth-applications#check-a-token + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /applications/{client_id}/token/scoped + documentation_url: https://docs.github.com/rest/apps/apps#create-a-scoped-access-token + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /applications/{client_id}/tokens/{access_token} + documentation_url: https://docs.github.com/enterprise-server@3.3/rest/reference/apps#revoke-an-authorization-for-an-application + openapi_files: + - descriptions/ghes-3.3/ghes-3.3.json + - name: GET /applications/{client_id}/tokens/{access_token} + documentation_url: https://docs.github.com/enterprise-server@3.3/rest/reference/apps#check-an-authorization + openapi_files: + - descriptions/ghes-3.3/ghes-3.3.json + - name: POST /applications/{client_id}/tokens/{access_token} + documentation_url: https://docs.github.com/enterprise-server@3.3/rest/reference/apps#reset-an-authorization + openapi_files: + - descriptions/ghes-3.3/ghes-3.3.json + - name: GET /apps/{app_slug} + documentation_url: https://docs.github.com/rest/apps/apps#get-an-app + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /assignments/{assignment_id} + documentation_url: https://docs.github.com/rest/classroom/classroom#get-an-assignment + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /assignments/{assignment_id}/accepted_assignments + documentation_url: https://docs.github.com/rest/classroom/classroom#list-accepted-assignments-for-an-assignment + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /assignments/{assignment_id}/grades + documentation_url: https://docs.github.com/rest/classroom/classroom#get-assignment-grades + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /authorizations + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/oauth-authorizations/oauth-authorizations#list-your-authorizations + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /authorizations + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/oauth-authorizations/oauth-authorizations#create-a-new-authorization + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /authorizations/clients/{client_id} + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/oauth-authorizations/oauth-authorizations#get-or-create-an-authorization-for-a-specific-app + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /authorizations/clients/{client_id}/{fingerprint} + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/oauth-authorizations/oauth-authorizations#get-or-create-an-authorization-for-a-specific-app-and-fingerprint + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /authorizations/{authorization_id} + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/oauth-authorizations/oauth-authorizations#delete-an-authorization + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /authorizations/{authorization_id} + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/oauth-authorizations/oauth-authorizations#get-a-single-authorization + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /authorizations/{authorization_id} + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/oauth-authorizations/oauth-authorizations#update-an-existing-authorization + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /classrooms + documentation_url: https://docs.github.com/rest/classroom/classroom#list-classrooms + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /classrooms/{classroom_id} + documentation_url: https://docs.github.com/rest/classroom/classroom#get-a-classroom + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /classrooms/{classroom_id}/assignments + documentation_url: https://docs.github.com/rest/classroom/classroom#list-assignments-for-a-classroom + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /codes_of_conduct + documentation_url: https://docs.github.com/rest/codes-of-conduct/codes-of-conduct#get-all-codes-of-conduct + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /codes_of_conduct/{key} + documentation_url: https://docs.github.com/rest/codes-of-conduct/codes-of-conduct#get-a-code-of-conduct + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /emojis + documentation_url: https://docs.github.com/rest/emojis/emojis#get-emojis + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /enterprise-installation/{enterprise_or_org}/server-statistics + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/admin-stats#get-github-enterprise-server-statistics + openapi_files: + - descriptions/ghec/ghec.json + - name: DELETE /enterprise/announcement + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/announcement#remove-the-global-announcement-banner + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /enterprise/announcement + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/announcement#get-the-global-announcement-banner + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /enterprise/announcement + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/announcement#set-the-global-announcement-banner + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /enterprise/settings/license + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/license#get-license-information + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /enterprise/stats/all + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/admin-stats#get-all-statistics + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /enterprise/stats/comments + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/admin-stats#get-comment-statistics + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /enterprise/stats/gists + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/admin-stats#get-gist-statistics + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /enterprise/stats/hooks + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/admin-stats#get-hooks-statistics + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /enterprise/stats/issues + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/admin-stats#get-issue-statistics + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /enterprise/stats/milestones + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/admin-stats#get-milestone-statistics + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /enterprise/stats/orgs + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/admin-stats#get-organization-statistics + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /enterprise/stats/pages + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/admin-stats#get-pages-statistics + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /enterprise/stats/pulls + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/admin-stats#get-pull-request-statistics + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /enterprise/stats/repos + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/admin-stats#get-repository-statistics + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /enterprise/stats/security-products + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/admin-stats#get-security-products-statistics + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /enterprise/stats/users + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/admin-stats#get-users-statistics + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /enterprises/{enterprise}/actions/cache/usage + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/cache#get-github-actions-cache-usage-for-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /enterprises/{enterprise}/actions/cache/usage-policy + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/actions/cache#get-github-actions-cache-usage-policy-for-an-enterprise + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /enterprises/{enterprise}/actions/cache/usage-policy + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/actions/cache#set-github-actions-cache-usage-policy-for-an-enterprise + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /enterprises/{enterprise}/actions/oidc/customization/issuer + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/oidc#set-the-github-actions-oidc-custom-issuer-policy-for-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - name: GET /enterprises/{enterprise}/actions/permissions + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/permissions#get-github-actions-permissions-for-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /enterprises/{enterprise}/actions/permissions + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/permissions#set-github-actions-permissions-for-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /enterprises/{enterprise}/actions/permissions/organizations + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/permissions#list-selected-organizations-enabled-for-github-actions-in-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /enterprises/{enterprise}/actions/permissions/organizations + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/permissions#set-selected-organizations-enabled-for-github-actions-in-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /enterprises/{enterprise}/actions/permissions/organizations/{org_id} + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/permissions#disable-a-selected-organization-for-github-actions-in-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /enterprises/{enterprise}/actions/permissions/organizations/{org_id} + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/permissions#enable-a-selected-organization-for-github-actions-in-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /enterprises/{enterprise}/actions/permissions/selected-actions + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /enterprises/{enterprise}/actions/permissions/selected-actions + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /enterprises/{enterprise}/actions/permissions/workflow + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/permissions#get-default-workflow-permissions-for-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /enterprises/{enterprise}/actions/permissions/workflow + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/permissions#set-default-workflow-permissions-for-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /enterprises/{enterprise}/actions/runner-groups + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#list-self-hosted-runner-groups-for-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /enterprises/{enterprise}/actions/runner-groups + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#create-a-self-hosted-runner-group-for-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /enterprises/{enterprise}/actions/runner-groups/{runner_group_id} + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#delete-a-self-hosted-runner-group-from-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /enterprises/{enterprise}/actions/runner-groups/{runner_group_id} + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#get-a-self-hosted-runner-group-for-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /enterprises/{enterprise}/actions/runner-groups/{runner_group_id} + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#update-a-self-hosted-runner-group-for-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#list-organization-access-to-a-self-hosted-runner-group-in-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#set-organization-access-for-a-self-hosted-runner-group-in-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations/{org_id} + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#remove-organization-access-to-a-self-hosted-runner-group-in-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations/{org_id} + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#add-organization-access-to-a-self-hosted-runner-group-in-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#list-self-hosted-runners-in-a-group-for-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#set-self-hosted-runners-in-a-group-for-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners/{runner_id} + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#remove-a-self-hosted-runner-from-a-group-for-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners/{runner_id} + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#add-a-self-hosted-runner-to-a-group-for-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /enterprises/{enterprise}/actions/runners + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runners#list-self-hosted-runners-for-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /enterprises/{enterprise}/actions/runners/downloads + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runners#list-runner-applications-for-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /enterprises/{enterprise}/actions/runners/generate-jitconfig + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runners#create-configuration-for-a-just-in-time-runner-for-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /enterprises/{enterprise}/actions/runners/registration-token + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runners#create-a-registration-token-for-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /enterprises/{enterprise}/actions/runners/remove-token + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runners#create-a-remove-token-for-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /enterprises/{enterprise}/actions/runners/{runner_id} + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runners#delete-a-self-hosted-runner-from-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /enterprises/{enterprise}/actions/runners/{runner_id} + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runners#get-a-self-hosted-runner-for-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /enterprises/{enterprise}/actions/runners/{runner_id}/labels + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runners#remove-all-custom-labels-from-a-self-hosted-runner-for-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /enterprises/{enterprise}/actions/runners/{runner_id}/labels + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runners#list-labels-for-a-self-hosted-runner-for-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /enterprises/{enterprise}/actions/runners/{runner_id}/labels + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runners#add-custom-labels-to-a-self-hosted-runner-for-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /enterprises/{enterprise}/actions/runners/{runner_id}/labels + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runners#set-custom-labels-for-a-self-hosted-runner-for-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /enterprises/{enterprise}/actions/runners/{runner_id}/labels/{name} + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runners#remove-a-custom-label-from-a-self-hosted-runner-for-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /enterprises/{enterprise}/announcement + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/announcement-banners/enterprises#remove-announcement-banner-from-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - name: GET /enterprises/{enterprise}/announcement + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/announcement-banners/enterprises#get-announcement-banner-for-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - name: PATCH /enterprises/{enterprise}/announcement + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/announcement-banners/enterprises#set-announcement-banner-for-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - name: GET /enterprises/{enterprise}/audit-log + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/audit-log#get-the-audit-log-for-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /enterprises/{enterprise}/code-scanning/alerts + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/code-scanning/code-scanning#list-code-scanning-alerts-for-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /enterprises/{enterprise}/code_security_and_analysis + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/code-security-and-analysis#get-code-security-and-analysis-features-for-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /enterprises/{enterprise}/code_security_and_analysis + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/code-security-and-analysis#update-code-security-and-analysis-features-for-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /enterprises/{enterprise}/consumed-licenses + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/license#list-enterprise-consumed-licenses + openapi_files: + - descriptions/ghec/ghec.json + - name: GET /enterprises/{enterprise}/dependabot/alerts + documentation_url: https://docs.github.com/rest/dependabot/alerts#list-dependabot-alerts-for-an-enterprise + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /enterprises/{enterprise}/license-sync-status + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/license#get-a-license-sync-status + openapi_files: + - descriptions/ghec/ghec.json + - name: GET /enterprises/{enterprise}/secret-scanning/alerts + documentation_url: https://docs.github.com/rest/secret-scanning/secret-scanning#list-secret-scanning-alerts-for-an-enterprise + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /enterprises/{enterprise}/settings/billing/actions + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/billing#get-github-actions-billing-for-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - name: GET /enterprises/{enterprise}/settings/billing/advanced-security + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/billing#get-github-advanced-security-active-committers-for-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /enterprises/{enterprise}/settings/billing/packages + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/billing#get-github-packages-billing-for-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - name: GET /enterprises/{enterprise}/settings/billing/shared-storage + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/billing#get-shared-storage-billing-for-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - name: POST /enterprises/{enterprise}/{security_product}/{enablement} + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/code-security-and-analysis#enable-or-disable-a-security-feature + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /events + documentation_url: https://docs.github.com/rest/activity/events#list-public-events + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /feeds + documentation_url: https://docs.github.com/rest/activity/feeds#get-feeds + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /gists + documentation_url: https://docs.github.com/rest/gists/gists#list-gists-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /gists + documentation_url: https://docs.github.com/rest/gists/gists#create-a-gist + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /gists/public + documentation_url: https://docs.github.com/rest/gists/gists#list-public-gists + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /gists/starred + documentation_url: https://docs.github.com/rest/gists/gists#list-starred-gists + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /gists/{gist_id} + documentation_url: https://docs.github.com/rest/gists/gists#delete-a-gist + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /gists/{gist_id} + documentation_url: https://docs.github.com/rest/gists/gists#get-a-gist + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /gists/{gist_id} + documentation_url: https://docs.github.com/rest/gists/gists#update-a-gist + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /gists/{gist_id}/comments + documentation_url: https://docs.github.com/rest/gists/comments#list-gist-comments + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /gists/{gist_id}/comments + documentation_url: https://docs.github.com/rest/gists/comments#create-a-gist-comment + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /gists/{gist_id}/comments/{comment_id} + documentation_url: https://docs.github.com/rest/gists/comments#delete-a-gist-comment + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /gists/{gist_id}/comments/{comment_id} + documentation_url: https://docs.github.com/rest/gists/comments#get-a-gist-comment + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /gists/{gist_id}/comments/{comment_id} + documentation_url: https://docs.github.com/rest/gists/comments#update-a-gist-comment + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /gists/{gist_id}/commits + documentation_url: https://docs.github.com/rest/gists/gists#list-gist-commits + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /gists/{gist_id}/forks + documentation_url: https://docs.github.com/rest/gists/gists#list-gist-forks + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /gists/{gist_id}/forks + documentation_url: https://docs.github.com/rest/gists/gists#fork-a-gist + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /gists/{gist_id}/star + documentation_url: https://docs.github.com/rest/gists/gists#unstar-a-gist + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /gists/{gist_id}/star + documentation_url: https://docs.github.com/rest/gists/gists#check-if-a-gist-is-starred + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /gists/{gist_id}/star + documentation_url: https://docs.github.com/rest/gists/gists#star-a-gist + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /gists/{gist_id}/{sha} + documentation_url: https://docs.github.com/rest/gists/gists#get-a-gist-revision + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /gitignore/templates + documentation_url: https://docs.github.com/rest/gitignore/gitignore#get-all-gitignore-templates + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /gitignore/templates/{name} + documentation_url: https://docs.github.com/rest/gitignore/gitignore#get-a-gitignore-template + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /installation/repositories + documentation_url: https://docs.github.com/rest/apps/installations#list-repositories-accessible-to-the-app-installation + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /installation/token + documentation_url: https://docs.github.com/rest/apps/installations#revoke-an-installation-access-token + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /issues + documentation_url: https://docs.github.com/rest/issues/issues#list-issues-assigned-to-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /licenses + documentation_url: https://docs.github.com/rest/licenses/licenses#get-all-commonly-used-licenses + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /licenses/{license} + documentation_url: https://docs.github.com/rest/licenses/licenses#get-a-license + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /manage/v1/config/nodes + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/manage-ghes#get-ghes-node-metadata-for-all-nodes + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /manage/v1/maintenance + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/manage-ghes#get-the-status-of-maintenance-mode + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /manage/v1/maintenance + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/manage-ghes#set-the-status-of-maintenance-mode + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /manage/v1/replication/status + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/manage-ghes#get-the-status-of-services-running-on-all-replica-nodes + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /manage/v1/version + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/manage-ghes#get-all-ghes-release-versions-for-all-nodes + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /markdown + documentation_url: https://docs.github.com/rest/markdown/markdown#render-a-markdown-document + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /markdown/raw + documentation_url: https://docs.github.com/rest/markdown/markdown#render-a-markdown-document-in-raw-mode + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /marketplace_listing/accounts/{account_id} + documentation_url: https://docs.github.com/rest/apps/marketplace#get-a-subscription-plan-for-an-account + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /marketplace_listing/plans + documentation_url: https://docs.github.com/rest/apps/marketplace#list-plans + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /marketplace_listing/plans/{plan_id}/accounts + documentation_url: https://docs.github.com/rest/apps/marketplace#list-accounts-for-a-plan + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /marketplace_listing/stubbed/accounts/{account_id} + documentation_url: https://docs.github.com/rest/apps/marketplace#get-a-subscription-plan-for-an-account-stubbed + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /marketplace_listing/stubbed/plans + documentation_url: https://docs.github.com/rest/apps/marketplace#list-plans-stubbed + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /marketplace_listing/stubbed/plans/{plan_id}/accounts + documentation_url: https://docs.github.com/rest/apps/marketplace#list-accounts-for-a-plan-stubbed + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /meta + documentation_url: https://docs.github.com/rest/meta/meta#get-apiname-meta-information + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /networks/{owner}/{repo}/events + documentation_url: https://docs.github.com/rest/activity/events#list-public-events-for-a-network-of-repositories + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /notifications + documentation_url: https://docs.github.com/rest/activity/notifications#list-notifications-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /notifications + documentation_url: https://docs.github.com/rest/activity/notifications#mark-notifications-as-read + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /notifications/threads/{thread_id} + documentation_url: https://docs.github.com/rest/activity/notifications#get-a-thread + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /notifications/threads/{thread_id} + documentation_url: https://docs.github.com/rest/activity/notifications#mark-a-thread-as-read + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /notifications/threads/{thread_id}/subscription + documentation_url: https://docs.github.com/rest/activity/notifications#delete-a-thread-subscription + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /notifications/threads/{thread_id}/subscription + documentation_url: https://docs.github.com/rest/activity/notifications#get-a-thread-subscription-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /notifications/threads/{thread_id}/subscription + documentation_url: https://docs.github.com/rest/activity/notifications#set-a-thread-subscription + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /octocat + documentation_url: https://docs.github.com/rest/meta/meta#get-octocat + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /organizations + documentation_url: https://docs.github.com/rest/orgs/orgs#list-organizations + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /organizations/{organization_id}/custom_roles + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/orgs/custom-roles#deprecated---list-custom-repository-roles-in-an-organization + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /orgs/{org} + documentation_url: https://docs.github.com/rest/orgs/orgs#delete-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org} + documentation_url: https://docs.github.com/rest/orgs/orgs#get-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /orgs/{org} + documentation_url: https://docs.github.com/rest/orgs/orgs#update-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/actions/cache/usage + documentation_url: https://docs.github.com/rest/actions/cache#get-github-actions-cache-usage-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/actions/cache/usage-by-repository + documentation_url: https://docs.github.com/rest/actions/cache#list-repositories-with-github-actions-cache-usage-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/actions/oidc/customization/sub + documentation_url: https://docs.github.com/rest/actions/oidc#get-the-customization-template-for-an-oidc-subject-claim-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /orgs/{org}/actions/oidc/customization/sub + documentation_url: https://docs.github.com/rest/actions/oidc#set-the-customization-template-for-an-oidc-subject-claim-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/actions/permissions + documentation_url: https://docs.github.com/rest/actions/permissions#get-github-actions-permissions-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /orgs/{org}/actions/permissions + documentation_url: https://docs.github.com/rest/actions/permissions#set-github-actions-permissions-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/actions/permissions/repositories + documentation_url: https://docs.github.com/rest/actions/permissions#list-selected-repositories-enabled-for-github-actions-in-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /orgs/{org}/actions/permissions/repositories + documentation_url: https://docs.github.com/rest/actions/permissions#set-selected-repositories-enabled-for-github-actions-in-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /orgs/{org}/actions/permissions/repositories/{repository_id} + documentation_url: https://docs.github.com/rest/actions/permissions#disable-a-selected-repository-for-github-actions-in-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /orgs/{org}/actions/permissions/repositories/{repository_id} + documentation_url: https://docs.github.com/rest/actions/permissions#enable-a-selected-repository-for-github-actions-in-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/actions/permissions/selected-actions + documentation_url: https://docs.github.com/rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /orgs/{org}/actions/permissions/selected-actions + documentation_url: https://docs.github.com/rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/actions/permissions/workflow + documentation_url: https://docs.github.com/rest/actions/permissions#get-default-workflow-permissions-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /orgs/{org}/actions/permissions/workflow + documentation_url: https://docs.github.com/rest/actions/permissions#set-default-workflow-permissions-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/actions/runner-groups + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#list-self-hosted-runner-groups-for-an-organization + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /orgs/{org}/actions/runner-groups + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#create-a-self-hosted-runner-group-for-an-organization + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /orgs/{org}/actions/runner-groups/{runner_group_id} + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#delete-a-self-hosted-runner-group-from-an-organization + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/actions/runner-groups/{runner_group_id} + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#get-a-self-hosted-runner-group-for-an-organization + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /orgs/{org}/actions/runner-groups/{runner_group_id} + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#update-a-self-hosted-runner-group-for-an-organization + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#list-repository-access-to-a-self-hosted-runner-group-in-an-organization + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#set-repository-access-for-a-self-hosted-runner-group-in-an-organization + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories/{repository_id} + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#remove-repository-access-to-a-self-hosted-runner-group-in-an-organization + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories/{repository_id} + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#add-repository-access-to-a-self-hosted-runner-group-in-an-organization + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/actions/runner-groups/{runner_group_id}/runners + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#list-self-hosted-runners-in-a-group-for-an-organization + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /orgs/{org}/actions/runner-groups/{runner_group_id}/runners + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#set-self-hosted-runners-in-a-group-for-an-organization + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /orgs/{org}/actions/runner-groups/{runner_group_id}/runners/{runner_id} + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#remove-a-self-hosted-runner-from-a-group-for-an-organization + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /orgs/{org}/actions/runner-groups/{runner_group_id}/runners/{runner_id} + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#add-a-self-hosted-runner-to-a-group-for-an-organization + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/actions/runners + documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#list-self-hosted-runners-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/actions/runners/downloads + documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#list-runner-applications-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /orgs/{org}/actions/runners/generate-jitconfig + documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#create-configuration-for-a-just-in-time-runner-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /orgs/{org}/actions/runners/registration-token + documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#create-a-registration-token-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /orgs/{org}/actions/runners/remove-token + documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#create-a-remove-token-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /orgs/{org}/actions/runners/{runner_id} + documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#delete-a-self-hosted-runner-from-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/actions/runners/{runner_id} + documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#get-a-self-hosted-runner-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /orgs/{org}/actions/runners/{runner_id}/labels + documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#remove-all-custom-labels-from-a-self-hosted-runner-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/actions/runners/{runner_id}/labels + documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#list-labels-for-a-self-hosted-runner-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /orgs/{org}/actions/runners/{runner_id}/labels + documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#add-custom-labels-to-a-self-hosted-runner-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /orgs/{org}/actions/runners/{runner_id}/labels + documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#set-custom-labels-for-a-self-hosted-runner-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /orgs/{org}/actions/runners/{runner_id}/labels/{name} + documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#remove-a-custom-label-from-a-self-hosted-runner-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/actions/secrets + documentation_url: https://docs.github.com/rest/actions/secrets#list-organization-secrets + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/actions/secrets/public-key + documentation_url: https://docs.github.com/rest/actions/secrets#get-an-organization-public-key + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /orgs/{org}/actions/secrets/{secret_name} + documentation_url: https://docs.github.com/rest/actions/secrets#delete-an-organization-secret + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/actions/secrets/{secret_name} + documentation_url: https://docs.github.com/rest/actions/secrets#get-an-organization-secret + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /orgs/{org}/actions/secrets/{secret_name} + documentation_url: https://docs.github.com/rest/actions/secrets#create-or-update-an-organization-secret + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/actions/secrets/{secret_name}/repositories + documentation_url: https://docs.github.com/rest/actions/secrets#list-selected-repositories-for-an-organization-secret + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /orgs/{org}/actions/secrets/{secret_name}/repositories + documentation_url: https://docs.github.com/rest/actions/secrets#set-selected-repositories-for-an-organization-secret + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id} + documentation_url: https://docs.github.com/rest/actions/secrets#remove-selected-repository-from-an-organization-secret + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id} + documentation_url: https://docs.github.com/rest/actions/secrets#add-selected-repository-to-an-organization-secret + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/actions/variables + documentation_url: https://docs.github.com/rest/actions/variables#list-organization-variables + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /orgs/{org}/actions/variables + documentation_url: https://docs.github.com/rest/actions/variables#create-an-organization-variable + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /orgs/{org}/actions/variables/{name} + documentation_url: https://docs.github.com/rest/actions/variables#delete-an-organization-variable + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/actions/variables/{name} + documentation_url: https://docs.github.com/rest/actions/variables#get-an-organization-variable + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /orgs/{org}/actions/variables/{name} + documentation_url: https://docs.github.com/rest/actions/variables#update-an-organization-variable + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/actions/variables/{name}/repositories + documentation_url: https://docs.github.com/rest/actions/variables#list-selected-repositories-for-an-organization-variable + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /orgs/{org}/actions/variables/{name}/repositories + documentation_url: https://docs.github.com/rest/actions/variables#set-selected-repositories-for-an-organization-variable + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /orgs/{org}/actions/variables/{name}/repositories/{repository_id} + documentation_url: https://docs.github.com/rest/actions/variables#remove-selected-repository-from-an-organization-variable + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /orgs/{org}/actions/variables/{name}/repositories/{repository_id} + documentation_url: https://docs.github.com/rest/actions/variables#add-selected-repository-to-an-organization-variable + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /orgs/{org}/announcement + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/announcement-banners/organizations#remove-announcement-banner-from-organization + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/announcement + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/announcement-banners/organizations#get-announcement-banner-for-organization + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /orgs/{org}/announcement + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/announcement-banners/organizations#set-announcement-banner-for-organization + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/audit-log + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/orgs/orgs#get-the-audit-log-for-an-organization + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/blocks + documentation_url: https://docs.github.com/rest/orgs/blocking#list-users-blocked-by-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: DELETE /orgs/{org}/blocks/{username} + documentation_url: https://docs.github.com/rest/orgs/blocking#unblock-a-user-from-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /orgs/{org}/blocks/{username} + documentation_url: https://docs.github.com/rest/orgs/blocking#check-if-a-user-is-blocked-by-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: PUT /orgs/{org}/blocks/{username} + documentation_url: https://docs.github.com/rest/orgs/blocking#block-a-user-from-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /orgs/{org}/code-scanning/alerts + documentation_url: https://docs.github.com/rest/code-scanning/code-scanning#list-code-scanning-alerts-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/codespaces + documentation_url: https://docs.github.com/rest/codespaces/organizations#list-codespaces-for-the-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: PUT /orgs/{org}/codespaces/access + documentation_url: https://docs.github.com/rest/codespaces/organizations#manage-access-control-for-organization-codespaces + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: DELETE /orgs/{org}/codespaces/access/selected_users + documentation_url: https://docs.github.com/rest/codespaces/organizations#remove-users-from-codespaces-access-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: POST /orgs/{org}/codespaces/access/selected_users + documentation_url: https://docs.github.com/rest/codespaces/organizations#add-users-to-codespaces-access-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /orgs/{org}/codespaces/secrets + documentation_url: https://docs.github.com/rest/codespaces/organization-secrets#list-organization-secrets + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /orgs/{org}/codespaces/secrets/public-key + documentation_url: https://docs.github.com/rest/codespaces/organization-secrets#get-an-organization-public-key + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: DELETE /orgs/{org}/codespaces/secrets/{secret_name} + documentation_url: https://docs.github.com/rest/codespaces/organization-secrets#delete-an-organization-secret + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /orgs/{org}/codespaces/secrets/{secret_name} + documentation_url: https://docs.github.com/rest/codespaces/organization-secrets#get-an-organization-secret + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: PUT /orgs/{org}/codespaces/secrets/{secret_name} + documentation_url: https://docs.github.com/rest/codespaces/organization-secrets#create-or-update-an-organization-secret + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /orgs/{org}/codespaces/secrets/{secret_name}/repositories + documentation_url: https://docs.github.com/rest/codespaces/organization-secrets#list-selected-repositories-for-an-organization-secret + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: PUT /orgs/{org}/codespaces/secrets/{secret_name}/repositories + documentation_url: https://docs.github.com/rest/codespaces/organization-secrets#set-selected-repositories-for-an-organization-secret + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: DELETE /orgs/{org}/codespaces/secrets/{secret_name}/repositories/{repository_id} + documentation_url: https://docs.github.com/rest/codespaces/organization-secrets#remove-selected-repository-from-an-organization-secret + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: PUT /orgs/{org}/codespaces/secrets/{secret_name}/repositories/{repository_id} + documentation_url: https://docs.github.com/rest/codespaces/organization-secrets#add-selected-repository-to-an-organization-secret + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /orgs/{org}/copilot/billing + documentation_url: https://docs.github.com/rest/copilot/copilot-for-business#get-copilot-for-business-seat-information-and-settings-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /orgs/{org}/copilot/billing/seats + documentation_url: https://docs.github.com/rest/copilot/copilot-for-business#list-all-copilot-for-business-seat-assignments-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: DELETE /orgs/{org}/copilot/billing/selected_teams + documentation_url: https://docs.github.com/rest/copilot/copilot-for-business#remove-teams-from-the-copilot-for-business-subscription-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: POST /orgs/{org}/copilot/billing/selected_teams + documentation_url: https://docs.github.com/rest/copilot/copilot-for-business#add-teams-to-the-copilot-for-business-subscription-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: DELETE /orgs/{org}/copilot/billing/selected_users + documentation_url: https://docs.github.com/rest/copilot/copilot-for-business#remove-users-from-the-copilot-for-business-subscription-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: POST /orgs/{org}/copilot/billing/selected_users + documentation_url: https://docs.github.com/rest/copilot/copilot-for-business#add-users-to-the-copilot-for-business-subscription-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /orgs/{org}/credential-authorizations + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/orgs/orgs#list-saml-sso-authorizations-for-an-organization + openapi_files: + - descriptions/ghec/ghec.json + - name: DELETE /orgs/{org}/credential-authorizations/{credential_id} + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/orgs/orgs#remove-a-saml-sso-authorization-for-an-organization + openapi_files: + - descriptions/ghec/ghec.json + - name: GET /orgs/{org}/custom-repository-roles + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/orgs/custom-roles#list-custom-repository-roles-in-an-organization + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /orgs/{org}/custom-repository-roles + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/orgs/custom-roles#create-a-custom-repository-role + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /orgs/{org}/custom-repository-roles/{role_id} + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/orgs/custom-roles#delete-a-custom-repository-role + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/custom-repository-roles/{role_id} + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/orgs/custom-roles#get-a-custom-repository-role + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /orgs/{org}/custom-repository-roles/{role_id} + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/orgs/custom-roles#update-a-custom-repository-role + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /orgs/{org}/custom_roles + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/orgs/custom-roles#deprecated---create-a-custom-role + openapi_files: + - descriptions/ghec/ghec.json + - name: DELETE /orgs/{org}/custom_roles/{role_id} + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/orgs/custom-roles#deprecated---delete-a-custom-role + openapi_files: + - descriptions/ghec/ghec.json + - name: GET /orgs/{org}/custom_roles/{role_id} + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/orgs/custom-roles#deprecated---get-a-custom-role + openapi_files: + - descriptions/ghec/ghec.json + - name: PATCH /orgs/{org}/custom_roles/{role_id} + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/orgs/custom-roles#deprecated---update-a-custom-role + openapi_files: + - descriptions/ghec/ghec.json + - name: GET /orgs/{org}/dependabot/alerts + documentation_url: https://docs.github.com/rest/dependabot/alerts#list-dependabot-alerts-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/dependabot/secrets + documentation_url: https://docs.github.com/rest/dependabot/secrets#list-organization-secrets + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/dependabot/secrets/public-key + documentation_url: https://docs.github.com/rest/dependabot/secrets#get-an-organization-public-key + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /orgs/{org}/dependabot/secrets/{secret_name} + documentation_url: https://docs.github.com/rest/dependabot/secrets#delete-an-organization-secret + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/dependabot/secrets/{secret_name} + documentation_url: https://docs.github.com/rest/dependabot/secrets#get-an-organization-secret + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /orgs/{org}/dependabot/secrets/{secret_name} + documentation_url: https://docs.github.com/rest/dependabot/secrets#create-or-update-an-organization-secret + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/dependabot/secrets/{secret_name}/repositories + documentation_url: https://docs.github.com/rest/dependabot/secrets#list-selected-repositories-for-an-organization-secret + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /orgs/{org}/dependabot/secrets/{secret_name}/repositories + documentation_url: https://docs.github.com/rest/dependabot/secrets#set-selected-repositories-for-an-organization-secret + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /orgs/{org}/dependabot/secrets/{secret_name}/repositories/{repository_id} + documentation_url: https://docs.github.com/rest/dependabot/secrets#remove-selected-repository-from-an-organization-secret + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /orgs/{org}/dependabot/secrets/{secret_name}/repositories/{repository_id} + documentation_url: https://docs.github.com/rest/dependabot/secrets#add-selected-repository-to-an-organization-secret + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/docker/conflicts + documentation_url: https://docs.github.com/rest/packages/packages#get-list-of-conflicting-packages-during-docker-migration-for-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/events + documentation_url: https://docs.github.com/rest/activity/events#list-public-organization-events + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/external-group/{group_id} + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/teams/external-groups#get-an-external-group + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/external-groups + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/teams/external-groups#list-external-groups-in-an-organization + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/failed_invitations + documentation_url: https://docs.github.com/rest/orgs/members#list-failed-organization-invitations + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /orgs/{org}/fine_grained_permissions + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/orgs/custom-roles#deprecated---list-fine-grained-permissions-for-an-organization + openapi_files: + - descriptions/ghec/ghec.json + - name: GET /orgs/{org}/hooks + documentation_url: https://docs.github.com/rest/orgs/webhooks#list-organization-webhooks + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /orgs/{org}/hooks + documentation_url: https://docs.github.com/rest/orgs/webhooks#create-an-organization-webhook + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /orgs/{org}/hooks/{hook_id} + documentation_url: https://docs.github.com/rest/orgs/webhooks#delete-an-organization-webhook + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/hooks/{hook_id} + documentation_url: https://docs.github.com/rest/orgs/webhooks#get-an-organization-webhook + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /orgs/{org}/hooks/{hook_id} + documentation_url: https://docs.github.com/rest/orgs/webhooks#update-an-organization-webhook + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/hooks/{hook_id}/config + documentation_url: https://docs.github.com/rest/orgs/webhooks#get-a-webhook-configuration-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /orgs/{org}/hooks/{hook_id}/config + documentation_url: https://docs.github.com/rest/orgs/webhooks#update-a-webhook-configuration-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/hooks/{hook_id}/deliveries + documentation_url: https://docs.github.com/rest/orgs/webhooks#list-deliveries-for-an-organization-webhook + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/hooks/{hook_id}/deliveries/{delivery_id} + documentation_url: https://docs.github.com/rest/orgs/webhooks#get-a-webhook-delivery-for-an-organization-webhook + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /orgs/{org}/hooks/{hook_id}/deliveries/{delivery_id}/attempts + documentation_url: https://docs.github.com/rest/orgs/webhooks#redeliver-a-delivery-for-an-organization-webhook + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /orgs/{org}/hooks/{hook_id}/pings + documentation_url: https://docs.github.com/rest/orgs/webhooks#ping-an-organization-webhook + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/installation + documentation_url: https://docs.github.com/rest/apps/apps#get-an-organization-installation-for-the-authenticated-app + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/installations + documentation_url: https://docs.github.com/rest/orgs/orgs#list-app-installations-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /orgs/{org}/interaction-limits + documentation_url: https://docs.github.com/rest/interactions/orgs#remove-interaction-restrictions-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /orgs/{org}/interaction-limits + documentation_url: https://docs.github.com/rest/interactions/orgs#get-interaction-restrictions-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: PUT /orgs/{org}/interaction-limits + documentation_url: https://docs.github.com/rest/interactions/orgs#set-interaction-restrictions-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /orgs/{org}/invitations + documentation_url: https://docs.github.com/rest/orgs/members#list-pending-organization-invitations + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: POST /orgs/{org}/invitations + documentation_url: https://docs.github.com/rest/orgs/members#create-an-organization-invitation + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: DELETE /orgs/{org}/invitations/{invitation_id} + documentation_url: https://docs.github.com/rest/orgs/members#cancel-an-organization-invitation + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /orgs/{org}/invitations/{invitation_id}/teams + documentation_url: https://docs.github.com/rest/orgs/members#list-organization-invitation-teams + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /orgs/{org}/issues + documentation_url: https://docs.github.com/rest/issues/issues#list-organization-issues-assigned-to-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/members + documentation_url: https://docs.github.com/rest/orgs/members#list-organization-members + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /orgs/{org}/members/{username} + documentation_url: https://docs.github.com/rest/orgs/members#remove-an-organization-member + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/members/{username} + documentation_url: https://docs.github.com/rest/orgs/members#check-organization-membership-for-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/members/{username}/codespaces + documentation_url: https://docs.github.com/rest/codespaces/organizations#list-codespaces-for-a-user-in-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: DELETE /orgs/{org}/members/{username}/codespaces/{codespace_name} + documentation_url: https://docs.github.com/rest/codespaces/organizations#delete-a-codespace-from-the-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: POST /orgs/{org}/members/{username}/codespaces/{codespace_name}/stop + documentation_url: https://docs.github.com/rest/codespaces/organizations#stop-a-codespace-for-an-organization-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /orgs/{org}/members/{username}/copilot + documentation_url: https://docs.github.com/rest/copilot/copilot-for-business#get-copilot-for-business-seat-assignment-details-for-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: DELETE /orgs/{org}/memberships/{username} + documentation_url: https://docs.github.com/rest/orgs/members#remove-organization-membership-for-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/memberships/{username} + documentation_url: https://docs.github.com/rest/orgs/members#get-organization-membership-for-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /orgs/{org}/memberships/{username} + documentation_url: https://docs.github.com/rest/orgs/members#set-organization-membership-for-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/migrations + documentation_url: https://docs.github.com/rest/migrations/orgs#list-organization-migrations + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /orgs/{org}/migrations + documentation_url: https://docs.github.com/rest/migrations/orgs#start-an-organization-migration + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/migrations/{migration_id} + documentation_url: https://docs.github.com/rest/migrations/orgs#get-an-organization-migration-status + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /orgs/{org}/migrations/{migration_id}/archive + documentation_url: https://docs.github.com/rest/migrations/orgs#delete-an-organization-migration-archive + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/migrations/{migration_id}/archive + documentation_url: https://docs.github.com/rest/migrations/orgs#download-an-organization-migration-archive + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /orgs/{org}/migrations/{migration_id}/repos/{repo_name}/lock + documentation_url: https://docs.github.com/rest/migrations/orgs#unlock-an-organization-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/migrations/{migration_id}/repositories + documentation_url: https://docs.github.com/rest/migrations/orgs#list-repositories-in-an-organization-migration + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/outside_collaborators + documentation_url: https://docs.github.com/rest/orgs/outside-collaborators#list-outside-collaborators-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /orgs/{org}/outside_collaborators/{username} + documentation_url: https://docs.github.com/rest/orgs/outside-collaborators#remove-outside-collaborator-from-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /orgs/{org}/outside_collaborators/{username} + documentation_url: https://docs.github.com/rest/orgs/outside-collaborators#convert-an-organization-member-to-outside-collaborator + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/packages + documentation_url: https://docs.github.com/rest/packages/packages#list-packages-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /orgs/{org}/packages/{package_type}/{package_name} + documentation_url: https://docs.github.com/rest/packages/packages#delete-a-package-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/packages/{package_type}/{package_name} + documentation_url: https://docs.github.com/rest/packages/packages#get-a-package-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /orgs/{org}/packages/{package_type}/{package_name}/restore + documentation_url: https://docs.github.com/rest/packages/packages#restore-a-package-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/packages/{package_type}/{package_name}/versions + documentation_url: https://docs.github.com/rest/packages/packages#list-package-versions-for-a-package-owned-by-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id} + documentation_url: https://docs.github.com/rest/packages/packages#delete-package-version-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id} + documentation_url: https://docs.github.com/rest/packages/packages#get-a-package-version-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}/restore + documentation_url: https://docs.github.com/rest/packages/packages#restore-package-version-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/personal-access-token-requests + documentation_url: https://docs.github.com/rest/orgs/personal-access-tokens#list-requests-to-access-organization-resources-with-fine-grained-personal-access-tokens + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /orgs/{org}/personal-access-token-requests + documentation_url: https://docs.github.com/rest/orgs/personal-access-tokens#review-requests-to-access-organization-resources-with-fine-grained-personal-access-tokens + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /orgs/{org}/personal-access-token-requests/{pat_request_id} + documentation_url: https://docs.github.com/rest/orgs/personal-access-tokens#review-a-request-to-access-organization-resources-with-a-fine-grained-personal-access-token + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/personal-access-token-requests/{pat_request_id}/repositories + documentation_url: https://docs.github.com/rest/orgs/personal-access-tokens#list-repositories-requested-to-be-accessed-by-a-fine-grained-personal-access-token + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/personal-access-tokens + documentation_url: https://docs.github.com/rest/orgs/personal-access-tokens#list-fine-grained-personal-access-tokens-with-access-to-organization-resources + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /orgs/{org}/personal-access-tokens + documentation_url: https://docs.github.com/rest/orgs/personal-access-tokens#update-the-access-to-organization-resources-via-fine-grained-personal-access-tokens + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /orgs/{org}/personal-access-tokens/{pat_id} + documentation_url: https://docs.github.com/rest/orgs/personal-access-tokens#update-the-access-a-fine-grained-personal-access-token-has-to-organization-resources + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/personal-access-tokens/{pat_id}/repositories + documentation_url: https://docs.github.com/rest/orgs/personal-access-tokens#list-repositories-a-fine-grained-personal-access-token-has-access-to + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/pre-receive-hooks + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/org-pre-receive-hooks#list-pre-receive-hooks-for-an-organization + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /orgs/{org}/pre-receive-hooks/{pre_receive_hook_id} + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/org-pre-receive-hooks#remove-pre-receive-hook-enforcement-for-an-organization + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/pre-receive-hooks/{pre_receive_hook_id} + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/org-pre-receive-hooks#get-a-pre-receive-hook-for-an-organization + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /orgs/{org}/pre-receive-hooks/{pre_receive_hook_id} + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/org-pre-receive-hooks#update-pre-receive-hook-enforcement-for-an-organization + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/projects + documentation_url: https://docs.github.com/rest/projects/projects#list-organization-projects + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /orgs/{org}/projects + documentation_url: https://docs.github.com/rest/projects/projects#create-an-organization-project + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/properties/schema + documentation_url: https://docs.github.com/rest/orgs/properties#get-all-custom-properties-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: PATCH /orgs/{org}/properties/schema + documentation_url: https://docs.github.com/rest/orgs/properties#create-or-update-custom-properties-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: DELETE /orgs/{org}/properties/schema/{custom_property_name} + documentation_url: https://docs.github.com/rest/orgs/properties#remove-a-custom-property-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /orgs/{org}/properties/schema/{custom_property_name} + documentation_url: https://docs.github.com/rest/orgs/properties#get-a-custom-property-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: PUT /orgs/{org}/properties/schema/{custom_property_name} + documentation_url: https://docs.github.com/rest/orgs/properties#create-or-update-a-custom-property-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /orgs/{org}/properties/values + documentation_url: https://docs.github.com/rest/orgs/properties#list-custom-property-values-for-organization-repositories + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: PATCH /orgs/{org}/properties/values + documentation_url: https://docs.github.com/rest/orgs/properties#create-or-update-custom-property-values-for-organization-repositories + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /orgs/{org}/public_members + documentation_url: https://docs.github.com/rest/orgs/members#list-public-organization-members + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /orgs/{org}/public_members/{username} + documentation_url: https://docs.github.com/rest/orgs/members#remove-public-organization-membership-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/public_members/{username} + documentation_url: https://docs.github.com/rest/orgs/members#check-public-organization-membership-for-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /orgs/{org}/public_members/{username} + documentation_url: https://docs.github.com/rest/orgs/members#set-public-organization-membership-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/repos + documentation_url: https://docs.github.com/rest/repos/repos#list-organization-repositories + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /orgs/{org}/repos + documentation_url: https://docs.github.com/rest/repos/repos#create-an-organization-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/repository-fine-grained-permissions + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/orgs/custom-roles#list-repository-fine-grained-permissions-for-an-organization + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/rulesets + documentation_url: https://docs.github.com/rest/orgs/rules#get-all-organization-repository-rulesets + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: POST /orgs/{org}/rulesets + documentation_url: https://docs.github.com/rest/orgs/rules#create-an-organization-repository-ruleset + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /orgs/{org}/rulesets/rule-suites + documentation_url: https://docs.github.com/rest/orgs/rule-suites#list-organization-rule-suites + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /orgs/{org}/rulesets/rule-suites/{rule_suite_id} + documentation_url: https://docs.github.com/rest/orgs/rule-suites#get-an-organization-rule-suite + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: DELETE /orgs/{org}/rulesets/{ruleset_id} + documentation_url: https://docs.github.com/rest/orgs/rules#delete-an-organization-repository-ruleset + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /orgs/{org}/rulesets/{ruleset_id} + documentation_url: https://docs.github.com/rest/orgs/rules#get-an-organization-repository-ruleset + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: PUT /orgs/{org}/rulesets/{ruleset_id} + documentation_url: https://docs.github.com/rest/orgs/rules#update-an-organization-repository-ruleset + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /orgs/{org}/secret-scanning/alerts + documentation_url: https://docs.github.com/rest/secret-scanning/secret-scanning#list-secret-scanning-alerts-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/security-advisories + documentation_url: https://docs.github.com/rest/security-advisories/repository-advisories#list-repository-security-advisories-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /orgs/{org}/security-managers + documentation_url: https://docs.github.com/rest/orgs/security-managers#list-security-manager-teams + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /orgs/{org}/security-managers/teams/{team_slug} + documentation_url: https://docs.github.com/rest/orgs/security-managers#remove-a-security-manager-team + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /orgs/{org}/security-managers/teams/{team_slug} + documentation_url: https://docs.github.com/rest/orgs/security-managers#add-a-security-manager-team + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/settings/billing/actions + documentation_url: https://docs.github.com/rest/billing/billing#get-github-actions-billing-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /orgs/{org}/settings/billing/advanced-security + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/billing/billing#get-github-advanced-security-active-committers-for-an-organization + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/settings/billing/packages + documentation_url: https://docs.github.com/rest/billing/billing#get-github-packages-billing-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /orgs/{org}/settings/billing/shared-storage + documentation_url: https://docs.github.com/rest/billing/billing#get-shared-storage-billing-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /orgs/{org}/team-sync/groups + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/teams/team-sync#list-idp-groups-for-an-organization + openapi_files: + - descriptions/ghec/ghec.json + - name: GET /orgs/{org}/teams + documentation_url: https://docs.github.com/rest/teams/teams#list-teams + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /orgs/{org}/teams + documentation_url: https://docs.github.com/rest/teams/teams#create-a-team + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /orgs/{org}/teams/{team_slug} + documentation_url: https://docs.github.com/rest/teams/teams#delete-a-team + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/teams/{team_slug} + documentation_url: https://docs.github.com/rest/teams/teams#get-a-team-by-name + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /orgs/{org}/teams/{team_slug} + documentation_url: https://docs.github.com/rest/teams/teams#update-a-team + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/teams/{team_slug}/discussions + documentation_url: https://docs.github.com/rest/teams/discussions#list-discussions + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /orgs/{org}/teams/{team_slug}/discussions + documentation_url: https://docs.github.com/rest/teams/discussions#create-a-discussion + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number} + documentation_url: https://docs.github.com/rest/teams/discussions#delete-a-discussion + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number} + documentation_url: https://docs.github.com/rest/teams/discussions#get-a-discussion + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /orgs/{org}/teams/{team_slug}/discussions/{discussion_number} + documentation_url: https://docs.github.com/rest/teams/discussions#update-a-discussion + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments + documentation_url: https://docs.github.com/rest/teams/discussion-comments#list-discussion-comments + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments + documentation_url: https://docs.github.com/rest/teams/discussion-comments#create-a-discussion-comment + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number} + documentation_url: https://docs.github.com/rest/teams/discussion-comments#delete-a-discussion-comment + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number} + documentation_url: https://docs.github.com/rest/teams/discussion-comments#get-a-discussion-comment + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number} + documentation_url: https://docs.github.com/rest/teams/discussion-comments#update-a-discussion-comment + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions + documentation_url: https://docs.github.com/rest/reactions/reactions#list-reactions-for-a-team-discussion-comment + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions + documentation_url: https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-team-discussion-comment + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions/{reaction_id} + documentation_url: https://docs.github.com/rest/reactions/reactions#delete-team-discussion-comment-reaction + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions + documentation_url: https://docs.github.com/rest/reactions/reactions#list-reactions-for-a-team-discussion + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions + documentation_url: https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-team-discussion + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions/{reaction_id} + documentation_url: https://docs.github.com/rest/reactions/reactions#delete-team-discussion-reaction + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /orgs/{org}/teams/{team_slug}/external-groups + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/teams/external-groups#remove-the-connection-between-an-external-group-and-a-team + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/teams/{team_slug}/external-groups + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/teams/external-groups#list-a-connection-between-an-external-group-and-a-team + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /orgs/{org}/teams/{team_slug}/external-groups + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/teams/external-groups#update-the-connection-between-an-external-group-and-a-team + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/teams/{team_slug}/invitations + documentation_url: https://docs.github.com/rest/teams/members#list-pending-team-invitations + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /orgs/{org}/teams/{team_slug}/members + documentation_url: https://docs.github.com/rest/teams/members#list-team-members + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /orgs/{org}/teams/{team_slug}/memberships/{username} + documentation_url: https://docs.github.com/rest/teams/members#remove-team-membership-for-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/teams/{team_slug}/memberships/{username} + documentation_url: https://docs.github.com/rest/teams/members#get-team-membership-for-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /orgs/{org}/teams/{team_slug}/memberships/{username} + documentation_url: https://docs.github.com/rest/teams/members#add-or-update-team-membership-for-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/teams/{team_slug}/projects + documentation_url: https://docs.github.com/rest/teams/teams#list-team-projects + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /orgs/{org}/teams/{team_slug}/projects/{project_id} + documentation_url: https://docs.github.com/rest/teams/teams#remove-a-project-from-a-team + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/teams/{team_slug}/projects/{project_id} + documentation_url: https://docs.github.com/rest/teams/teams#check-team-permissions-for-a-project + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /orgs/{org}/teams/{team_slug}/projects/{project_id} + documentation_url: https://docs.github.com/rest/teams/teams#add-or-update-team-project-permissions + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/teams/{team_slug}/repos + documentation_url: https://docs.github.com/rest/teams/teams#list-team-repositories + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} + documentation_url: https://docs.github.com/rest/teams/teams#remove-a-repository-from-a-team + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} + documentation_url: https://docs.github.com/rest/teams/teams#check-team-permissions-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} + documentation_url: https://docs.github.com/rest/teams/teams#add-or-update-team-repository-permissions + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /orgs/{org}/teams/{team_slug}/team-sync/group-mappings + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/teams/team-sync#list-idp-groups-for-a-team + openapi_files: + - descriptions/ghec/ghec.json + - name: PATCH /orgs/{org}/teams/{team_slug}/team-sync/group-mappings + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/teams/team-sync#create-or-update-idp-group-connections + openapi_files: + - descriptions/ghec/ghec.json + - name: GET /orgs/{org}/teams/{team_slug}/teams + documentation_url: https://docs.github.com/rest/teams/teams#list-child-teams + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /orgs/{org}/{security_product}/{enablement} + documentation_url: https://docs.github.com/rest/orgs/orgs#enable-or-disable-a-security-feature-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /projects/columns/cards/{card_id} + documentation_url: https://docs.github.com/rest/projects/cards#delete-a-project-card + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /projects/columns/cards/{card_id} + documentation_url: https://docs.github.com/rest/projects/cards#get-a-project-card + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /projects/columns/cards/{card_id} + documentation_url: https://docs.github.com/rest/projects/cards#update-an-existing-project-card + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /projects/columns/cards/{card_id}/moves + documentation_url: https://docs.github.com/rest/projects/cards#move-a-project-card + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /projects/columns/{column_id} + documentation_url: https://docs.github.com/rest/projects/columns#delete-a-project-column + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /projects/columns/{column_id} + documentation_url: https://docs.github.com/rest/projects/columns#get-a-project-column + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /projects/columns/{column_id} + documentation_url: https://docs.github.com/rest/projects/columns#update-an-existing-project-column + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /projects/columns/{column_id}/cards + documentation_url: https://docs.github.com/rest/projects/cards#list-project-cards + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /projects/columns/{column_id}/cards + documentation_url: https://docs.github.com/rest/projects/cards#create-a-project-card + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /projects/columns/{column_id}/moves + documentation_url: https://docs.github.com/rest/projects/columns#move-a-project-column + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /projects/{project_id} + documentation_url: https://docs.github.com/rest/projects/projects#delete-a-project + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /projects/{project_id} + documentation_url: https://docs.github.com/rest/projects/projects#get-a-project + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /projects/{project_id} + documentation_url: https://docs.github.com/rest/projects/projects#update-a-project + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /projects/{project_id}/collaborators + documentation_url: https://docs.github.com/rest/projects/collaborators#list-project-collaborators + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /projects/{project_id}/collaborators/{username} + documentation_url: https://docs.github.com/rest/projects/collaborators#remove-user-as-a-collaborator + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /projects/{project_id}/collaborators/{username} + documentation_url: https://docs.github.com/rest/projects/collaborators#add-project-collaborator + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /projects/{project_id}/collaborators/{username}/permission + documentation_url: https://docs.github.com/rest/projects/collaborators#get-project-permission-for-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /projects/{project_id}/columns + documentation_url: https://docs.github.com/rest/projects/columns#list-project-columns + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /projects/{project_id}/columns + documentation_url: https://docs.github.com/rest/projects/columns#create-a-project-column + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /rate_limit + documentation_url: https://docs.github.com/rest/rate-limit/rate-limit#get-rate-limit-status-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /reactions/{reaction_id} + documentation_url: https://docs.github.com/enterprise-server@3.4/rest/reference/reactions/#delete-a-reaction-legacy + openapi_files: + - descriptions/ghes-3.4/ghes-3.4.json + - name: DELETE /repos/{owner}/{repo} + documentation_url: https://docs.github.com/rest/repos/repos#delete-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo} + documentation_url: https://docs.github.com/rest/repos/repos#get-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /repos/{owner}/{repo} + documentation_url: https://docs.github.com/rest/repos/repos#update-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/actions/artifacts + documentation_url: https://docs.github.com/rest/actions/artifacts#list-artifacts-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/actions/artifacts/{artifact_id} + documentation_url: https://docs.github.com/rest/actions/artifacts#delete-an-artifact + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id} + documentation_url: https://docs.github.com/rest/actions/artifacts#get-an-artifact + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}/{archive_format} + documentation_url: https://docs.github.com/rest/actions/artifacts#download-an-artifact + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/actions/cache/usage + documentation_url: https://docs.github.com/rest/actions/cache#get-github-actions-cache-usage-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/actions/cache/usage-policy + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/actions/cache#get-github-actions-cache-usage-policy-for-a-repository + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /repos/{owner}/{repo}/actions/cache/usage-policy + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/actions/cache#set-github-actions-cache-usage-policy-for-a-repository + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/actions/caches + documentation_url: https://docs.github.com/rest/actions/cache#delete-github-actions-caches-for-a-repository-using-a-cache-key + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/actions/caches + documentation_url: https://docs.github.com/rest/actions/cache#list-github-actions-caches-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/actions/caches/{cache_id} + documentation_url: https://docs.github.com/rest/actions/cache#delete-a-github-actions-cache-for-a-repository-using-a-cache-id + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/actions/jobs/{job_id} + documentation_url: https://docs.github.com/rest/actions/workflow-jobs#get-a-job-for-a-workflow-run + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/actions/jobs/{job_id}/logs + documentation_url: https://docs.github.com/rest/actions/workflow-jobs#download-job-logs-for-a-workflow-run + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/actions/jobs/{job_id}/rerun + documentation_url: https://docs.github.com/rest/actions/workflow-runs#re-run-a-job-from-a-workflow-run + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/actions/oidc/customization/sub + documentation_url: https://docs.github.com/rest/actions/oidc#get-the-customization-template-for-an-oidc-subject-claim-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /repos/{owner}/{repo}/actions/oidc/customization/sub + documentation_url: https://docs.github.com/rest/actions/oidc#set-the-customization-template-for-an-oidc-subject-claim-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/actions/organization-secrets + documentation_url: https://docs.github.com/rest/actions/secrets#list-repository-organization-secrets + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/actions/organization-variables + documentation_url: https://docs.github.com/rest/actions/variables#list-repository-organization-variables + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/actions/permissions + documentation_url: https://docs.github.com/rest/actions/permissions#get-github-actions-permissions-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /repos/{owner}/{repo}/actions/permissions + documentation_url: https://docs.github.com/rest/actions/permissions#set-github-actions-permissions-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/actions/permissions/access + documentation_url: https://docs.github.com/rest/actions/permissions#get-the-level-of-access-for-workflows-outside-of-the-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /repos/{owner}/{repo}/actions/permissions/access + documentation_url: https://docs.github.com/rest/actions/permissions#set-the-level-of-access-for-workflows-outside-of-the-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/actions/permissions/selected-actions + documentation_url: https://docs.github.com/rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /repos/{owner}/{repo}/actions/permissions/selected-actions + documentation_url: https://docs.github.com/rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/actions/permissions/workflow + documentation_url: https://docs.github.com/rest/actions/permissions#get-default-workflow-permissions-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /repos/{owner}/{repo}/actions/permissions/workflow + documentation_url: https://docs.github.com/rest/actions/permissions#set-default-workflow-permissions-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/actions/runners + documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#list-self-hosted-runners-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/actions/runners/downloads + documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#list-runner-applications-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/actions/runners/generate-jitconfig + documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#create-configuration-for-a-just-in-time-runner-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/actions/runners/registration-token + documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#create-a-registration-token-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/actions/runners/remove-token + documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#create-a-remove-token-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/actions/runners/{runner_id} + documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#delete-a-self-hosted-runner-from-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/actions/runners/{runner_id} + documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#get-a-self-hosted-runner-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/actions/runners/{runner_id}/labels + documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#remove-all-custom-labels-from-a-self-hosted-runner-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/actions/runners/{runner_id}/labels + documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#list-labels-for-a-self-hosted-runner-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/actions/runners/{runner_id}/labels + documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#add-custom-labels-to-a-self-hosted-runner-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /repos/{owner}/{repo}/actions/runners/{runner_id}/labels + documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#set-custom-labels-for-a-self-hosted-runner-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/actions/runners/{runner_id}/labels/{name} + documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#remove-a-custom-label-from-a-self-hosted-runner-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/actions/runs + documentation_url: https://docs.github.com/rest/actions/workflow-runs#list-workflow-runs-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/actions/runs/{run_id} + documentation_url: https://docs.github.com/rest/actions/workflow-runs#delete-a-workflow-run + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/actions/runs/{run_id} + documentation_url: https://docs.github.com/rest/actions/workflow-runs#get-a-workflow-run + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/actions/runs/{run_id}/approvals + documentation_url: https://docs.github.com/rest/actions/workflow-runs#get-the-review-history-for-a-workflow-run + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/actions/runs/{run_id}/approve + documentation_url: https://docs.github.com/rest/actions/workflow-runs#approve-a-workflow-run-for-a-fork-pull-request + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts + documentation_url: https://docs.github.com/rest/actions/artifacts#list-workflow-run-artifacts + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number} + documentation_url: https://docs.github.com/rest/actions/workflow-runs#get-a-workflow-run-attempt + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/jobs + documentation_url: https://docs.github.com/rest/actions/workflow-jobs#list-jobs-for-a-workflow-run-attempt + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/logs + documentation_url: https://docs.github.com/rest/actions/workflow-runs#download-workflow-run-attempt-logs + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/actions/runs/{run_id}/cancel + documentation_url: https://docs.github.com/rest/actions/workflow-runs#cancel-a-workflow-run + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/actions/runs/{run_id}/deployment_protection_rule + documentation_url: https://docs.github.com/rest/actions/workflow-runs#review-custom-deployment-protection-rules-for-a-workflow-run + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/actions/runs/{run_id}/force-cancel + documentation_url: https://docs.github.com/rest/actions/workflow-runs#force-cancel-a-workflow-run + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs + documentation_url: https://docs.github.com/rest/actions/workflow-jobs#list-jobs-for-a-workflow-run + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/actions/runs/{run_id}/logs + documentation_url: https://docs.github.com/rest/actions/workflow-runs#delete-workflow-run-logs + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/actions/runs/{run_id}/logs + documentation_url: https://docs.github.com/rest/actions/workflow-runs#download-workflow-run-logs + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments + documentation_url: https://docs.github.com/rest/actions/workflow-runs#get-pending-deployments-for-a-workflow-run + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments + documentation_url: https://docs.github.com/rest/actions/workflow-runs#review-pending-deployments-for-a-workflow-run + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/actions/runs/{run_id}/rerun + documentation_url: https://docs.github.com/rest/actions/workflow-runs#re-run-a-workflow + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/actions/runs/{run_id}/rerun-failed-jobs + documentation_url: https://docs.github.com/rest/actions/workflow-runs#re-run-failed-jobs-from-a-workflow-run + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/actions/runs/{run_id}/timing + documentation_url: https://docs.github.com/rest/actions/workflow-runs#get-workflow-run-usage + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /repos/{owner}/{repo}/actions/secrets + documentation_url: https://docs.github.com/rest/actions/secrets#list-repository-secrets + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/actions/secrets/public-key + documentation_url: https://docs.github.com/rest/actions/secrets#get-a-repository-public-key + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/actions/secrets/{secret_name} + documentation_url: https://docs.github.com/rest/actions/secrets#delete-a-repository-secret + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/actions/secrets/{secret_name} + documentation_url: https://docs.github.com/rest/actions/secrets#get-a-repository-secret + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /repos/{owner}/{repo}/actions/secrets/{secret_name} + documentation_url: https://docs.github.com/rest/actions/secrets#create-or-update-a-repository-secret + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/actions/variables + documentation_url: https://docs.github.com/rest/actions/variables#list-repository-variables + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/actions/variables + documentation_url: https://docs.github.com/rest/actions/variables#create-a-repository-variable + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/actions/variables/{name} + documentation_url: https://docs.github.com/rest/actions/variables#delete-a-repository-variable + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/actions/variables/{name} + documentation_url: https://docs.github.com/rest/actions/variables#get-a-repository-variable + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /repos/{owner}/{repo}/actions/variables/{name} + documentation_url: https://docs.github.com/rest/actions/variables#update-a-repository-variable + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/actions/workflows + documentation_url: https://docs.github.com/rest/actions/workflows#list-repository-workflows + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/actions/workflows/{workflow_id} + documentation_url: https://docs.github.com/rest/actions/workflows#get-a-workflow + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable + documentation_url: https://docs.github.com/rest/actions/workflows#disable-a-workflow + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches + documentation_url: https://docs.github.com/rest/actions/workflows#create-a-workflow-dispatch-event + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable + documentation_url: https://docs.github.com/rest/actions/workflows#enable-a-workflow + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs + documentation_url: https://docs.github.com/rest/actions/workflow-runs#list-workflow-runs-for-a-workflow + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/timing + documentation_url: https://docs.github.com/rest/actions/workflows#get-workflow-usage + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /repos/{owner}/{repo}/activity + documentation_url: https://docs.github.com/rest/repos/repos#list-repository-activities + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /repos/{owner}/{repo}/assignees + documentation_url: https://docs.github.com/rest/issues/assignees#list-assignees + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/assignees/{assignee} + documentation_url: https://docs.github.com/rest/issues/assignees#check-if-a-user-can-be-assigned + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/autolinks + documentation_url: https://docs.github.com/rest/repos/autolinks#list-all-autolinks-of-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/autolinks + documentation_url: https://docs.github.com/rest/repos/autolinks#create-an-autolink-reference-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/autolinks/{autolink_id} + documentation_url: https://docs.github.com/rest/repos/autolinks#delete-an-autolink-reference-from-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/autolinks/{autolink_id} + documentation_url: https://docs.github.com/rest/repos/autolinks#get-an-autolink-reference-of-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/automated-security-fixes + documentation_url: https://docs.github.com/rest/repos/repos#disable-automated-security-fixes + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /repos/{owner}/{repo}/automated-security-fixes + documentation_url: https://docs.github.com/rest/repos/repos#check-if-automated-security-fixes-are-enabled-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /repos/{owner}/{repo}/automated-security-fixes + documentation_url: https://docs.github.com/rest/repos/repos#enable-automated-security-fixes + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /repos/{owner}/{repo}/branches + documentation_url: https://docs.github.com/rest/branches/branches#list-branches + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/branches/{branch} + documentation_url: https://docs.github.com/rest/branches/branches#get-a-branch + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/branches/{branch}/protection + documentation_url: https://docs.github.com/rest/branches/branch-protection#delete-branch-protection + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/branches/{branch}/protection + documentation_url: https://docs.github.com/rest/branches/branch-protection#get-branch-protection + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /repos/{owner}/{repo}/branches/{branch}/protection + documentation_url: https://docs.github.com/rest/branches/branch-protection#update-branch-protection + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins + documentation_url: https://docs.github.com/rest/branches/branch-protection#delete-admin-branch-protection + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins + documentation_url: https://docs.github.com/rest/branches/branch-protection#get-admin-branch-protection + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins + documentation_url: https://docs.github.com/rest/branches/branch-protection#set-admin-branch-protection + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews + documentation_url: https://docs.github.com/rest/branches/branch-protection#delete-pull-request-review-protection + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews + documentation_url: https://docs.github.com/rest/branches/branch-protection#get-pull-request-review-protection + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews + documentation_url: https://docs.github.com/rest/branches/branch-protection#update-pull-request-review-protection + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures + documentation_url: https://docs.github.com/rest/branches/branch-protection#delete-commit-signature-protection + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures + documentation_url: https://docs.github.com/rest/branches/branch-protection#get-commit-signature-protection + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures + documentation_url: https://docs.github.com/rest/branches/branch-protection#create-commit-signature-protection + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks + documentation_url: https://docs.github.com/rest/branches/branch-protection#remove-status-check-protection + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks + documentation_url: https://docs.github.com/rest/branches/branch-protection#get-status-checks-protection + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks + documentation_url: https://docs.github.com/rest/branches/branch-protection#update-status-check-protection + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts + documentation_url: https://docs.github.com/rest/branches/branch-protection#remove-status-check-contexts + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts + documentation_url: https://docs.github.com/rest/branches/branch-protection#get-all-status-check-contexts + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts + documentation_url: https://docs.github.com/rest/branches/branch-protection#add-status-check-contexts + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts + documentation_url: https://docs.github.com/rest/branches/branch-protection#set-status-check-contexts + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions + documentation_url: https://docs.github.com/rest/branches/branch-protection#delete-access-restrictions + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions + documentation_url: https://docs.github.com/rest/branches/branch-protection#get-access-restrictions + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps + documentation_url: https://docs.github.com/rest/branches/branch-protection#remove-app-access-restrictions + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps + documentation_url: https://docs.github.com/rest/branches/branch-protection#get-apps-with-access-to-the-protected-branch + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps + documentation_url: https://docs.github.com/rest/branches/branch-protection#add-app-access-restrictions + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps + documentation_url: https://docs.github.com/rest/branches/branch-protection#set-app-access-restrictions + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams + documentation_url: https://docs.github.com/rest/branches/branch-protection#remove-team-access-restrictions + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams + documentation_url: https://docs.github.com/rest/branches/branch-protection#get-teams-with-access-to-the-protected-branch + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams + documentation_url: https://docs.github.com/rest/branches/branch-protection#add-team-access-restrictions + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams + documentation_url: https://docs.github.com/rest/branches/branch-protection#set-team-access-restrictions + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users + documentation_url: https://docs.github.com/rest/branches/branch-protection#remove-user-access-restrictions + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users + documentation_url: https://docs.github.com/rest/branches/branch-protection#get-users-with-access-to-the-protected-branch + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users + documentation_url: https://docs.github.com/rest/branches/branch-protection#add-user-access-restrictions + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users + documentation_url: https://docs.github.com/rest/branches/branch-protection#set-user-access-restrictions + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/branches/{branch}/rename + documentation_url: https://docs.github.com/rest/branches/branches#rename-a-branch + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/check-runs + documentation_url: https://docs.github.com/rest/checks/runs#create-a-check-run + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/check-runs/{check_run_id} + documentation_url: https://docs.github.com/rest/checks/runs#get-a-check-run + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /repos/{owner}/{repo}/check-runs/{check_run_id} + documentation_url: https://docs.github.com/rest/checks/runs#update-a-check-run + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/check-runs/{check_run_id}/annotations + documentation_url: https://docs.github.com/rest/checks/runs#list-check-run-annotations + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/check-runs/{check_run_id}/rerequest + documentation_url: https://docs.github.com/rest/checks/runs#rerequest-a-check-run + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/check-suites + documentation_url: https://docs.github.com/rest/checks/suites#create-a-check-suite + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /repos/{owner}/{repo}/check-suites/preferences + documentation_url: https://docs.github.com/rest/checks/suites#update-repository-preferences-for-check-suites + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/check-suites/{check_suite_id} + documentation_url: https://docs.github.com/rest/checks/suites#get-a-check-suite + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/check-suites/{check_suite_id}/check-runs + documentation_url: https://docs.github.com/rest/checks/runs#list-check-runs-in-a-check-suite + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/check-suites/{check_suite_id}/rerequest + documentation_url: https://docs.github.com/rest/checks/suites#rerequest-a-check-suite + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/code-scanning/alerts + documentation_url: https://docs.github.com/rest/code-scanning/code-scanning#list-code-scanning-alerts-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number} + documentation_url: https://docs.github.com/rest/code-scanning/code-scanning#get-a-code-scanning-alert + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /repos/{owner}/{repo}/code-scanning/alerts/{alert_number} + documentation_url: https://docs.github.com/rest/code-scanning/code-scanning#update-a-code-scanning-alert + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances + documentation_url: https://docs.github.com/rest/code-scanning/code-scanning#list-instances-of-a-code-scanning-alert + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/code-scanning/analyses + documentation_url: https://docs.github.com/rest/code-scanning/code-scanning#list-code-scanning-analyses-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/code-scanning/analyses/{analysis_id} + documentation_url: https://docs.github.com/rest/code-scanning/code-scanning#delete-a-code-scanning-analysis-from-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/code-scanning/analyses/{analysis_id} + documentation_url: https://docs.github.com/rest/code-scanning/code-scanning#get-a-code-scanning-analysis-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/code-scanning/codeql/databases + documentation_url: https://docs.github.com/rest/code-scanning/code-scanning#list-codeql-databases-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /repos/{owner}/{repo}/code-scanning/codeql/databases/{language} + documentation_url: https://docs.github.com/rest/code-scanning/code-scanning#get-a-codeql-database-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /repos/{owner}/{repo}/code-scanning/default-setup + documentation_url: https://docs.github.com/rest/code-scanning/code-scanning#get-a-code-scanning-default-setup-configuration + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /repos/{owner}/{repo}/code-scanning/default-setup + documentation_url: https://docs.github.com/rest/code-scanning/code-scanning#update-a-code-scanning-default-setup-configuration + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/code-scanning/sarifs + documentation_url: https://docs.github.com/rest/code-scanning/code-scanning#upload-an-analysis-as-sarif-data + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/code-scanning/sarifs/{sarif_id} + documentation_url: https://docs.github.com/rest/code-scanning/code-scanning#get-information-about-a-sarif-upload + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/codeowners/errors + documentation_url: https://docs.github.com/rest/repos/repos#list-codeowners-errors + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/codespaces + documentation_url: https://docs.github.com/rest/codespaces/codespaces#list-codespaces-in-a-repository-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: POST /repos/{owner}/{repo}/codespaces + documentation_url: https://docs.github.com/rest/codespaces/codespaces#create-a-codespace-in-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /repos/{owner}/{repo}/codespaces/devcontainers + documentation_url: https://docs.github.com/rest/codespaces/codespaces#list-devcontainer-configurations-in-a-repository-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /repos/{owner}/{repo}/codespaces/machines + documentation_url: https://docs.github.com/rest/codespaces/machines#list-available-machine-types-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /repos/{owner}/{repo}/codespaces/new + documentation_url: https://docs.github.com/rest/codespaces/codespaces#get-default-attributes-for-a-codespace + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /repos/{owner}/{repo}/codespaces/permissions_check + documentation_url: https://docs.github.com/rest/codespaces/codespaces#check-if-permissions-defined-by-a-devcontainer-have-been-accepted-by-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /repos/{owner}/{repo}/codespaces/secrets + documentation_url: https://docs.github.com/rest/codespaces/repository-secrets#list-repository-secrets + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /repos/{owner}/{repo}/codespaces/secrets/public-key + documentation_url: https://docs.github.com/rest/codespaces/repository-secrets#get-a-repository-public-key + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: DELETE /repos/{owner}/{repo}/codespaces/secrets/{secret_name} + documentation_url: https://docs.github.com/rest/codespaces/repository-secrets#delete-a-repository-secret + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /repos/{owner}/{repo}/codespaces/secrets/{secret_name} + documentation_url: https://docs.github.com/rest/codespaces/repository-secrets#get-a-repository-secret + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: PUT /repos/{owner}/{repo}/codespaces/secrets/{secret_name} + documentation_url: https://docs.github.com/rest/codespaces/repository-secrets#create-or-update-a-repository-secret + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /repos/{owner}/{repo}/collaborators + documentation_url: https://docs.github.com/rest/collaborators/collaborators#list-repository-collaborators + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/collaborators/{username} + documentation_url: https://docs.github.com/rest/collaborators/collaborators#remove-a-repository-collaborator + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/collaborators/{username} + documentation_url: https://docs.github.com/rest/collaborators/collaborators#check-if-a-user-is-a-repository-collaborator + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /repos/{owner}/{repo}/collaborators/{username} + documentation_url: https://docs.github.com/rest/collaborators/collaborators#add-a-repository-collaborator + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/collaborators/{username}/permission + documentation_url: https://docs.github.com/rest/collaborators/collaborators#get-repository-permissions-for-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/comments + documentation_url: https://docs.github.com/rest/commits/comments#list-commit-comments-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/comments/{comment_id} + documentation_url: https://docs.github.com/rest/commits/comments#delete-a-commit-comment + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/comments/{comment_id} + documentation_url: https://docs.github.com/rest/commits/comments#get-a-commit-comment + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /repos/{owner}/{repo}/comments/{comment_id} + documentation_url: https://docs.github.com/rest/commits/comments#update-a-commit-comment + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/comments/{comment_id}/reactions + documentation_url: https://docs.github.com/rest/reactions/reactions#list-reactions-for-a-commit-comment + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/comments/{comment_id}/reactions + documentation_url: https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-commit-comment + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/comments/{comment_id}/reactions/{reaction_id} + documentation_url: https://docs.github.com/rest/reactions/reactions#delete-a-commit-comment-reaction + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/commits + documentation_url: https://docs.github.com/rest/commits/commits#list-commits + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/commits/{commit_sha}/branches-where-head + documentation_url: https://docs.github.com/rest/commits/commits#list-branches-for-head-commit + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/commits/{commit_sha}/comments + documentation_url: https://docs.github.com/rest/commits/comments#list-commit-comments + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/commits/{commit_sha}/comments + documentation_url: https://docs.github.com/rest/commits/comments#create-a-commit-comment + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls + documentation_url: https://docs.github.com/rest/commits/commits#list-pull-requests-associated-with-a-commit + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/commits/{ref} + documentation_url: https://docs.github.com/rest/commits/commits#get-a-commit + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/commits/{ref}/check-runs + documentation_url: https://docs.github.com/rest/checks/runs#list-check-runs-for-a-git-reference + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/commits/{ref}/check-suites + documentation_url: https://docs.github.com/rest/checks/suites#list-check-suites-for-a-git-reference + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/commits/{ref}/status + documentation_url: https://docs.github.com/rest/commits/statuses#get-the-combined-status-for-a-specific-reference + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/commits/{ref}/statuses + documentation_url: https://docs.github.com/rest/commits/statuses#list-commit-statuses-for-a-reference + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/community/profile + documentation_url: https://docs.github.com/rest/metrics/community#get-community-profile-metrics + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /repos/{owner}/{repo}/compare/{basehead} + documentation_url: https://docs.github.com/rest/commits/commits#compare-two-commits + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/content_references/{content_reference_id}/attachments + documentation_url: https://docs.github.com/enterprise-server@3.3/rest/reference/apps#create-a-content-attachment + openapi_files: + - descriptions/ghes-3.3/ghes-3.3.json + - name: DELETE /repos/{owner}/{repo}/contents/{path} + documentation_url: https://docs.github.com/rest/repos/contents#delete-a-file + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/contents/{path} + documentation_url: https://docs.github.com/rest/repos/contents#get-repository-content + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /repos/{owner}/{repo}/contents/{path} + documentation_url: https://docs.github.com/rest/repos/contents#create-or-update-file-contents + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/contributors + documentation_url: https://docs.github.com/rest/repos/repos#list-repository-contributors + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/dependabot/alerts + documentation_url: https://docs.github.com/rest/dependabot/alerts#list-dependabot-alerts-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/dependabot/alerts/{alert_number} + documentation_url: https://docs.github.com/rest/dependabot/alerts#get-a-dependabot-alert + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /repos/{owner}/{repo}/dependabot/alerts/{alert_number} + documentation_url: https://docs.github.com/rest/dependabot/alerts#update-a-dependabot-alert + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/dependabot/secrets + documentation_url: https://docs.github.com/rest/dependabot/secrets#list-repository-secrets + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/dependabot/secrets/public-key + documentation_url: https://docs.github.com/rest/dependabot/secrets#get-a-repository-public-key + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/dependabot/secrets/{secret_name} + documentation_url: https://docs.github.com/rest/dependabot/secrets#delete-a-repository-secret + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/dependabot/secrets/{secret_name} + documentation_url: https://docs.github.com/rest/dependabot/secrets#get-a-repository-secret + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /repos/{owner}/{repo}/dependabot/secrets/{secret_name} + documentation_url: https://docs.github.com/rest/dependabot/secrets#create-or-update-a-repository-secret + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/dependency-graph/compare/{basehead} + documentation_url: https://docs.github.com/rest/dependency-graph/dependency-review#get-a-diff-of-the-dependencies-between-commits + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/dependency-graph/sbom + documentation_url: https://docs.github.com/rest/dependency-graph/sboms#export-a-software-bill-of-materials-sbom-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/dependency-graph/snapshots + documentation_url: https://docs.github.com/rest/dependency-graph/dependency-submission#create-a-snapshot-of-dependencies-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/deployments + documentation_url: https://docs.github.com/rest/deployments/deployments#list-deployments + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/deployments + documentation_url: https://docs.github.com/rest/deployments/deployments#create-a-deployment + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/deployments/{deployment_id} + documentation_url: https://docs.github.com/rest/deployments/deployments#delete-a-deployment + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/deployments/{deployment_id} + documentation_url: https://docs.github.com/rest/deployments/deployments#get-a-deployment + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses + documentation_url: https://docs.github.com/rest/deployments/statuses#list-deployment-statuses + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/deployments/{deployment_id}/statuses + documentation_url: https://docs.github.com/rest/deployments/statuses#create-a-deployment-status + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses/{status_id} + documentation_url: https://docs.github.com/rest/deployments/statuses#get-a-deployment-status + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/dispatches + documentation_url: https://docs.github.com/rest/repos/repos#create-a-repository-dispatch-event + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/environments + documentation_url: https://docs.github.com/rest/deployments/environments#list-environments + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/environments/{environment_name} + documentation_url: https://docs.github.com/rest/deployments/environments#delete-an-environment + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/environments/{environment_name} + documentation_url: https://docs.github.com/rest/deployments/environments#get-an-environment + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /repos/{owner}/{repo}/environments/{environment_name} + documentation_url: https://docs.github.com/rest/deployments/environments#create-or-update-an-environment + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies + documentation_url: https://docs.github.com/rest/deployments/branch-policies#list-deployment-branch-policies + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies + documentation_url: https://docs.github.com/rest/deployments/branch-policies#create-a-deployment-branch-policy + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id} + documentation_url: https://docs.github.com/rest/deployments/branch-policies#delete-a-deployment-branch-policy + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id} + documentation_url: https://docs.github.com/rest/deployments/branch-policies#get-a-deployment-branch-policy + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id} + documentation_url: https://docs.github.com/rest/deployments/branch-policies#update-a-deployment-branch-policy + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules + documentation_url: https://docs.github.com/rest/deployments/protection-rules#get-all-deployment-protection-rules-for-an-environment + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules + documentation_url: https://docs.github.com/rest/deployments/protection-rules#create-a-custom-deployment-protection-rule-on-an-environment + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/apps + documentation_url: https://docs.github.com/rest/deployments/protection-rules#list-custom-deployment-rule-integrations-available-for-an-environment + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/{protection_rule_id} + documentation_url: https://docs.github.com/rest/deployments/protection-rules#disable-a-custom-protection-rule-for-an-environment + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/{protection_rule_id} + documentation_url: https://docs.github.com/rest/deployments/protection-rules#get-a-custom-deployment-protection-rule + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/events + documentation_url: https://docs.github.com/rest/activity/events#list-repository-events + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/forks + documentation_url: https://docs.github.com/rest/repos/forks#list-forks + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/forks + documentation_url: https://docs.github.com/rest/repos/forks#create-a-fork + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/git/blobs + documentation_url: https://docs.github.com/rest/git/blobs#create-a-blob + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/git/blobs/{file_sha} + documentation_url: https://docs.github.com/rest/git/blobs#get-a-blob + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/git/commits + documentation_url: https://docs.github.com/rest/git/commits#create-a-commit + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/git/commits/{commit_sha} + documentation_url: https://docs.github.com/rest/git/commits#get-a-commit-object + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/git/matching-refs/{ref} + documentation_url: https://docs.github.com/rest/git/refs#list-matching-references + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/git/ref/{ref} + documentation_url: https://docs.github.com/rest/git/refs#get-a-reference + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/git/refs + documentation_url: https://docs.github.com/rest/git/refs#create-a-reference + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/git/refs/{ref} + documentation_url: https://docs.github.com/rest/git/refs#delete-a-reference + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /repos/{owner}/{repo}/git/refs/{ref} + documentation_url: https://docs.github.com/rest/git/refs#update-a-reference + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/git/tags + documentation_url: https://docs.github.com/rest/git/tags#create-a-tag-object + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/git/tags/{tag_sha} + documentation_url: https://docs.github.com/rest/git/tags#get-a-tag + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/git/trees + documentation_url: https://docs.github.com/rest/git/trees#create-a-tree + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/git/trees/{tree_sha} + documentation_url: https://docs.github.com/rest/git/trees#get-a-tree + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/hooks + documentation_url: https://docs.github.com/rest/webhooks/repos#list-repository-webhooks + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/hooks + documentation_url: https://docs.github.com/rest/webhooks/repos#create-a-repository-webhook + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/hooks/{hook_id} + documentation_url: https://docs.github.com/rest/webhooks/repos#delete-a-repository-webhook + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/hooks/{hook_id} + documentation_url: https://docs.github.com/rest/webhooks/repos#get-a-repository-webhook + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /repos/{owner}/{repo}/hooks/{hook_id} + documentation_url: https://docs.github.com/rest/webhooks/repos#update-a-repository-webhook + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/hooks/{hook_id}/config + documentation_url: https://docs.github.com/rest/webhooks/repo-config#get-a-webhook-configuration-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /repos/{owner}/{repo}/hooks/{hook_id}/config + documentation_url: https://docs.github.com/rest/webhooks/repo-config#update-a-webhook-configuration-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries + documentation_url: https://docs.github.com/rest/webhooks/repo-deliveries#list-deliveries-for-a-repository-webhook + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries/{delivery_id} + documentation_url: https://docs.github.com/rest/webhooks/repo-deliveries#get-a-delivery-for-a-repository-webhook + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/hooks/{hook_id}/deliveries/{delivery_id}/attempts + documentation_url: https://docs.github.com/rest/webhooks/repo-deliveries#redeliver-a-delivery-for-a-repository-webhook + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/hooks/{hook_id}/pings + documentation_url: https://docs.github.com/rest/webhooks/repos#ping-a-repository-webhook + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/hooks/{hook_id}/tests + documentation_url: https://docs.github.com/rest/webhooks/repos#test-the-push-repository-webhook + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/import + documentation_url: https://docs.github.com/rest/migrations/source-imports#cancel-an-import + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /repos/{owner}/{repo}/import + documentation_url: https://docs.github.com/rest/migrations/source-imports#get-an-import-status + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: PATCH /repos/{owner}/{repo}/import + documentation_url: https://docs.github.com/rest/migrations/source-imports#update-an-import + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: PUT /repos/{owner}/{repo}/import + documentation_url: https://docs.github.com/rest/migrations/source-imports#start-an-import + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /repos/{owner}/{repo}/import/authors + documentation_url: https://docs.github.com/rest/migrations/source-imports#get-commit-authors + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: PATCH /repos/{owner}/{repo}/import/authors/{author_id} + documentation_url: https://docs.github.com/rest/migrations/source-imports#map-a-commit-author + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /repos/{owner}/{repo}/import/large_files + documentation_url: https://docs.github.com/rest/migrations/source-imports#get-large-files + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: PATCH /repos/{owner}/{repo}/import/lfs + documentation_url: https://docs.github.com/rest/migrations/source-imports#update-git-lfs-preference + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /repos/{owner}/{repo}/installation + documentation_url: https://docs.github.com/rest/apps/apps#get-a-repository-installation-for-the-authenticated-app + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/interaction-limits + documentation_url: https://docs.github.com/rest/interactions/repos#remove-interaction-restrictions-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /repos/{owner}/{repo}/interaction-limits + documentation_url: https://docs.github.com/rest/interactions/repos#get-interaction-restrictions-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: PUT /repos/{owner}/{repo}/interaction-limits + documentation_url: https://docs.github.com/rest/interactions/repos#set-interaction-restrictions-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /repos/{owner}/{repo}/invitations + documentation_url: https://docs.github.com/rest/collaborators/invitations#list-repository-invitations + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/invitations/{invitation_id} + documentation_url: https://docs.github.com/rest/collaborators/invitations#delete-a-repository-invitation + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /repos/{owner}/{repo}/invitations/{invitation_id} + documentation_url: https://docs.github.com/rest/collaborators/invitations#update-a-repository-invitation + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/issues + documentation_url: https://docs.github.com/rest/issues/issues#list-repository-issues + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/issues + documentation_url: https://docs.github.com/rest/issues/issues#create-an-issue + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/issues/comments + documentation_url: https://docs.github.com/rest/issues/comments#list-issue-comments-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/issues/comments/{comment_id} + documentation_url: https://docs.github.com/rest/issues/comments#delete-an-issue-comment + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/issues/comments/{comment_id} + documentation_url: https://docs.github.com/rest/issues/comments#get-an-issue-comment + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /repos/{owner}/{repo}/issues/comments/{comment_id} + documentation_url: https://docs.github.com/rest/issues/comments#update-an-issue-comment + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions + documentation_url: https://docs.github.com/rest/reactions/reactions#list-reactions-for-an-issue-comment + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions + documentation_url: https://docs.github.com/rest/reactions/reactions#create-reaction-for-an-issue-comment + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions/{reaction_id} + documentation_url: https://docs.github.com/rest/reactions/reactions#delete-an-issue-comment-reaction + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/issues/events + documentation_url: https://docs.github.com/rest/issues/events#list-issue-events-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/issues/events/{event_id} + documentation_url: https://docs.github.com/rest/issues/events#get-an-issue-event + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/issues/{issue_number} + documentation_url: https://docs.github.com/rest/issues/issues#get-an-issue + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /repos/{owner}/{repo}/issues/{issue_number} + documentation_url: https://docs.github.com/rest/issues/issues#update-an-issue + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/issues/{issue_number}/assignees + documentation_url: https://docs.github.com/rest/issues/assignees#remove-assignees-from-an-issue + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/issues/{issue_number}/assignees + documentation_url: https://docs.github.com/rest/issues/assignees#add-assignees-to-an-issue + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/issues/{issue_number}/assignees/{assignee} + documentation_url: https://docs.github.com/rest/issues/assignees#check-if-a-user-can-be-assigned-to-a-issue + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/issues/{issue_number}/comments + documentation_url: https://docs.github.com/rest/issues/comments#list-issue-comments + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/issues/{issue_number}/comments + documentation_url: https://docs.github.com/rest/issues/comments#create-an-issue-comment + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/issues/{issue_number}/events + documentation_url: https://docs.github.com/rest/issues/events#list-issue-events + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels + documentation_url: https://docs.github.com/rest/issues/labels#remove-all-labels-from-an-issue + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/issues/{issue_number}/labels + documentation_url: https://docs.github.com/rest/issues/labels#list-labels-for-an-issue + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/issues/{issue_number}/labels + documentation_url: https://docs.github.com/rest/issues/labels#add-labels-to-an-issue + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /repos/{owner}/{repo}/issues/{issue_number}/labels + documentation_url: https://docs.github.com/rest/issues/labels#set-labels-for-an-issue + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels/{name} + documentation_url: https://docs.github.com/rest/issues/labels#remove-a-label-from-an-issue + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/issues/{issue_number}/lock + documentation_url: https://docs.github.com/rest/issues/issues#unlock-an-issue + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /repos/{owner}/{repo}/issues/{issue_number}/lock + documentation_url: https://docs.github.com/rest/issues/issues#lock-an-issue + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/issues/{issue_number}/reactions + documentation_url: https://docs.github.com/rest/reactions/reactions#list-reactions-for-an-issue + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/issues/{issue_number}/reactions + documentation_url: https://docs.github.com/rest/reactions/reactions#create-reaction-for-an-issue + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/issues/{issue_number}/reactions/{reaction_id} + documentation_url: https://docs.github.com/rest/reactions/reactions#delete-an-issue-reaction + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/issues/{issue_number}/timeline + documentation_url: https://docs.github.com/rest/issues/timeline#list-timeline-events-for-an-issue + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/keys + documentation_url: https://docs.github.com/rest/deploy-keys/deploy-keys#list-deploy-keys + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/keys + documentation_url: https://docs.github.com/rest/deploy-keys/deploy-keys#create-a-deploy-key + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/keys/{key_id} + documentation_url: https://docs.github.com/rest/deploy-keys/deploy-keys#delete-a-deploy-key + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/keys/{key_id} + documentation_url: https://docs.github.com/rest/deploy-keys/deploy-keys#get-a-deploy-key + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/labels + documentation_url: https://docs.github.com/rest/issues/labels#list-labels-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/labels + documentation_url: https://docs.github.com/rest/issues/labels#create-a-label + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/labels/{name} + documentation_url: https://docs.github.com/rest/issues/labels#delete-a-label + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/labels/{name} + documentation_url: https://docs.github.com/rest/issues/labels#get-a-label + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /repos/{owner}/{repo}/labels/{name} + documentation_url: https://docs.github.com/rest/issues/labels#update-a-label + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/languages + documentation_url: https://docs.github.com/rest/repos/repos#list-repository-languages + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/lfs + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/repos/lfs#disable-git-lfs-for-a-repository + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /repos/{owner}/{repo}/lfs + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/repos/lfs#enable-git-lfs-for-a-repository + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/license + documentation_url: https://docs.github.com/rest/licenses/licenses#get-the-license-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/merge-upstream + documentation_url: https://docs.github.com/rest/branches/branches#sync-a-fork-branch-with-the-upstream-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/merges + documentation_url: https://docs.github.com/rest/branches/branches#merge-a-branch + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/milestones + documentation_url: https://docs.github.com/rest/issues/milestones#list-milestones + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/milestones + documentation_url: https://docs.github.com/rest/issues/milestones#create-a-milestone + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/milestones/{milestone_number} + documentation_url: https://docs.github.com/rest/issues/milestones#delete-a-milestone + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/milestones/{milestone_number} + documentation_url: https://docs.github.com/rest/issues/milestones#get-a-milestone + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /repos/{owner}/{repo}/milestones/{milestone_number} + documentation_url: https://docs.github.com/rest/issues/milestones#update-a-milestone + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/milestones/{milestone_number}/labels + documentation_url: https://docs.github.com/rest/issues/labels#list-labels-for-issues-in-a-milestone + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/notifications + documentation_url: https://docs.github.com/rest/activity/notifications#list-repository-notifications-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /repos/{owner}/{repo}/notifications + documentation_url: https://docs.github.com/rest/activity/notifications#mark-repository-notifications-as-read + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/pages + documentation_url: https://docs.github.com/rest/pages/pages#delete-a-apiname-pages-site + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/pages + documentation_url: https://docs.github.com/rest/pages/pages#get-a-apiname-pages-site + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/pages + documentation_url: https://docs.github.com/rest/pages/pages#create-a-apiname-pages-site + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /repos/{owner}/{repo}/pages + documentation_url: https://docs.github.com/rest/pages/pages#update-information-about-a-apiname-pages-site + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/pages/builds + documentation_url: https://docs.github.com/rest/pages/pages#list-apiname-pages-builds + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/pages/builds + documentation_url: https://docs.github.com/rest/pages/pages#request-a-apiname-pages-build + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/pages/builds/latest + documentation_url: https://docs.github.com/rest/pages/pages#get-latest-pages-build + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/pages/builds/{build_id} + documentation_url: https://docs.github.com/rest/pages/pages#get-apiname-pages-build + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/pages/deployment + documentation_url: https://docs.github.com/rest/pages/pages#create-a-github-pages-deployment + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/pages/health + documentation_url: https://docs.github.com/rest/pages/pages#get-a-dns-health-check-for-github-pages + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /repos/{owner}/{repo}/pre-receive-hooks + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/repo-pre-receive-hooks#list-pre-receive-hooks-for-a-repository + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/pre-receive-hooks/{pre_receive_hook_id} + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/repo-pre-receive-hooks#remove-pre-receive-hook-enforcement-for-a-repository + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/pre-receive-hooks/{pre_receive_hook_id} + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/repo-pre-receive-hooks#get-a-pre-receive-hook-for-a-repository + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /repos/{owner}/{repo}/pre-receive-hooks/{pre_receive_hook_id} + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/repo-pre-receive-hooks#update-pre-receive-hook-enforcement-for-a-repository + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/private-vulnerability-reporting + documentation_url: https://docs.github.com/rest/repos/repos#disable-private-vulnerability-reporting-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: PUT /repos/{owner}/{repo}/private-vulnerability-reporting + documentation_url: https://docs.github.com/rest/repos/repos#enable-private-vulnerability-reporting-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /repos/{owner}/{repo}/projects + documentation_url: https://docs.github.com/rest/projects/projects#list-repository-projects + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/projects + documentation_url: https://docs.github.com/rest/projects/projects#create-a-repository-project + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/properties/values + documentation_url: https://docs.github.com/rest/repos/properties#get-all-custom-property-values-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /repos/{owner}/{repo}/pulls + documentation_url: https://docs.github.com/rest/pulls/pulls#list-pull-requests + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/pulls + documentation_url: https://docs.github.com/rest/pulls/pulls#create-a-pull-request + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/pulls/comments + documentation_url: https://docs.github.com/rest/pulls/comments#list-review-comments-in-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id} + documentation_url: https://docs.github.com/rest/pulls/comments#delete-a-review-comment-for-a-pull-request + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/pulls/comments/{comment_id} + documentation_url: https://docs.github.com/rest/pulls/comments#get-a-review-comment-for-a-pull-request + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /repos/{owner}/{repo}/pulls/comments/{comment_id} + documentation_url: https://docs.github.com/rest/pulls/comments#update-a-review-comment-for-a-pull-request + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions + documentation_url: https://docs.github.com/rest/reactions/reactions#list-reactions-for-a-pull-request-review-comment + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions + documentation_url: https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-pull-request-review-comment + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions/{reaction_id} + documentation_url: https://docs.github.com/rest/reactions/reactions#delete-a-pull-request-comment-reaction + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/pulls/{pull_number} + documentation_url: https://docs.github.com/rest/pulls/pulls#get-a-pull-request + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /repos/{owner}/{repo}/pulls/{pull_number} + documentation_url: https://docs.github.com/rest/pulls/pulls#update-a-pull-request + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/pulls/{pull_number}/codespaces + documentation_url: https://docs.github.com/rest/codespaces/codespaces#create-a-codespace-from-a-pull-request + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /repos/{owner}/{repo}/pulls/{pull_number}/comments + documentation_url: https://docs.github.com/rest/pulls/comments#list-review-comments-on-a-pull-request + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/pulls/{pull_number}/comments + documentation_url: https://docs.github.com/rest/pulls/comments#create-a-review-comment-for-a-pull-request + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/replies + documentation_url: https://docs.github.com/rest/pulls/comments#create-a-reply-for-a-review-comment + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/pulls/{pull_number}/commits + documentation_url: https://docs.github.com/rest/pulls/pulls#list-commits-on-a-pull-request + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/pulls/{pull_number}/files + documentation_url: https://docs.github.com/rest/pulls/pulls#list-pull-requests-files + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/pulls/{pull_number}/merge + documentation_url: https://docs.github.com/rest/pulls/pulls#check-if-a-pull-request-has-been-merged + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge + documentation_url: https://docs.github.com/rest/pulls/pulls#merge-a-pull-request + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers + documentation_url: https://docs.github.com/rest/pulls/review-requests#remove-requested-reviewers-from-a-pull-request + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers + documentation_url: https://docs.github.com/rest/pulls/review-requests#get-all-requested-reviewers-for-a-pull-request + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers + documentation_url: https://docs.github.com/rest/pulls/review-requests#request-reviewers-for-a-pull-request + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews + documentation_url: https://docs.github.com/rest/pulls/reviews#list-reviews-for-a-pull-request + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews + documentation_url: https://docs.github.com/rest/pulls/reviews#create-a-review-for-a-pull-request + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id} + documentation_url: https://docs.github.com/rest/pulls/reviews#delete-a-pending-review-for-a-pull-request + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id} + documentation_url: https://docs.github.com/rest/pulls/reviews#get-a-review-for-a-pull-request + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id} + documentation_url: https://docs.github.com/rest/pulls/reviews#update-a-review-for-a-pull-request + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/comments + documentation_url: https://docs.github.com/rest/pulls/reviews#list-comments-for-a-pull-request-review + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/dismissals + documentation_url: https://docs.github.com/rest/pulls/reviews#dismiss-a-review-for-a-pull-request + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/events + documentation_url: https://docs.github.com/rest/pulls/reviews#submit-a-review-for-a-pull-request + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /repos/{owner}/{repo}/pulls/{pull_number}/update-branch + documentation_url: https://docs.github.com/rest/pulls/pulls#update-a-pull-request-branch + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/readme + documentation_url: https://docs.github.com/rest/repos/contents#get-a-repository-readme + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/readme/{dir} + documentation_url: https://docs.github.com/rest/repos/contents#get-a-repository-readme-for-a-directory + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/releases + documentation_url: https://docs.github.com/rest/releases/releases#list-releases + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/releases + documentation_url: https://docs.github.com/rest/releases/releases#create-a-release + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/releases/assets/{asset_id} + documentation_url: https://docs.github.com/rest/releases/assets#delete-a-release-asset + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/releases/assets/{asset_id} + documentation_url: https://docs.github.com/rest/releases/assets#get-a-release-asset + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /repos/{owner}/{repo}/releases/assets/{asset_id} + documentation_url: https://docs.github.com/rest/releases/assets#update-a-release-asset + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/releases/generate-notes + documentation_url: https://docs.github.com/rest/releases/releases#generate-release-notes-content-for-a-release + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/releases/latest + documentation_url: https://docs.github.com/rest/releases/releases#get-the-latest-release + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/releases/tags/{tag} + documentation_url: https://docs.github.com/rest/releases/releases#get-a-release-by-tag-name + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/releases/{release_id} + documentation_url: https://docs.github.com/rest/releases/releases#delete-a-release + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/releases/{release_id} + documentation_url: https://docs.github.com/rest/releases/releases#get-a-release + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /repos/{owner}/{repo}/releases/{release_id} + documentation_url: https://docs.github.com/rest/releases/releases#update-a-release + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/releases/{release_id}/assets + documentation_url: https://docs.github.com/rest/releases/assets#list-release-assets + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/releases/{release_id}/assets + documentation_url: https://docs.github.com/rest/releases/assets#upload-a-release-asset + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/releases/{release_id}/reactions + documentation_url: https://docs.github.com/rest/reactions/reactions#list-reactions-for-a-release + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/releases/{release_id}/reactions + documentation_url: https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-release + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/releases/{release_id}/reactions/{reaction_id} + documentation_url: https://docs.github.com/rest/reactions/reactions#delete-a-release-reaction + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/replicas/caches + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/repos/repos#list-repository-cache-replication-status + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/rules/branches/{branch} + documentation_url: https://docs.github.com/rest/repos/rules#get-rules-for-a-branch + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /repos/{owner}/{repo}/rulesets + documentation_url: https://docs.github.com/rest/repos/rules#get-all-repository-rulesets + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: POST /repos/{owner}/{repo}/rulesets + documentation_url: https://docs.github.com/rest/repos/rules#create-a-repository-ruleset + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /repos/{owner}/{repo}/rulesets/rule-suites + documentation_url: https://docs.github.com/rest/repos/rule-suites#list-repository-rule-suites + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /repos/{owner}/{repo}/rulesets/rule-suites/{rule_suite_id} + documentation_url: https://docs.github.com/rest/repos/rule-suites#get-a-repository-rule-suite + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: DELETE /repos/{owner}/{repo}/rulesets/{ruleset_id} + documentation_url: https://docs.github.com/rest/repos/rules#delete-a-repository-ruleset + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /repos/{owner}/{repo}/rulesets/{ruleset_id} + documentation_url: https://docs.github.com/rest/repos/rules#get-a-repository-ruleset + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: PUT /repos/{owner}/{repo}/rulesets/{ruleset_id} + documentation_url: https://docs.github.com/rest/repos/rules#update-a-repository-ruleset + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /repos/{owner}/{repo}/secret-scanning/alerts + documentation_url: https://docs.github.com/rest/secret-scanning/secret-scanning#list-secret-scanning-alerts-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number} + documentation_url: https://docs.github.com/rest/secret-scanning/secret-scanning#get-a-secret-scanning-alert + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number} + documentation_url: https://docs.github.com/rest/secret-scanning/secret-scanning#update-a-secret-scanning-alert + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}/locations + documentation_url: https://docs.github.com/rest/secret-scanning/secret-scanning#list-locations-for-a-secret-scanning-alert + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/security-advisories + documentation_url: https://docs.github.com/rest/security-advisories/repository-advisories#list-repository-security-advisories + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: POST /repos/{owner}/{repo}/security-advisories + documentation_url: https://docs.github.com/rest/security-advisories/repository-advisories#create-a-repository-security-advisory + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: POST /repos/{owner}/{repo}/security-advisories/reports + documentation_url: https://docs.github.com/rest/security-advisories/repository-advisories#privately-report-a-security-vulnerability + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /repos/{owner}/{repo}/security-advisories/{ghsa_id} + documentation_url: https://docs.github.com/rest/security-advisories/repository-advisories#get-a-repository-security-advisory + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: PATCH /repos/{owner}/{repo}/security-advisories/{ghsa_id} + documentation_url: https://docs.github.com/rest/security-advisories/repository-advisories#update-a-repository-security-advisory + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: POST /repos/{owner}/{repo}/security-advisories/{ghsa_id}/cve + documentation_url: https://docs.github.com/rest/security-advisories/repository-advisories#request-a-cve-for-a-repository-security-advisory + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /repos/{owner}/{repo}/stargazers + documentation_url: https://docs.github.com/rest/activity/starring#list-stargazers + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/stats/code_frequency + documentation_url: https://docs.github.com/rest/metrics/statistics#get-the-weekly-commit-activity + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/stats/commit_activity + documentation_url: https://docs.github.com/rest/metrics/statistics#get-the-last-year-of-commit-activity + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/stats/contributors + documentation_url: https://docs.github.com/rest/metrics/statistics#get-all-contributor-commit-activity + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/stats/participation + documentation_url: https://docs.github.com/rest/metrics/statistics#get-the-weekly-commit-count + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/stats/punch_card + documentation_url: https://docs.github.com/rest/metrics/statistics#get-the-hourly-commit-count-for-each-day + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/statuses/{sha} + documentation_url: https://docs.github.com/rest/commits/statuses#create-a-commit-status + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/subscribers + documentation_url: https://docs.github.com/rest/activity/watching#list-watchers + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/subscription + documentation_url: https://docs.github.com/rest/activity/watching#delete-a-repository-subscription + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/subscription + documentation_url: https://docs.github.com/rest/activity/watching#get-a-repository-subscription + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /repos/{owner}/{repo}/subscription + documentation_url: https://docs.github.com/rest/activity/watching#set-a-repository-subscription + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/tags + documentation_url: https://docs.github.com/rest/repos/repos#list-repository-tags + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/tags/protection + documentation_url: https://docs.github.com/rest/repos/tags#list-tag-protection-states-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{owner}/{repo}/tags/protection + documentation_url: https://docs.github.com/rest/repos/tags#create-a-tag-protection-state-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/tags/protection/{tag_protection_id} + documentation_url: https://docs.github.com/rest/repos/tags#delete-a-tag-protection-state-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/tarball/{ref} + documentation_url: https://docs.github.com/rest/repos/contents#download-a-repository-archive-tar + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/teams + documentation_url: https://docs.github.com/rest/repos/repos#list-repository-teams + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/topics + documentation_url: https://docs.github.com/rest/repos/repos#get-all-repository-topics + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /repos/{owner}/{repo}/topics + documentation_url: https://docs.github.com/rest/repos/repos#replace-all-repository-topics + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/traffic/clones + documentation_url: https://docs.github.com/rest/metrics/traffic#get-repository-clones + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /repos/{owner}/{repo}/traffic/popular/paths + documentation_url: https://docs.github.com/rest/metrics/traffic#get-top-referral-paths + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /repos/{owner}/{repo}/traffic/popular/referrers + documentation_url: https://docs.github.com/rest/metrics/traffic#get-top-referral-sources + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /repos/{owner}/{repo}/traffic/views + documentation_url: https://docs.github.com/rest/metrics/traffic#get-page-views + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: POST /repos/{owner}/{repo}/transfer + documentation_url: https://docs.github.com/rest/repos/repos#transfer-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repos/{owner}/{repo}/vulnerability-alerts + documentation_url: https://docs.github.com/rest/repos/repos#disable-vulnerability-alerts + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/vulnerability-alerts + documentation_url: https://docs.github.com/rest/repos/repos#check-if-vulnerability-alerts-are-enabled-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /repos/{owner}/{repo}/vulnerability-alerts + documentation_url: https://docs.github.com/rest/repos/repos#enable-vulnerability-alerts + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repos/{owner}/{repo}/zipball/{ref} + documentation_url: https://docs.github.com/rest/repos/contents#download-a-repository-archive-zip + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repos/{template_owner}/{template_repo}/generate + documentation_url: https://docs.github.com/rest/repos/repos#create-a-repository-using-a-template + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repositories + documentation_url: https://docs.github.com/rest/repos/repos#list-public-repositories + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repositories/{repository_id}/environments/{environment_name}/secrets + documentation_url: https://docs.github.com/rest/actions/secrets#list-environment-secrets + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repositories/{repository_id}/environments/{environment_name}/secrets/public-key + documentation_url: https://docs.github.com/rest/actions/secrets#get-an-environment-public-key + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name} + documentation_url: https://docs.github.com/rest/actions/secrets#delete-an-environment-secret + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name} + documentation_url: https://docs.github.com/rest/actions/secrets#get-an-environment-secret + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name} + documentation_url: https://docs.github.com/rest/actions/secrets#create-or-update-an-environment-secret + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repositories/{repository_id}/environments/{environment_name}/variables + documentation_url: https://docs.github.com/rest/actions/variables#list-environment-variables + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /repositories/{repository_id}/environments/{environment_name}/variables + documentation_url: https://docs.github.com/rest/actions/variables#create-an-environment-variable + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /repositories/{repository_id}/environments/{environment_name}/variables/{name} + documentation_url: https://docs.github.com/rest/actions/variables#delete-an-environment-variable + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /repositories/{repository_id}/environments/{environment_name}/variables/{name} + documentation_url: https://docs.github.com/rest/actions/variables#get-an-environment-variable + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /repositories/{repository_id}/environments/{environment_name}/variables/{name} + documentation_url: https://docs.github.com/rest/actions/variables#update-an-environment-variable + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /scim/v2/Groups + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/scim#list-provisioned-scim-groups-for-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /scim/v2/Groups + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/scim#provision-a-scim-enterprise-group + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /scim/v2/Groups/{scim_group_id} + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/scim#delete-a-scim-group-from-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /scim/v2/Groups/{scim_group_id} + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/scim#get-scim-provisioning-information-for-an-enterprise-group + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /scim/v2/Groups/{scim_group_id} + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/scim#update-an-attribute-for-a-scim-enterprise-group + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /scim/v2/Groups/{scim_group_id} + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/scim#set-scim-information-for-a-provisioned-enterprise-group + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /scim/v2/Users + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/scim#list-scim-provisioned-identities-for-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /scim/v2/Users + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/scim#provision-a-scim-enterprise-user + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /scim/v2/Users/{scim_user_id} + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/scim#delete-a-scim-user-from-an-enterprise + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /scim/v2/Users/{scim_user_id} + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/scim#get-scim-provisioning-information-for-an-enterprise-user + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /scim/v2/Users/{scim_user_id} + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/scim#update-an-attribute-for-a-scim-enterprise-user + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /scim/v2/Users/{scim_user_id} + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/scim#set-scim-information-for-a-provisioned-enterprise-user + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /scim/v2/organizations/{org}/Users + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/scim/scim#list-scim-provisioned-identities + openapi_files: + - descriptions/ghec/ghec.json + - name: POST /scim/v2/organizations/{org}/Users + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/scim/scim#provision-and-invite-a-scim-user + openapi_files: + - descriptions/ghec/ghec.json + - name: DELETE /scim/v2/organizations/{org}/Users/{scim_user_id} + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/scim/scim#delete-a-scim-user-from-an-organization + openapi_files: + - descriptions/ghec/ghec.json + - name: GET /scim/v2/organizations/{org}/Users/{scim_user_id} + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/scim/scim#get-scim-provisioning-information-for-a-user + openapi_files: + - descriptions/ghec/ghec.json + - name: PATCH /scim/v2/organizations/{org}/Users/{scim_user_id} + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/scim/scim#update-an-attribute-for-a-scim-user + openapi_files: + - descriptions/ghec/ghec.json + - name: PUT /scim/v2/organizations/{org}/Users/{scim_user_id} + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/scim/scim#update-a-provisioned-organization-membership + openapi_files: + - descriptions/ghec/ghec.json + - name: GET /search/code + documentation_url: https://docs.github.com/rest/search/search#search-code + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /search/commits + documentation_url: https://docs.github.com/rest/search/search#search-commits + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /search/issues + documentation_url: https://docs.github.com/rest/search/search#search-issues-and-pull-requests + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /search/labels + documentation_url: https://docs.github.com/rest/search/search#search-labels + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /search/repositories + documentation_url: https://docs.github.com/rest/search/search#search-repositories + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /search/topics + documentation_url: https://docs.github.com/rest/search/search#search-topics + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /search/users + documentation_url: https://docs.github.com/rest/search/search#search-users + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /setup/api/configcheck + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/management-console#get-the-configuration-status + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /setup/api/configure + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/management-console#start-a-configuration-process + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /setup/api/maintenance + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/management-console#get-the-maintenance-status + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /setup/api/maintenance + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/management-console#enable-or-disable-maintenance-mode + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /setup/api/settings + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/management-console#get-settings + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /setup/api/settings + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/management-console#set-settings + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /setup/api/settings/authorized-keys + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/management-console#remove-an-authorized-ssh-key + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /setup/api/settings/authorized-keys + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/management-console#get-all-authorized-ssh-keys + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /setup/api/settings/authorized-keys + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/management-console#add-an-authorized-ssh-key + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /setup/api/start + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/management-console#create-a-github-license + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /setup/api/upgrade + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/management-console#upgrade-a-license + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /teams/{team_id} + documentation_url: https://docs.github.com/rest/teams/teams#delete-a-team-legacy + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /teams/{team_id} + documentation_url: https://docs.github.com/rest/teams/teams#get-a-team-legacy + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /teams/{team_id} + documentation_url: https://docs.github.com/rest/teams/teams#update-a-team-legacy + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /teams/{team_id}/discussions + documentation_url: https://docs.github.com/rest/teams/discussions#list-discussions-legacy + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /teams/{team_id}/discussions + documentation_url: https://docs.github.com/rest/teams/discussions#create-a-discussion-legacy + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /teams/{team_id}/discussions/{discussion_number} + documentation_url: https://docs.github.com/rest/teams/discussions#delete-a-discussion-legacy + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /teams/{team_id}/discussions/{discussion_number} + documentation_url: https://docs.github.com/rest/teams/discussions#get-a-discussion-legacy + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /teams/{team_id}/discussions/{discussion_number} + documentation_url: https://docs.github.com/rest/teams/discussions#update-a-discussion-legacy + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /teams/{team_id}/discussions/{discussion_number}/comments + documentation_url: https://docs.github.com/rest/teams/discussion-comments#list-discussion-comments-legacy + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /teams/{team_id}/discussions/{discussion_number}/comments + documentation_url: https://docs.github.com/rest/teams/discussion-comments#create-a-discussion-comment-legacy + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number} + documentation_url: https://docs.github.com/rest/teams/discussion-comments#delete-a-discussion-comment-legacy + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number} + documentation_url: https://docs.github.com/rest/teams/discussion-comments#get-a-discussion-comment-legacy + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number} + documentation_url: https://docs.github.com/rest/teams/discussion-comments#update-a-discussion-comment-legacy + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions + documentation_url: https://docs.github.com/rest/reactions/reactions#list-reactions-for-a-team-discussion-comment-legacy + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions + documentation_url: https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-team-discussion-comment-legacy + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /teams/{team_id}/discussions/{discussion_number}/reactions + documentation_url: https://docs.github.com/rest/reactions/reactions#list-reactions-for-a-team-discussion-legacy + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /teams/{team_id}/discussions/{discussion_number}/reactions + documentation_url: https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-team-discussion-legacy + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /teams/{team_id}/invitations + documentation_url: https://docs.github.com/rest/teams/members#list-pending-team-invitations-legacy + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /teams/{team_id}/members + documentation_url: https://docs.github.com/rest/teams/members#list-team-members-legacy + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /teams/{team_id}/members/{username} + documentation_url: https://docs.github.com/rest/teams/members#remove-team-member-legacy + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /teams/{team_id}/members/{username} + documentation_url: https://docs.github.com/rest/teams/members#get-team-member-legacy + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /teams/{team_id}/members/{username} + documentation_url: https://docs.github.com/rest/teams/members#add-team-member-legacy + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /teams/{team_id}/memberships/{username} + documentation_url: https://docs.github.com/rest/teams/members#remove-team-membership-for-a-user-legacy + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /teams/{team_id}/memberships/{username} + documentation_url: https://docs.github.com/rest/teams/members#get-team-membership-for-a-user-legacy + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /teams/{team_id}/memberships/{username} + documentation_url: https://docs.github.com/rest/teams/members#add-or-update-team-membership-for-a-user-legacy + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /teams/{team_id}/projects + documentation_url: https://docs.github.com/rest/teams/teams#list-team-projects-legacy + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /teams/{team_id}/projects/{project_id} + documentation_url: https://docs.github.com/rest/teams/teams#remove-a-project-from-a-team-legacy + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /teams/{team_id}/projects/{project_id} + documentation_url: https://docs.github.com/rest/teams/teams#check-team-permissions-for-a-project-legacy + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /teams/{team_id}/projects/{project_id} + documentation_url: https://docs.github.com/rest/teams/teams#add-or-update-team-project-permissions-legacy + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /teams/{team_id}/repos + documentation_url: https://docs.github.com/rest/teams/teams#list-team-repositories-legacy + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /teams/{team_id}/repos/{owner}/{repo} + documentation_url: https://docs.github.com/rest/teams/teams#remove-a-repository-from-a-team-legacy + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /teams/{team_id}/repos/{owner}/{repo} + documentation_url: https://docs.github.com/rest/teams/teams#check-team-permissions-for-a-repository-legacy + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /teams/{team_id}/repos/{owner}/{repo} + documentation_url: https://docs.github.com/rest/teams/teams#add-or-update-team-repository-permissions-legacy + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /teams/{team_id}/team-sync/group-mappings + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/teams/team-sync#list-idp-groups-for-a-team-legacy + openapi_files: + - descriptions/ghec/ghec.json + - name: PATCH /teams/{team_id}/team-sync/group-mappings + documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/teams/team-sync#create-or-update-idp-group-connections-legacy + openapi_files: + - descriptions/ghec/ghec.json + - name: GET /teams/{team_id}/teams + documentation_url: https://docs.github.com/rest/teams/teams#list-child-teams-legacy + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /user + documentation_url: https://docs.github.com/rest/users/users#get-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /user + documentation_url: https://docs.github.com/rest/users/users#update-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /user/blocks + documentation_url: https://docs.github.com/rest/users/blocking#list-users-blocked-by-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: DELETE /user/blocks/{username} + documentation_url: https://docs.github.com/rest/users/blocking#unblock-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /user/blocks/{username} + documentation_url: https://docs.github.com/rest/users/blocking#check-if-a-user-is-blocked-by-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: PUT /user/blocks/{username} + documentation_url: https://docs.github.com/rest/users/blocking#block-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /user/codespaces + documentation_url: https://docs.github.com/rest/codespaces/codespaces#list-codespaces-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: POST /user/codespaces + documentation_url: https://docs.github.com/rest/codespaces/codespaces#create-a-codespace-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /user/codespaces/secrets + documentation_url: https://docs.github.com/rest/codespaces/secrets#list-secrets-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /user/codespaces/secrets/public-key + documentation_url: https://docs.github.com/rest/codespaces/secrets#get-public-key-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: DELETE /user/codespaces/secrets/{secret_name} + documentation_url: https://docs.github.com/rest/codespaces/secrets#delete-a-secret-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /user/codespaces/secrets/{secret_name} + documentation_url: https://docs.github.com/rest/codespaces/secrets#get-a-secret-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: PUT /user/codespaces/secrets/{secret_name} + documentation_url: https://docs.github.com/rest/codespaces/secrets#create-or-update-a-secret-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /user/codespaces/secrets/{secret_name}/repositories + documentation_url: https://docs.github.com/rest/codespaces/secrets#list-selected-repositories-for-a-user-secret + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: PUT /user/codespaces/secrets/{secret_name}/repositories + documentation_url: https://docs.github.com/rest/codespaces/secrets#set-selected-repositories-for-a-user-secret + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: DELETE /user/codespaces/secrets/{secret_name}/repositories/{repository_id} + documentation_url: https://docs.github.com/rest/codespaces/secrets#remove-a-selected-repository-from-a-user-secret + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: PUT /user/codespaces/secrets/{secret_name}/repositories/{repository_id} + documentation_url: https://docs.github.com/rest/codespaces/secrets#add-a-selected-repository-to-a-user-secret + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: DELETE /user/codespaces/{codespace_name} + documentation_url: https://docs.github.com/rest/codespaces/codespaces#delete-a-codespace-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /user/codespaces/{codespace_name} + documentation_url: https://docs.github.com/rest/codespaces/codespaces#get-a-codespace-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: PATCH /user/codespaces/{codespace_name} + documentation_url: https://docs.github.com/rest/codespaces/codespaces#update-a-codespace-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: POST /user/codespaces/{codespace_name}/exports + documentation_url: https://docs.github.com/rest/codespaces/codespaces#export-a-codespace-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /user/codespaces/{codespace_name}/exports/{export_id} + documentation_url: https://docs.github.com/rest/codespaces/codespaces#get-details-about-a-codespace-export + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /user/codespaces/{codespace_name}/machines + documentation_url: https://docs.github.com/rest/codespaces/machines#list-machine-types-for-a-codespace + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: POST /user/codespaces/{codespace_name}/publish + documentation_url: https://docs.github.com/rest/codespaces/codespaces#create-a-repository-from-an-unpublished-codespace + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: POST /user/codespaces/{codespace_name}/start + documentation_url: https://docs.github.com/rest/codespaces/codespaces#start-a-codespace-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: POST /user/codespaces/{codespace_name}/stop + documentation_url: https://docs.github.com/rest/codespaces/codespaces#stop-a-codespace-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /user/docker/conflicts + documentation_url: https://docs.github.com/rest/packages/packages#get-list-of-conflicting-packages-during-docker-migration-for-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /user/email/visibility + documentation_url: https://docs.github.com/rest/users/emails#set-primary-email-visibility-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: DELETE /user/emails + documentation_url: https://docs.github.com/rest/users/emails#delete-an-email-address-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /user/emails + documentation_url: https://docs.github.com/rest/users/emails#list-email-addresses-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /user/emails + documentation_url: https://docs.github.com/rest/users/emails#add-an-email-address-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /user/followers + documentation_url: https://docs.github.com/rest/users/followers#list-followers-of-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /user/following + documentation_url: https://docs.github.com/rest/users/followers#list-the-people-the-authenticated-user-follows + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /user/following/{username} + documentation_url: https://docs.github.com/rest/users/followers#unfollow-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /user/following/{username} + documentation_url: https://docs.github.com/rest/users/followers#check-if-a-person-is-followed-by-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /user/following/{username} + documentation_url: https://docs.github.com/rest/users/followers#follow-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /user/gpg_keys + documentation_url: https://docs.github.com/rest/users/gpg-keys#list-gpg-keys-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /user/gpg_keys + documentation_url: https://docs.github.com/rest/users/gpg-keys#create-a-gpg-key-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /user/gpg_keys/{gpg_key_id} + documentation_url: https://docs.github.com/rest/users/gpg-keys#delete-a-gpg-key-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /user/gpg_keys/{gpg_key_id} + documentation_url: https://docs.github.com/rest/users/gpg-keys#get-a-gpg-key-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /user/installations + documentation_url: https://docs.github.com/rest/apps/installations#list-app-installations-accessible-to-the-user-access-token + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /user/installations/{installation_id}/repositories + documentation_url: https://docs.github.com/rest/apps/installations#list-repositories-accessible-to-the-user-access-token + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /user/installations/{installation_id}/repositories/{repository_id} + documentation_url: https://docs.github.com/rest/apps/installations#remove-a-repository-from-an-app-installation + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /user/installations/{installation_id}/repositories/{repository_id} + documentation_url: https://docs.github.com/rest/apps/installations#add-a-repository-to-an-app-installation + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /user/interaction-limits + documentation_url: https://docs.github.com/rest/interactions/user#remove-interaction-restrictions-from-your-public-repositories + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /user/interaction-limits + documentation_url: https://docs.github.com/rest/interactions/user#get-interaction-restrictions-for-your-public-repositories + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: PUT /user/interaction-limits + documentation_url: https://docs.github.com/rest/interactions/user#set-interaction-restrictions-for-your-public-repositories + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /user/issues + documentation_url: https://docs.github.com/rest/issues/issues#list-user-account-issues-assigned-to-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /user/keys + documentation_url: https://docs.github.com/rest/users/keys#list-public-ssh-keys-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /user/keys + documentation_url: https://docs.github.com/rest/users/keys#create-a-public-ssh-key-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /user/keys/{key_id} + documentation_url: https://docs.github.com/rest/users/keys#delete-a-public-ssh-key-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /user/keys/{key_id} + documentation_url: https://docs.github.com/rest/users/keys#get-a-public-ssh-key-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /user/marketplace_purchases + documentation_url: https://docs.github.com/rest/apps/marketplace#list-subscriptions-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /user/marketplace_purchases/stubbed + documentation_url: https://docs.github.com/rest/apps/marketplace#list-subscriptions-for-the-authenticated-user-stubbed + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /user/memberships/orgs + documentation_url: https://docs.github.com/rest/orgs/members#list-organization-memberships-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /user/memberships/orgs/{org} + documentation_url: https://docs.github.com/rest/orgs/members#get-an-organization-membership-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /user/memberships/orgs/{org} + documentation_url: https://docs.github.com/rest/orgs/members#update-an-organization-membership-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /user/migrations + documentation_url: https://docs.github.com/rest/migrations/users#list-user-migrations + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /user/migrations + documentation_url: https://docs.github.com/rest/migrations/users#start-a-user-migration + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /user/migrations/{migration_id} + documentation_url: https://docs.github.com/rest/migrations/users#get-a-user-migration-status + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: DELETE /user/migrations/{migration_id}/archive + documentation_url: https://docs.github.com/rest/migrations/users#delete-a-user-migration-archive + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /user/migrations/{migration_id}/archive + documentation_url: https://docs.github.com/rest/migrations/users#download-a-user-migration-archive + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /user/migrations/{migration_id}/repos/{repo_name}/lock + documentation_url: https://docs.github.com/rest/migrations/users#unlock-a-user-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /user/migrations/{migration_id}/repositories + documentation_url: https://docs.github.com/rest/migrations/users#list-repositories-for-a-user-migration + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /user/orgs + documentation_url: https://docs.github.com/rest/orgs/orgs#list-organizations-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /user/packages + documentation_url: https://docs.github.com/rest/packages/packages#list-packages-for-the-authenticated-users-namespace + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /user/packages/{package_type}/{package_name} + documentation_url: https://docs.github.com/rest/packages/packages#delete-a-package-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /user/packages/{package_type}/{package_name} + documentation_url: https://docs.github.com/rest/packages/packages#get-a-package-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /user/packages/{package_type}/{package_name}/restore + documentation_url: https://docs.github.com/rest/packages/packages#restore-a-package-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /user/packages/{package_type}/{package_name}/versions + documentation_url: https://docs.github.com/rest/packages/packages#list-package-versions-for-a-package-owned-by-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /user/packages/{package_type}/{package_name}/versions/{package_version_id} + documentation_url: https://docs.github.com/rest/packages/packages#delete-a-package-version-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /user/packages/{package_type}/{package_name}/versions/{package_version_id} + documentation_url: https://docs.github.com/rest/packages/packages#get-a-package-version-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /user/packages/{package_type}/{package_name}/versions/{package_version_id}/restore + documentation_url: https://docs.github.com/rest/packages/packages#restore-a-package-version-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /user/projects + documentation_url: https://docs.github.com/rest/projects/projects#create-a-user-project + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /user/public_emails + documentation_url: https://docs.github.com/rest/users/emails#list-public-email-addresses-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /user/repos + documentation_url: https://docs.github.com/rest/repos/repos#list-repositories-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /user/repos + documentation_url: https://docs.github.com/rest/repos/repos#create-a-repository-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /user/repository_invitations + documentation_url: https://docs.github.com/rest/collaborators/invitations#list-repository-invitations-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /user/repository_invitations/{invitation_id} + documentation_url: https://docs.github.com/rest/collaborators/invitations#decline-a-repository-invitation + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PATCH /user/repository_invitations/{invitation_id} + documentation_url: https://docs.github.com/rest/collaborators/invitations#accept-a-repository-invitation + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /user/social_accounts + documentation_url: https://docs.github.com/rest/users/social-accounts#delete-social-accounts-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /user/social_accounts + documentation_url: https://docs.github.com/rest/users/social-accounts#list-social-accounts-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /user/social_accounts + documentation_url: https://docs.github.com/rest/users/social-accounts#add-social-accounts-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /user/ssh_signing_keys + documentation_url: https://docs.github.com/rest/users/ssh-signing-keys#list-ssh-signing-keys-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /user/ssh_signing_keys + documentation_url: https://docs.github.com/rest/users/ssh-signing-keys#create-a-ssh-signing-key-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /user/ssh_signing_keys/{ssh_signing_key_id} + documentation_url: https://docs.github.com/rest/users/ssh-signing-keys#delete-an-ssh-signing-key-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /user/ssh_signing_keys/{ssh_signing_key_id} + documentation_url: https://docs.github.com/rest/users/ssh-signing-keys#get-an-ssh-signing-key-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /user/starred + documentation_url: https://docs.github.com/rest/activity/starring#list-repositories-starred-by-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /user/starred/{owner}/{repo} + documentation_url: https://docs.github.com/rest/activity/starring#unstar-a-repository-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /user/starred/{owner}/{repo} + documentation_url: https://docs.github.com/rest/activity/starring#check-if-a-repository-is-starred-by-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /user/starred/{owner}/{repo} + documentation_url: https://docs.github.com/rest/activity/starring#star-a-repository-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /user/subscriptions + documentation_url: https://docs.github.com/rest/activity/watching#list-repositories-watched-by-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /user/teams + documentation_url: https://docs.github.com/rest/teams/teams#list-teams-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /users + documentation_url: https://docs.github.com/rest/users/users#list-users + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /users/{username} + documentation_url: https://docs.github.com/rest/users/users#get-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /users/{username}/docker/conflicts + documentation_url: https://docs.github.com/rest/packages/packages#get-list-of-conflicting-packages-during-docker-migration-for-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /users/{username}/events + documentation_url: https://docs.github.com/rest/activity/events#list-events-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /users/{username}/events/orgs/{org} + documentation_url: https://docs.github.com/rest/activity/events#list-organization-events-for-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /users/{username}/events/public + documentation_url: https://docs.github.com/rest/activity/events#list-public-events-for-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /users/{username}/followers + documentation_url: https://docs.github.com/rest/users/followers#list-followers-of-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /users/{username}/following + documentation_url: https://docs.github.com/rest/users/followers#list-the-people-a-user-follows + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /users/{username}/following/{target_user} + documentation_url: https://docs.github.com/rest/users/followers#check-if-a-user-follows-another-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /users/{username}/gists + documentation_url: https://docs.github.com/rest/gists/gists#list-gists-for-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /users/{username}/gpg_keys + documentation_url: https://docs.github.com/rest/users/gpg-keys#list-gpg-keys-for-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /users/{username}/hovercard + documentation_url: https://docs.github.com/rest/users/users#get-contextual-information-for-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /users/{username}/installation + documentation_url: https://docs.github.com/rest/apps/apps#get-a-user-installation-for-the-authenticated-app + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /users/{username}/keys + documentation_url: https://docs.github.com/rest/users/keys#list-public-keys-for-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /users/{username}/orgs + documentation_url: https://docs.github.com/rest/orgs/orgs#list-organizations-for-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /users/{username}/packages + documentation_url: https://docs.github.com/rest/packages/packages#list-packages-for-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /users/{username}/packages/{package_type}/{package_name} + documentation_url: https://docs.github.com/rest/packages/packages#delete-a-package-for-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /users/{username}/packages/{package_type}/{package_name} + documentation_url: https://docs.github.com/rest/packages/packages#get-a-package-for-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /users/{username}/packages/{package_type}/{package_name}/restore + documentation_url: https://docs.github.com/rest/packages/packages#restore-a-package-for-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /users/{username}/packages/{package_type}/{package_name}/versions + documentation_url: https://docs.github.com/rest/packages/packages#list-package-versions-for-a-package-owned-by-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id} + documentation_url: https://docs.github.com/rest/packages/packages#delete-package-version-for-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id} + documentation_url: https://docs.github.com/rest/packages/packages#get-a-package-version-for-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: POST /users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id}/restore + documentation_url: https://docs.github.com/rest/packages/packages#restore-package-version-for-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /users/{username}/projects + documentation_url: https://docs.github.com/rest/projects/projects#list-user-projects + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /users/{username}/received_events + documentation_url: https://docs.github.com/rest/activity/events#list-events-received-by-the-authenticated-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /users/{username}/received_events/public + documentation_url: https://docs.github.com/rest/activity/events#list-public-events-received-by-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /users/{username}/repos + documentation_url: https://docs.github.com/rest/repos/repos#list-repositories-for-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /users/{username}/settings/billing/actions + documentation_url: https://docs.github.com/rest/billing/billing#get-github-actions-billing-for-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /users/{username}/settings/billing/packages + documentation_url: https://docs.github.com/rest/billing/billing#get-github-packages-billing-for-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /users/{username}/settings/billing/shared-storage + documentation_url: https://docs.github.com/rest/billing/billing#get-shared-storage-billing-for-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: DELETE /users/{username}/site_admin + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#demote-a-site-administrator + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /users/{username}/site_admin + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#promote-a-user-to-be-a-site-administrator + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /users/{username}/social_accounts + documentation_url: https://docs.github.com/rest/users/social-accounts#list-social-accounts-for-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /users/{username}/ssh_signing_keys + documentation_url: https://docs.github.com/rest/users/ssh-signing-keys#list-ssh-signing-keys-for-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /users/{username}/starred + documentation_url: https://docs.github.com/rest/activity/starring#list-repositories-starred-by-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /users/{username}/subscriptions + documentation_url: https://docs.github.com/rest/activity/watching#list-repositories-watched-by-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: DELETE /users/{username}/suspended + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#unsuspend-a-user + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: PUT /users/{username}/suspended + documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#suspend-a-user + openapi_files: + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /versions + documentation_url: https://docs.github.com/rest/meta/meta#get-all-api-versions + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /zen + documentation_url: https://docs.github.com/rest/meta/meta#get-the-zen-of-github + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json diff --git a/script/lint.sh b/script/lint.sh index af5ae991006..b76758a47d4 100755 --- a/script/lint.sh +++ b/script/lint.sh @@ -1,5 +1,7 @@ #!/bin/sh -#/ script/lint.sh runs linters and validates generated files. +#/ [ CHECK_GITHUB_OPENAPI=1 ] script/lint.sh runs linters and validates generated files. +#/ When CHECK_GITHUB is set, it validates that openapi_operations.yaml is consistent with the +#/ descriptions from github.com/github/rest-api-description. set -e @@ -10,6 +12,13 @@ BIN="$(pwd -P)"/bin mkdir -p "$BIN" +EXIT_CODE=0 + +fail() { + echo "$@" + EXIT_CODE=1 +} + # install golangci-lint bin/golangci-lint doesn't exist with the correct version if ! "$BIN"/golangci-lint --version 2> /dev/null | grep -q "$GOLANGCI_LINT_VERSION"; then GOBIN="$BIN" go install "github.com/golangci/golangci-lint/cmd/golangci-lint@v$GOLANGCI_LINT_VERSION" @@ -28,11 +37,17 @@ for dir in $MOD_DIRS; do else "$BIN"/golangci-lint run --path-prefix "$dir" fi - ) || FAILED=1 + ) || fail "failed linting $dir" done -script/generate.sh --check || FAILED=1 - -if [ -n "$FAILED" ]; then - exit 1 +if [ -n "$CHECK_GITHUB_OPENAPI" ]; then + echo validating openapi_operations.yaml + script/metadata.sh update-openapi --validate || fail "failed validating openapi_operations.yaml" fi + +echo validating generated files +script/generate.sh --check || fail "failed validating generated files" + +[ -z "$FAILED" ] || exit 1 + +exit "$EXIT_CODE" diff --git a/script/metadata.sh b/script/metadata.sh new file mode 100755 index 00000000000..3b7c7fbeb8b --- /dev/null +++ b/script/metadata.sh @@ -0,0 +1,14 @@ +#!/bin/sh +#/ script/metadata.sh runs ./tools/metadata in the repository root with the given arguments + +set -e + +CDPATH="" cd -- "$(dirname -- "$0")/.." +REPO_DIR="$(pwd)" + +( + cd tools/metadata + go build -o "$REPO_DIR"/bin/metadata +) + +exec bin/metadata "$@" diff --git a/script/test.sh b/script/test.sh index 23e6a0c8f84..dedd832ecad 100755 --- a/script/test.sh +++ b/script/test.sh @@ -1,6 +1,8 @@ #!/bin/sh #/ script/test.sh runs tests on each go module in go-github. Arguments are passed to each go test invocation. #/ "-race -covermode atomic ./..." is used when no arguments are given. +#/ +#/ When UPDATE_GOLDEN is set, all directories named "golden" are removed before running tests. set -e @@ -10,6 +12,10 @@ if [ "$#" = "0" ]; then set -- -race -covermode atomic ./... fi +if [ -n "$UPDATE_GOLDEN" ]; then + find . -name golden -type d -exec rm -rf {} + +fi + MOD_DIRS="$(git ls-files '*go.mod' | xargs dirname | sort)" for dir in $MOD_DIRS; do diff --git a/tools/go.mod b/tools/go.mod new file mode 100644 index 00000000000..8085d1a1ce9 --- /dev/null +++ b/tools/go.mod @@ -0,0 +1,24 @@ +module tools + +go 1.20 + +require ( + github.com/alecthomas/kong v0.8.1 + github.com/getkin/kin-openapi v0.120.0 + github.com/google/go-cmp v0.6.0 + github.com/google/go-github/v56 v56.0.0 + golang.org/x/sync v0.4.0 + gopkg.in/yaml.v3 v3.0.1 +) + +require ( + github.com/go-openapi/jsonpointer v0.19.6 // indirect + github.com/go-openapi/swag v0.22.4 // indirect + github.com/google/go-querystring v1.1.0 // indirect + github.com/invopop/yaml v0.2.0 // indirect + github.com/josharian/intern v1.0.0 // indirect + github.com/mailru/easyjson v0.7.7 // indirect + github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect + github.com/perimeterx/marshmallow v1.1.5 // indirect + github.com/stretchr/testify v1.8.4 // indirect +) diff --git a/tools/go.sum b/tools/go.sum new file mode 100644 index 00000000000..46bc40af389 --- /dev/null +++ b/tools/go.sum @@ -0,0 +1,61 @@ +github.com/alecthomas/assert/v2 v2.1.0 h1:tbredtNcQnoSd3QBhQWI7QZ3XHOVkw1Moklp2ojoH/0= +github.com/alecthomas/kong v0.8.1 h1:acZdn3m4lLRobeh3Zi2S2EpnXTd1mOL6U7xVml+vfkY= +github.com/alecthomas/kong v0.8.1/go.mod h1:n1iCIO2xS46oE8ZfYCNDqdR0b0wZNrXAIAqro/2132U= +github.com/alecthomas/repr v0.1.0 h1:ENn2e1+J3k09gyj2shc0dHr/yjaWSHRlrJ4DPMevDqE= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/getkin/kin-openapi v0.120.0 h1:MqJcNJFrMDFNc07iwE8iFC5eT2k/NPUFDIpNeiZv8Jg= +github.com/getkin/kin-openapi v0.120.0/go.mod h1:PCWw/lfBrJY4HcdqE3jj+QFkaFK8ABoqo7PvqVhXXqw= +github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= +github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= +github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU= +github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-test/deep v1.0.8 h1:TDsG77qcSprGbC6vTN8OuXp5g+J+b5Pcguhf7Zt61VM= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-github/v56 v56.0.0 h1:TysL7dMa/r7wsQi44BjqlwaHvwlFlqkK8CtBWCX3gb4= +github.com/google/go-github/v56 v56.0.0/go.mod h1:D8cdcX98YWJvi7TLo7zM4/h8ZTx6u6fwGEkCdisopo0= +github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= +github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= +github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= +github.com/invopop/yaml v0.2.0 h1:7zky/qH+O0DwAyoobXUqvVBwgBFRxKoQ/3FjcVpjTMY= +github.com/invopop/yaml v0.2.0/go.mod h1:2XuRLgs/ouIrW3XNzuNj7J3Nvu/Dig5MXvbCEdiBN3Q= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= +github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw= +github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= +github.com/perimeterx/marshmallow v1.1.5 h1:a2LALqQ1BlHM8PZblsDdidgv1mWi1DgC2UmX50IvK2s= +github.com/perimeterx/marshmallow v1.1.5/go.mod h1:dsXbUu8CRzfYP5a87xpp0xq9S3u0Vchtcl8we9tYaXw= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= +golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= +golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/tools/metadata/main.go b/tools/metadata/main.go new file mode 100644 index 00000000000..0b0562948f0 --- /dev/null +++ b/tools/metadata/main.go @@ -0,0 +1,194 @@ +// Copyright 2023 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// metadata is a command-line tool used to check and update this repo. +// See CONTRIBUTING.md for details. +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + "path/filepath" + + "github.com/alecthomas/kong" + "github.com/google/go-github/v56/github" +) + +var helpVars = kong.Vars{ + "update_openapi_help": ` +Update openapi_operations.yaml from OpenAPI descriptions in github.com/github/rest-api-description at the given git ref. +`, + + "update_go_help": ` +Update go source code to be consistent with openapi_operations.yaml. + - Adds and updates "// GitHub API docs:" comments for service methods. + - Updates "//meta:operation" comments to use canonical operation names. + - Updates formatting of "//meta:operation" comments to make sure there isn't a space between the "//" and the "meta". + - Formats modified files with the equivalent of "go fmt". +`, + + "format_help": `Format whitespace in openapi_operations.yaml and sort its operations.`, + "unused_help": `List operations in openapi_operations.yaml that aren't used by any service methods.`, + + "working_dir_help": `Working directory. Should be the root of the go-github repository.`, + "openapi_ref_help": `Git ref to pull OpenAPI descriptions from.`, + + "openapi_validate_help": ` +Instead of updating, make sure that the operations in openapi_operations.yaml's "openapi_operations" field are +consistent with the sha listed in "openapi_commit". This is run in CI as a convenience so that reviewers can trust +changes to openapi_operations.yaml. +`, + + "output_json_help": `Output JSON.`, +} + +type rootCmd struct { + UpdateOpenAPI updateOpenAPICmd `kong:"cmd,name=update-openapi,help=${update_openapi_help}"` + UpdateGo updateGoCmd `kong:"cmd,help=${update_go_help}"` + Format formatCmd `kong:"cmd,help=${format_help}"` + Unused unusedCmd `kong:"cmd,help=${unused_help}"` + + WorkingDir string `kong:"short=C,default=.,help=${working_dir_help}"` + + // for testing + GithubURL string `kong:"hidden,default='https://api.github.com'"` +} + +func (c *rootCmd) opsFile() (string, *operationsFile, error) { + filename := filepath.Join(c.WorkingDir, "openapi_operations.yaml") + opsFile, err := loadOperationsFile(filename) + if err != nil { + return "", nil, err + } + return filename, opsFile, nil +} + +func githubClient(apiURL string) (*github.Client, error) { + token := os.Getenv("GITHUB_TOKEN") + if token == "" { + return nil, fmt.Errorf("GITHUB_TOKEN environment variable must be set to a GitHub personal access token with the public_repo scope") + } + return github.NewClient(nil).WithAuthToken(token).WithEnterpriseURLs(apiURL, "") +} + +type updateOpenAPICmd struct { + Ref string `kong:"default=main,help=${openapi_ref_help}"` + ValidateGithub bool `kong:"name=validate,help=${openapi_validate_help}"` +} + +func (c *updateOpenAPICmd) Run(root *rootCmd) error { + ctx := context.Background() + if c.ValidateGithub && c.Ref != "main" { + return fmt.Errorf("--validate and --ref are mutually exclusive") + } + filename, opsFile, err := root.opsFile() + if err != nil { + return err + } + origOps := make([]*operation, len(opsFile.OpenapiOps)) + copy(origOps, opsFile.OpenapiOps) + for i := range origOps { + origOps[i] = origOps[i].clone() + } + client, err := githubClient(root.GithubURL) + if err != nil { + return err + } + ref := c.Ref + if c.ValidateGithub { + ref = opsFile.GitCommit + if ref == "" { + return fmt.Errorf("openapi_operations.yaml does not have an openapi_commit field") + } + } + err = opsFile.updateFromGithub(ctx, client, ref) + if err != nil { + return err + } + if !c.ValidateGithub { + return opsFile.saveFile(filename) + } + if !operationsEqual(origOps, opsFile.OpenapiOps) { + return fmt.Errorf("openapi_operations.yaml does not match the OpenAPI descriptions in github.com/github/rest-api-description") + } + return nil +} + +type formatCmd struct{} + +func (c *formatCmd) Run(root *rootCmd) error { + filename, opsFile, err := root.opsFile() + if err != nil { + return err + } + return opsFile.saveFile(filename) +} + +type updateGoCmd struct{} + +func (c *updateGoCmd) Run(root *rootCmd) error { + _, opsFile, err := root.opsFile() + if err != nil { + return err + } + err = updateDocs(opsFile, filepath.Join(root.WorkingDir, "github")) + return err +} + +type unusedCmd struct { + JSON bool `kong:"help=${output_json_help}"` +} + +func (c *unusedCmd) Run(root *rootCmd, k *kong.Context) error { + _, opsFile, err := root.opsFile() + if err != nil { + return err + } + unused, err := unusedOps(opsFile, filepath.Join(root.WorkingDir, "github")) + if err != nil { + return err + } + if c.JSON { + enc := json.NewEncoder(k.Stdout) + enc.SetIndent("", " ") + return enc.Encode(unused) + } + fmt.Fprintf(k.Stdout, "Found %d unused operations\n", len(unused)) + if len(unused) == 0 { + return nil + } + fmt.Fprintln(k.Stdout, "") + for _, op := range unused { + fmt.Fprintln(k.Stdout, op.Name) + if op.DocumentationURL != "" { + fmt.Fprintf(k.Stdout, "doc: %s\n", op.DocumentationURL) + } + fmt.Fprintln(k.Stdout, "") + } + return nil +} + +func main() { + err := run(os.Args[1:], nil) + if err != nil { + fmt.Fprintln(os.Stderr, err) + os.Exit(1) + } +} + +func run(args []string, opts []kong.Option) error { + var cmd rootCmd + parser, err := kong.New(&cmd, append(opts, helpVars)...) + if err != nil { + return err + } + k, err := parser.Parse(args) + if err != nil { + return err + } + return k.Run() +} diff --git a/tools/metadata/main_test.go b/tools/metadata/main_test.go new file mode 100644 index 00000000000..39fe5357d0f --- /dev/null +++ b/tools/metadata/main_test.go @@ -0,0 +1,422 @@ +// Copyright 2023 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + "io/fs" + "net/http" + "net/http/httptest" + "net/url" + "os" + "path" + "path/filepath" + "strings" + "testing" + + "github.com/alecthomas/kong" + "github.com/getkin/kin-openapi/openapi3" + "github.com/google/go-cmp/cmp" + "github.com/google/go-github/v56/github" +) + +func TestUpdateGo(t *testing.T) { + t.Run("valid", func(t *testing.T) { + res := runTest(t, "testdata/update-go/valid", "update-go") + res.assertOutput("", "") + res.assertNoErr() + res.checkGolden() + }) + + t.Run("invalid", func(t *testing.T) { + res := runTest(t, "testdata/update-go/invalid", "update-go") + res.assertOutput("", "") + res.assertErr(` +no operations defined for AService.NoOperation +no operations defined for AService.NoComment +ambiguous operation "GET /ambiguous/{}" could match any of: [GET /ambiguous/{id} GET /ambiguous/{name}] +could not find operation "GET /missing/{id}" in openapi_operations.yaml +duplicate operation: GET /a/{a_id} +`) + res.checkGolden() + }) +} + +func TestUnused(t *testing.T) { + res := runTest(t, "testdata/unused", "unused") + res.assertOutput(` +Found 3 unused operations + +GET /a/{a_id} +doc: https://docs.github.com/rest/a/a#overridden-get-a + +POST /a/{a_id} +doc: https://docs.github.com/rest/a/a#update-a + +GET /undocumented/{undocumented_id} +`, "") +} + +func TestUpdateOpenAPI(t *testing.T) { + testServer := newTestServer(t, "main", map[string]interface{}{ + "api.github.com/api.github.com.json": openapi3.T{ + Paths: openapi3.Paths{ + "/a/{a_id}": &openapi3.PathItem{ + Get: &openapi3.Operation{ + ExternalDocs: &openapi3.ExternalDocs{ + URL: "https://docs.github.com/rest/reference/a", + }, + }, + }, + }, + }, + "ghec/ghec.json": openapi3.T{ + Paths: openapi3.Paths{ + "/a/b/{a_id}": &openapi3.PathItem{ + Get: &openapi3.Operation{ + ExternalDocs: &openapi3.ExternalDocs{ + URL: "https://docs.github.com/rest/reference/a", + }, + }, + }, + }, + }, + "ghes-3.9/ghes-3.9.json": openapi3.T{ + Paths: openapi3.Paths{ + "/a/b/{a_id}": &openapi3.PathItem{ + Get: &openapi3.Operation{ + ExternalDocs: &openapi3.ExternalDocs{ + URL: "https://docs.github.com/rest/reference/a", + }, + }, + }, + }, + }, + "ghes-3.10/ghes-3.10.json": openapi3.T{ + Paths: openapi3.Paths{ + "/a/b/{a_id}": &openapi3.PathItem{ + Get: &openapi3.Operation{ + ExternalDocs: &openapi3.ExternalDocs{ + URL: "https://docs.github.com/rest/reference/a", + }, + }, + }, + }, + }, + "ghes-2.22/ghes-2.22.json": openapi3.T{ + Paths: openapi3.Paths{ + "/a/b/{a_id}": &openapi3.PathItem{ + Get: &openapi3.Operation{ + ExternalDocs: &openapi3.ExternalDocs{ + URL: "https://docs.github.com/rest/reference/a", + }, + }, + }, + }, + }, + }) + + res := runTest(t, "testdata/update-openapi", "update-openapi", "--github-url", testServer.URL) + res.assertOutput("", "") + res.assertNoErr() + res.checkGolden() +} + +func TestFormat(t *testing.T) { + res := runTest(t, "testdata/format", "format") + res.assertOutput("", "") + res.assertNoErr() + res.checkGolden() +} + +func updateGoldenDir(t *testing.T, origDir, resultDir, goldenDir string) { + t.Helper() + if os.Getenv("UPDATE_GOLDEN") == "" { + return + } + assertNilError(t, os.RemoveAll(goldenDir)) + assertNilError(t, filepath.WalkDir(resultDir, func(path string, d fs.DirEntry, err error) error { + if err != nil || d.IsDir() { + return err + } + relName := mustRel(t, resultDir, path) + origName := filepath.Join(origDir, relName) + _, err = os.Stat(origName) + if err != nil { + if os.IsNotExist(err) { + err = os.MkdirAll(filepath.Dir(filepath.Join(goldenDir, relName)), d.Type()) + if err != nil { + return err + } + return copyFile(path, filepath.Join(goldenDir, relName)) + } + return err + } + resContent, err := os.ReadFile(path) + if err != nil { + return err + } + origContent, err := os.ReadFile(origName) + if err != nil { + return err + } + if bytes.Equal(resContent, origContent) { + return nil + } + return copyFile(path, filepath.Join(goldenDir, relName)) + })) +} + +func checkGoldenDir(t *testing.T, origDir, resultDir, goldenDir string) { + t.Helper() + golden := true + t.Cleanup(func() { + t.Helper() + if !golden { + t.Log("To regenerate golden files run `UPDATE_GOLDEN=1 script/test.sh`") + } + }) + updateGoldenDir(t, origDir, resultDir, goldenDir) + checked := map[string]bool{} + _, err := os.Stat(goldenDir) + if err == nil { + assertNilError(t, filepath.Walk(goldenDir, func(wantPath string, info fs.FileInfo, err error) error { + relPath := mustRel(t, goldenDir, wantPath) + if err != nil || info.IsDir() { + return err + } + if !assertEqualFiles(t, wantPath, filepath.Join(resultDir, relPath)) { + golden = false + } + checked[relPath] = true + return nil + })) + } + assertNilError(t, filepath.Walk(origDir, func(wantPath string, info fs.FileInfo, err error) error { + relPath := mustRel(t, origDir, wantPath) + if err != nil || info.IsDir() || checked[relPath] { + return err + } + if !assertEqualFiles(t, wantPath, filepath.Join(resultDir, relPath)) { + golden = false + } + checked[relPath] = true + return nil + })) + assertNilError(t, filepath.Walk(resultDir, func(resultPath string, info fs.FileInfo, err error) error { + relPath := mustRel(t, resultDir, resultPath) + if err != nil || info.IsDir() || checked[relPath] { + return err + } + golden = false + return fmt.Errorf("found unexpected file:\n%s", relPath) + })) +} + +func mustRel(t *testing.T, base, target string) string { + t.Helper() + rel, err := filepath.Rel(base, target) + assertNilError(t, err) + return rel +} + +func copyDir(t *testing.T, dst, src string) error { + fmt.Println("dst", dst) + dst, err := filepath.Abs(dst) + if err != nil { + return err + } + return filepath.Walk(src, func(srcPath string, info fs.FileInfo, err error) error { + if err != nil || info.IsDir() { + return err + } + dstPath := filepath.Join(dst, mustRel(t, src, srcPath)) + err = copyFile(srcPath, dstPath) + return err + }) +} + +func copyFile(src, dst string) (errOut error) { + srcDirStat, err := os.Stat(filepath.Dir(src)) + if err != nil { + return err + } + err = os.MkdirAll(filepath.Dir(dst), srcDirStat.Mode()) + if err != nil { + return err + } + dstFile, err := os.Create(dst) + if err != nil { + return err + } + defer func() { + e := dstFile.Close() + if errOut == nil { + errOut = e + } + }() + srcFile, err := os.Open(src) + if err != nil { + return err + } + defer func() { + e := srcFile.Close() + if errOut == nil { + errOut = e + } + }() + _, err = io.Copy(dstFile, srcFile) + return err +} + +type testRun struct { + t *testing.T + workDir string + srcDir string + stdOut bytes.Buffer + stdErr bytes.Buffer + err error +} + +func (r testRun) checkGolden() { + r.t.Helper() + checkGoldenDir(r.t, r.srcDir, r.workDir, filepath.Join("testdata", "golden", r.t.Name())) +} + +func (r testRun) assertOutput(stdout, stderr string) { + r.t.Helper() + assertEqualStrings(r.t, strings.TrimSpace(stdout), strings.TrimSpace(r.stdOut.String())) + assertEqualStrings(r.t, strings.TrimSpace(stderr), strings.TrimSpace(r.stdErr.String())) +} + +func (r testRun) assertNoErr() { + r.t.Helper() + assertNilError(r.t, r.err) +} + +func (r testRun) assertErr(want string) { + r.t.Helper() + if r.err == nil { + r.t.Error("expected error") + return + } + if strings.TrimSpace(r.err.Error()) != strings.TrimSpace(want) { + r.t.Errorf("unexpected error:\nwant:\n%s\ngot:\n%s", want, r.err.Error()) + } +} + +func runTest(t *testing.T, srcDir string, args ...string) testRun { + t.Helper() + srcDir = filepath.FromSlash(srcDir) + res := testRun{ + t: t, + workDir: t.TempDir(), + srcDir: srcDir, + } + err := copyDir(t, res.workDir, srcDir) + if err != nil { + t.Error(err) + return res + } + res.err = run( + append(args, "-C", res.workDir), + []kong.Option{kong.Writers(&res.stdOut, &res.stdErr)}, + ) + return res +} + +func newTestServer(t *testing.T, ref string, files map[string]interface{}) *httptest.Server { + t.Helper() + jsonHandler := func(wantQuery url.Values, val interface{}) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + gotQuery := r.URL.Query() + queryDiff := cmp.Diff(wantQuery, gotQuery) + if queryDiff != "" { + t.Errorf("query mismatch for %s (-want +got):\n%s", r.URL.Path, queryDiff) + } + w.WriteHeader(200) + err := json.NewEncoder(w).Encode(val) + if err != nil { + panic(err) + } + } + } + repoPath := "/api/v3/repos/github/rest-api-description" + emptyQuery := url.Values{} + refQuery := url.Values{"ref": []string{ref}} + mux := http.NewServeMux() + server := httptest.NewServer(mux) + mux.HandleFunc( + path.Join(repoPath, "commits", ref), + jsonHandler(emptyQuery, &github.RepositoryCommit{SHA: github.String("s")}), + ) + var descriptionsContent []*github.RepositoryContent + for name, content := range files { + descriptionsContent = append(descriptionsContent, &github.RepositoryContent{ + Name: github.String(path.Base(path.Dir(name))), + }) + mux.HandleFunc( + path.Join(repoPath, "contents/descriptions", path.Dir(name)), + jsonHandler(refQuery, []*github.RepositoryContent{ + { + Name: github.String(path.Base(name)), + DownloadURL: github.String(server.URL + "/dl/" + name), + }, + }), + ) + mux.HandleFunc( + path.Join("/dl", name), + jsonHandler(emptyQuery, content), + ) + } + mux.HandleFunc( + path.Join(repoPath, "contents/descriptions"), + jsonHandler(refQuery, descriptionsContent), + ) + t.Cleanup(server.Close) + t.Setenv("GITHUB_TOKEN", "fake token") + return server +} + +func assertEqualStrings(t *testing.T, want, got string) { + t.Helper() + diff := cmp.Diff(want, got) + if diff != "" { + t.Error(diff) + } +} + +func assertEqualFiles(t *testing.T, want, got string) bool { + t.Helper() + wantBytes, err := os.ReadFile(want) + if !assertNilError(t, err) { + return false + } + wantBytes = bytes.ReplaceAll(wantBytes, []byte("\r\n"), []byte("\n")) + gotBytes, err := os.ReadFile(got) + if !assertNilError(t, err) { + return false + } + gotBytes = bytes.ReplaceAll(gotBytes, []byte("\r\n"), []byte("\n")) + if !bytes.Equal(wantBytes, gotBytes) { + diff := cmp.Diff(string(wantBytes), string(gotBytes)) + t.Errorf("files %q and %q differ: %s", want, got, diff) + return false + } + return true +} + +func assertNilError(t *testing.T, err error) bool { + t.Helper() + if err != nil { + t.Error(err) + return false + } + return true +} diff --git a/tools/metadata/metadata.go b/tools/metadata/metadata.go new file mode 100644 index 00000000000..c60a1cfe215 --- /dev/null +++ b/tools/metadata/metadata.go @@ -0,0 +1,520 @@ +// Copyright 2023 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +import ( + "bytes" + "context" + "errors" + "fmt" + "go/ast" + "go/format" + "go/parser" + "go/printer" + "go/token" + "net/url" + "os" + "path" + "path/filepath" + "regexp" + "sort" + "strings" + "sync" + + "github.com/google/go-github/v56/github" + "gopkg.in/yaml.v3" +) + +type operation struct { + Name string `yaml:"name,omitempty" json:"name,omitempty"` + DocumentationURL string `yaml:"documentation_url,omitempty" json:"documentation_url,omitempty"` + OpenAPIFiles []string `yaml:"openapi_files,omitempty" json:"openapi_files,omitempty"` +} + +func (o *operation) equal(other *operation) bool { + if o.Name != other.Name || o.DocumentationURL != other.DocumentationURL { + return false + } + if len(o.OpenAPIFiles) != len(other.OpenAPIFiles) { + return false + } + for i := range o.OpenAPIFiles { + if o.OpenAPIFiles[i] != other.OpenAPIFiles[i] { + return false + } + } + return true +} + +func (o *operation) clone() *operation { + return &operation{ + Name: o.Name, + DocumentationURL: o.DocumentationURL, + OpenAPIFiles: append([]string{}, o.OpenAPIFiles...), + } +} + +func operationsEqual(a, b []*operation) bool { + if len(a) != len(b) { + return false + } + for i := range a { + if !a[i].equal(b[i]) { + return false + } + } + return true +} + +func sortOperations(ops []*operation) { + sort.Slice(ops, func(i, j int) bool { + leftVerb, leftURL := parseOpName(ops[i].Name) + rightVerb, rightURL := parseOpName(ops[j].Name) + if leftURL != rightURL { + return leftURL < rightURL + } + return leftVerb < rightVerb + }) +} + +// normalizeOpPath returns an endpoint with all templated path parameters replaced with *. +func normalizeOpPath(opPath string) string { + if !strings.ContainsAny(opPath, "{%") { + return opPath + } + segments := strings.Split(opPath, "/") + for i, segment := range segments { + if len(segment) == 0 { + continue + } + if segment[0] == '{' || segment[0] == '%' { + segments[i] = "*" + } + } + return strings.Join(segments, "/") +} + +func normalizedOpName(name string) string { + verb, u := parseOpName(name) + return strings.TrimSpace(verb + " " + normalizeOpPath(u)) +} + +// matches something like "GET /some/path" +var opNameRe = regexp.MustCompile(`(?i)(\S+)(?:\s+(\S.*))?`) + +func parseOpName(id string) (verb, url string) { + match := opNameRe.FindStringSubmatch(id) + if match == nil { + return "", "" + } + u := strings.TrimSpace(match[2]) + if !strings.HasPrefix(u, "/") { + u = "/" + u + } + return strings.ToUpper(match[1]), u +} + +type operationsFile struct { + ManualOps []*operation `yaml:"operations,omitempty"` + OverrideOps []*operation `yaml:"operation_overrides,omitempty"` + GitCommit string `yaml:"openapi_commit,omitempty"` + OpenapiOps []*operation `yaml:"openapi_operations,omitempty"` + + mu sync.Mutex + resolvedOps map[string]*operation +} + +func (m *operationsFile) resolve() { + m.mu.Lock() + defer m.mu.Unlock() + if m.resolvedOps != nil { + return + } + m.resolvedOps = map[string]*operation{} + for _, op := range m.OpenapiOps { + m.resolvedOps[op.Name] = op.clone() + } + for _, op := range m.ManualOps { + m.resolvedOps[op.Name] = op.clone() + } + for _, override := range m.OverrideOps { + _, ok := m.resolvedOps[override.Name] + if !ok { + continue + } + override = override.clone() + if override.DocumentationURL != "" { + m.resolvedOps[override.Name].DocumentationURL = override.DocumentationURL + } + if len(override.OpenAPIFiles) > 0 { + m.resolvedOps[override.Name].OpenAPIFiles = override.OpenAPIFiles + } + } +} + +func (m *operationsFile) saveFile(filename string) (errOut error) { + sortOperations(m.ManualOps) + sortOperations(m.OverrideOps) + sortOperations(m.OpenapiOps) + f, err := os.Create(filename) + if err != nil { + return err + } + defer func() { + e := f.Close() + if errOut == nil { + errOut = e + } + }() + enc := yaml.NewEncoder(f) + enc.SetIndent(2) + defer func() { + e := enc.Close() + if errOut == nil { + errOut = e + } + }() + return enc.Encode(m) +} + +func (m *operationsFile) updateFromGithub(ctx context.Context, client *github.Client, ref string) error { + commit, resp, err := client.Repositories.GetCommit(ctx, descriptionsOwnerName, descriptionsRepoName, ref, nil) + if err != nil { + return err + } + if resp.StatusCode != 200 { + return fmt.Errorf("unexpected status code: %s", resp.Status) + } + ops, err := getOpsFromGithub(ctx, client, ref) + if err != nil { + return err + } + if !operationsEqual(m.OpenapiOps, ops) { + m.OpenapiOps = ops + m.GitCommit = commit.GetSHA() + } + return nil +} + +func loadOperationsFile(filename string) (*operationsFile, error) { + b, err := os.ReadFile(filename) + if err != nil { + return nil, err + } + var opsFile operationsFile + err = yaml.Unmarshal(b, &opsFile) + if err != nil { + return nil, err + } + return &opsFile, nil +} + +func addOperation(ops []*operation, filename, opName, docURL string) []*operation { + for _, op := range ops { + if opName != op.Name { + continue + } + if len(op.OpenAPIFiles) == 0 { + op.OpenAPIFiles = append(op.OpenAPIFiles, filename) + op.DocumentationURL = docURL + return ops + } + // just append to files, but only add the first ghes file + if !strings.Contains(filename, "/ghes") { + op.OpenAPIFiles = append(op.OpenAPIFiles, filename) + return ops + } + for _, f := range op.OpenAPIFiles { + if strings.Contains(f, "/ghes") { + return ops + } + } + op.OpenAPIFiles = append(op.OpenAPIFiles, filename) + return ops + } + return append(ops, &operation{ + Name: opName, + OpenAPIFiles: []string{filename}, + DocumentationURL: docURL, + }) +} + +func unusedOps(opsFile *operationsFile, dir string) ([]*operation, error) { + var usedOps map[string]bool + err := visitServiceMethods(dir, false, func(_ string, fn *ast.FuncDecl, cmap ast.CommentMap) error { + ops, err := methodOps(opsFile, cmap, fn) + if err != nil { + return err + } + for _, op := range ops { + if usedOps == nil { + usedOps = map[string]bool{} + } + usedOps[op.Name] = true + } + return nil + }) + if err != nil { + return nil, err + } + var result []*operation + opsFile.resolve() + for opName, op := range opsFile.resolvedOps { + if !usedOps[opName] { + result = append(result, op) + } + } + sortOperations(result) + return result, nil +} + +func updateDocsVisitor(opsFile *operationsFile) nodeVisitor { + return func(serviceMethod string, fn *ast.FuncDecl, cmap ast.CommentMap) error { + linksMap := map[string]struct{}{} + undocMap := map[string]bool{} + + ops, err := methodOps(opsFile, cmap, fn) + if err != nil { + return err + } + if len(ops) == 0 { + return fmt.Errorf("no operations defined for %s", serviceMethod) + } + + for _, op := range ops { + if op.DocumentationURL == "" { + undocMap[op.Name] = true + continue + } + linksMap[op.DocumentationURL] = struct{}{} + } + var undocumentedOps []string + for op := range undocMap { + undocumentedOps = append(undocumentedOps, op) + } + sort.Strings(undocumentedOps) + + // Find the group that comes before the function + var group *ast.CommentGroup + for _, g := range cmap[fn] { + if g.End() == fn.Pos()-1 { + group = g + } + } + + // If there is no group, create one + if group == nil { + group = &ast.CommentGroup{ + List: []*ast.Comment{{Text: "//", Slash: fn.Pos() - 1}}, + } + cmap[fn] = append(cmap[fn], group) + } + + origList := group.List + group.List = nil + for _, comment := range origList { + if metaOpRe.MatchString(comment.Text) || + docLineRE.MatchString(comment.Text) || + undocRE.MatchString(comment.Text) { + continue + } + group.List = append(group.List, comment) + } + + // add an empty line before adding doc links + group.List = append(group.List, &ast.Comment{Text: "//"}) + + var docLinks []string + for link := range linksMap { + docLinks = append(docLinks, link) + } + sort.Strings(docLinks) + + for _, dl := range docLinks { + group.List = append( + group.List, + &ast.Comment{ + Text: "// GitHub API docs: " + cleanURLPath(dl), + }, + ) + } + _, methodName, _ := strings.Cut(serviceMethod, ".") + for _, opName := range undocumentedOps { + line := fmt.Sprintf("// Note: %s uses the undocumented GitHub API endpoint %q.", methodName, opName) + group.List = append(group.List, &ast.Comment{Text: line}) + } + for _, op := range ops { + group.List = append(group.List, &ast.Comment{ + Text: fmt.Sprintf("//meta:operation %s", op.Name), + }) + } + group.List[0].Slash = fn.Pos() - 1 + for i := 1; i < len(group.List); i++ { + group.List[i].Slash = token.NoPos + } + return nil + } +} + +// updateDocs updates the code comments in dir with doc urls from metadata. +func updateDocs(opsFile *operationsFile, dir string) error { + return visitServiceMethods(dir, true, updateDocsVisitor(opsFile)) +} + +type nodeVisitor func(serviceMethod string, fn *ast.FuncDecl, cmap ast.CommentMap) error + +// visitServiceMethods runs visit on the ast.Node of every service method in dir. When writeFiles is true it will +// save any changes back to the original file. +func visitServiceMethods(dir string, writeFiles bool, visit nodeVisitor) error { + dirEntries, err := os.ReadDir(dir) + if err != nil { + return err + } + for _, dirEntry := range dirEntries { + filename := filepath.Join(dir, dirEntry.Name()) + if dirEntry.IsDir() || + !strings.HasSuffix(filename, ".go") || + strings.HasSuffix(filename, "_test.go") { + continue + } + err = errors.Join(err, visitFileMethods(writeFiles, filename, visit)) + } + return err +} + +func visitFileMethods(updateFile bool, filename string, visit nodeVisitor) error { + content, err := os.ReadFile(filename) + if err != nil { + return err + } + content = bytes.ReplaceAll(content, []byte("\r\n"), []byte("\n")) + + fset := token.NewFileSet() + fileNode, err := parser.ParseFile(fset, "", content, parser.ParseComments) + if err != nil { + return err + } + cmap := ast.NewCommentMap(fset, fileNode, fileNode.Comments) + + ast.Inspect(fileNode, func(n ast.Node) bool { + fn, ok := n.(*ast.FuncDecl) + if !ok { + return true + } + serviceMethod := nodeServiceMethod(fn) + if serviceMethod == "" { + return true + } + e := visit(serviceMethod, fn, cmap) + err = errors.Join(err, e) + return true + }) + if err != nil { + return err + } + if !updateFile { + return nil + } + fileNode.Comments = cmap.Filter(fileNode).Comments() + var buf bytes.Buffer + err = printer.Fprint(&buf, fset, fileNode) + if err != nil { + return err + } + updatedContent, err := format.Source(buf.Bytes()) + if err != nil { + return err + } + if bytes.Equal(content, updatedContent) { + return nil + } + return os.WriteFile(filename, updatedContent, 0600) +} + +var ( + metaOpRe = regexp.MustCompile(`(?i)\s*//\s*meta:operation\s+(\S.+)`) + undocRE = regexp.MustCompile(`(?i)\s*//\s*Note:\s+\S.+ uses the undocumented GitHub API endpoint`) + docLineRE = regexp.MustCompile(`(?i)\s*//\s*GitHub\s+API\s+docs:`) +) + +// methodOps parses a method's comments for //meta:operation lines and returns the corresponding operations. +func methodOps(opsFile *operationsFile, cmap ast.CommentMap, fn *ast.FuncDecl) ([]*operation, error) { + var ops []*operation + var err error + seen := map[string]bool{} + for _, g := range cmap[fn] { + for _, c := range g.List { + match := metaOpRe.FindStringSubmatch(c.Text) + if match == nil { + continue + } + opName := strings.TrimSpace(match[1]) + opsFile.resolve() + var found []*operation + norm := normalizedOpName(opName) + for n := range opsFile.resolvedOps { + if normalizedOpName(n) == norm { + found = append(found, opsFile.resolvedOps[n]) + } + } + switch len(found) { + case 0: + err = errors.Join(err, fmt.Errorf("could not find operation %q in openapi_operations.yaml", opName)) + case 1: + name := found[0].Name + if seen[name] { + err = errors.Join(err, fmt.Errorf("duplicate operation: %s", name)) + } + seen[name] = true + ops = append(ops, found[0]) + default: + var foundNames []string + for _, op := range found { + foundNames = append(foundNames, op.Name) + } + sort.Strings(foundNames) + err = errors.Join(err, fmt.Errorf("ambiguous operation %q could match any of: %v", opName, foundNames)) + } + } + } + sortOperations(ops) + return ops, err +} + +// cleanURLPath runs path.Clean on the url path. This is to remove the unsightly double slashes from some +// of the urls in github's openapi descriptions. +func cleanURLPath(docURL string) string { + u, err := url.Parse(docURL) + if err != nil { + return docURL + } + u.Path = path.Clean(u.Path) + return u.String() +} + +// nodeServiceMethod returns the name of the service method represented by fn, or "" if fn is not a service method. +// Name is in the form of "Receiver.Function", for example "IssuesService.Create". +func nodeServiceMethod(fn *ast.FuncDecl) string { + if fn.Recv == nil || len(fn.Recv.List) != 1 { + return "" + } + recv := fn.Recv.List[0] + se, ok := recv.Type.(*ast.StarExpr) + if !ok { + return "" + } + id, ok := se.X.(*ast.Ident) + if !ok { + return "" + } + + // We only want exported methods on exported types where the type name ends in "Service". + if !id.IsExported() || !fn.Name.IsExported() || !strings.HasSuffix(id.Name, "Service") { + return "" + } + + return id.Name + "." + fn.Name.Name +} diff --git a/tools/metadata/metadata_test.go b/tools/metadata/metadata_test.go new file mode 100644 index 00000000000..c3ad0a788f9 --- /dev/null +++ b/tools/metadata/metadata_test.go @@ -0,0 +1,28 @@ +// Copyright 2023 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +import ( + "testing" +) + +func Test_normalizedOpName(t *testing.T) { + for _, td := range []struct { + name string + want string + }{ + {name: "", want: ""}, + {name: "get /foo/{id}", want: "GET /foo/*"}, + {name: "get foo", want: "GET /foo"}, + } { + t.Run(td.name, func(t *testing.T) { + got := normalizedOpName(td.name) + if got != td.want { + t.Errorf("normalizedOpName() = %v, want %v", got, td.want) + } + }) + } +} diff --git a/tools/metadata/openapi.go b/tools/metadata/openapi.go new file mode 100644 index 00000000000..4b858481f5e --- /dev/null +++ b/tools/metadata/openapi.go @@ -0,0 +1,172 @@ +// Copyright 2023 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +import ( + "context" + "fmt" + "io" + "regexp" + "sort" + "strconv" + + "github.com/getkin/kin-openapi/openapi3" + "github.com/google/go-github/v56/github" + "golang.org/x/sync/errgroup" +) + +const ( + descriptionsOwnerName = "github" + descriptionsRepoName = "rest-api-description" + descriptionsPath = "descriptions" +) + +type openapiFile struct { + description *openapi3.T + filename string + plan string + planIdx int + releaseMajor int + releaseMinor int +} + +func getOpsFromGithub(ctx context.Context, client *github.Client, gitRef string) ([]*operation, error) { + descs, err := getDescriptions(ctx, client, gitRef) + if err != nil { + return nil, err + } + var ops []*operation + for _, desc := range descs { + for p, pathItem := range desc.description.Paths { + for method, op := range pathItem.Operations() { + docURL := "" + if op.ExternalDocs != nil { + docURL = op.ExternalDocs.URL + } + ops = addOperation(ops, desc.filename, method+" "+p, docURL) + } + } + } + sortOperations(ops) + return ops, nil +} + +func (o *openapiFile) loadDescription(ctx context.Context, client *github.Client, gitRef string) error { + contents, resp, err := client.Repositories.DownloadContents( + ctx, + descriptionsOwnerName, + descriptionsRepoName, + o.filename, + &github.RepositoryContentGetOptions{Ref: gitRef}, + ) + if err != nil { + return err + } + if resp.StatusCode != 200 { + return fmt.Errorf("unexpected status code: %s", resp.Status) + } + b, err := io.ReadAll(contents) + if err != nil { + return err + } + err = contents.Close() + if err != nil { + return err + } + o.description, err = openapi3.NewLoader().LoadFromData(b) + return err +} + +// less sorts by the following rules: +// - planIdx ascending +// - releaseMajor descending +// - releaseMinor descending +func (o *openapiFile) less(other *openapiFile) bool { + if o.planIdx != other.planIdx { + return o.planIdx < other.planIdx + } + if o.releaseMajor != other.releaseMajor { + return o.releaseMajor > other.releaseMajor + } + return o.releaseMinor > other.releaseMinor +} + +var dirPatterns = []*regexp.Regexp{ + regexp.MustCompile(`^(?Papi\.github\.com)(-(?P\d+)\.(?P\d+))?$`), + regexp.MustCompile(`^(?Pghec)(-(?P\d+)\.(?P\d+))?$`), + regexp.MustCompile(`^(?Pghes)(-(?P\d+)\.(?P\d+))?$`), +} + +// getDescriptions loads OpenapiFiles for all the OpenAPI 3.0 description files in github/rest-api-description. +// This assumes that all directories in "descriptions/" contain OpenAPI 3.0 description files with the same +// name as the directory (plus the ".json" extension). For example, "descriptions/api.github.com/api.github.com.json". +// Results are sorted by these rules: +// - Directories that don't match any of the patterns in dirPatterns are removed. +// - Directories are sorted by the pattern that matched in the same order they appear in dirPatterns. +// - Directories are then sorted by major and minor version in descending order. +func getDescriptions(ctx context.Context, client *github.Client, gitRef string) ([]*openapiFile, error) { + _, dir, resp, err := client.Repositories.GetContents( + ctx, + descriptionsOwnerName, + descriptionsRepoName, + descriptionsPath, + &github.RepositoryContentGetOptions{Ref: gitRef}, + ) + if err != nil { + return nil, err + } + if resp.StatusCode != 200 { + return nil, fmt.Errorf("unexpected status code: %s", resp.Status) + } + files := make([]*openapiFile, 0, len(dir)) + for _, d := range dir { + for i, pattern := range dirPatterns { + m := pattern.FindStringSubmatch(d.GetName()) + if m == nil { + continue + } + file := openapiFile{ + filename: fmt.Sprintf("descriptions/%s/%s.json", d.GetName(), d.GetName()), + plan: m[pattern.SubexpIndex("plan")], + planIdx: i, + } + rawMajor := m[pattern.SubexpIndex("major")] + if rawMajor != "" { + file.releaseMajor, err = strconv.Atoi(rawMajor) + if err != nil { + return nil, err + } + } + rawMinor := m[pattern.SubexpIndex("minor")] + if rawMinor != "" { + file.releaseMinor, err = strconv.Atoi(rawMinor) + if err != nil { + return nil, err + } + } + if file.plan == "ghes" && file.releaseMajor < 3 { + continue + } + files = append(files, &file) + break + } + } + sort.Slice(files, func(i, j int) bool { + return files[i].less(files[j]) + }) + g, ctx := errgroup.WithContext(ctx) + for _, file := range files { + f := file + g.Go(func() error { + return f.loadDescription(ctx, client, gitRef) + }) + } + err = g.Wait() + if err != nil { + return nil, err + } + return files, nil +} diff --git a/tools/metadata/testdata/format/openapi_operations.yaml b/tools/metadata/testdata/format/openapi_operations.yaml new file mode 100644 index 00000000000..abaafeb9aa8 --- /dev/null +++ b/tools/metadata/testdata/format/openapi_operations.yaml @@ -0,0 +1,16 @@ + +operations: + - name: POST /a/{a_id} + documentation_url: https://docs.github.com/rest/a/a#update-a +openapi_operations: + - name: GET /a/{a_id} + documentation_url: https://docs.github.com/rest/a/a#get-a + - name: GET /undocumented/{undocumented_id} + +operation_overrides: + - name: GET /a/{a_id_noncanonical2} # this comment will disappear + documentation_url: https://docs.github.com/rest/a/a#overridden-get-a + - name: GET /fake/{a_id} + documentation_url: https://docs.github.com/rest/a/a#overridden-get-a + +openapi_commit: b8dafbe912a3be421d21346faa2b29bf15e6f84d diff --git a/tools/metadata/testdata/golden/TestFormat/openapi_operations.yaml b/tools/metadata/testdata/golden/TestFormat/openapi_operations.yaml new file mode 100644 index 00000000000..524d56817fb --- /dev/null +++ b/tools/metadata/testdata/golden/TestFormat/openapi_operations.yaml @@ -0,0 +1,13 @@ +operations: + - name: POST /a/{a_id} + documentation_url: https://docs.github.com/rest/a/a#update-a +operation_overrides: + - name: GET /a/{a_id_noncanonical2} + documentation_url: https://docs.github.com/rest/a/a#overridden-get-a + - name: GET /fake/{a_id} + documentation_url: https://docs.github.com/rest/a/a#overridden-get-a +openapi_commit: b8dafbe912a3be421d21346faa2b29bf15e6f84d +openapi_operations: + - name: GET /a/{a_id} + documentation_url: https://docs.github.com/rest/a/a#get-a + - name: GET /undocumented/{undocumented_id} diff --git a/tools/metadata/testdata/golden/TestUpdateGo/valid/github/a.go b/tools/metadata/testdata/golden/TestUpdateGo/valid/github/a.go new file mode 100644 index 00000000000..571c1eb2da9 --- /dev/null +++ b/tools/metadata/testdata/golden/TestUpdateGo/valid/github/a.go @@ -0,0 +1,37 @@ +package github + +type AService struct{} + +// Get gets an A +// +// GitHub API docs: https://docs.github.com/rest/a/a#overridden-get-a +// +//meta:operation GET /a/{a_id} +func (s *AService) Get() {} + +// Undocumented uses an undocumented operation +// +// Note: Undocumented uses the undocumented GitHub API endpoint "GET /undocumented/{undocumented_id}". +// +//meta:operation GET /undocumented/{undocumented_id} +func (s *AService) Undocumented() {} + +// OutdatedLinks has links that are outdated or wrong +// +// GitHub API docs: https://docs.github.com/rest/a/a#update-a +// +//meta:operation POST /a/{a_id} +func (s *AService) OutdatedLinks() {} + +// GitHub API docs: https://docs.github.com/rest/a/a#overridden-get-a +// +//meta:operation GET /a/{a_id} +func (s *AService) Uncommented() {} + +func (s *AService) unexported() {} + +func NotAMethod() {} + +type internalService struct{} + +func (i *internalService) Get() {} diff --git a/tools/metadata/testdata/golden/TestUpdateOpenAPI/openapi_operations.yaml b/tools/metadata/testdata/golden/TestUpdateOpenAPI/openapi_operations.yaml new file mode 100644 index 00000000000..c1e3cf4cbd6 --- /dev/null +++ b/tools/metadata/testdata/golden/TestUpdateOpenAPI/openapi_operations.yaml @@ -0,0 +1,14 @@ +operations: + - name: GET /a/{a_id} + documentation_url: https://docs.github.com/rest/a/a#get-a +openapi_commit: s +openapi_operations: + - name: GET /a/b/{a_id} + documentation_url: https://docs.github.com/rest/reference/a + openapi_files: + - descriptions/ghec/ghec.json + - descriptions/ghes-3.10/ghes-3.10.json + - name: GET /a/{a_id} + documentation_url: https://docs.github.com/rest/reference/a + openapi_files: + - descriptions/api.github.com/api.github.com.json diff --git a/tools/metadata/testdata/unused/github/a.go b/tools/metadata/testdata/unused/github/a.go new file mode 100644 index 00000000000..0169531b2b6 --- /dev/null +++ b/tools/metadata/testdata/unused/github/a.go @@ -0,0 +1,8 @@ +package github + +type AService struct{} + +// PostABC +// +//meta:operation POST /a/b/c/{a_id} +func (a *AService) PostABC() {} diff --git a/tools/metadata/testdata/unused/openapi_operations.yaml b/tools/metadata/testdata/unused/openapi_operations.yaml new file mode 100644 index 00000000000..c5c3772b1f3 --- /dev/null +++ b/tools/metadata/testdata/unused/openapi_operations.yaml @@ -0,0 +1,15 @@ +openapi_commit: b8dafbe912a3be421d21346faa2b29bf15e6f84d +operations: + - name: POST /a/{a_id} + documentation_url: https://docs.github.com/rest/a/a#update-a +openapi_operations: + - name: POST /a/b/c/{a_id} + documentation_url: https://docs.github.com/rest/a/b/c#update-a + - name: GET /a/{a_id} + documentation_url: https://docs.github.com/rest/a/a#get-a + - name: GET /undocumented/{undocumented_id} +operation_overrides: + - name: GET /a/{a_id} + documentation_url: https://docs.github.com/rest/a/a#overridden-get-a + - name: GET /fake/{a_id} + documentation_url: https://docs.github.com/rest/a/a#overridden-get-a diff --git a/tools/metadata/testdata/update-go/invalid/github/a.go b/tools/metadata/testdata/update-go/invalid/github/a.go new file mode 100644 index 00000000000..ceef5fb5963 --- /dev/null +++ b/tools/metadata/testdata/update-go/invalid/github/a.go @@ -0,0 +1,24 @@ +package github + +type AService struct{} + +// NoOperation has no operation +func (*AService) NoOperation() {} + +func (*AService) NoComment() {} + +// Ambiguous has an operation that could resolve to multiple operations +// +//meta:operation GET /ambiguous/{} +func (*AService) Ambiguous() {} + +// MissingOperation has an operation that is missing from the OpenAPI spec +// +//meta:operation GET /missing/{id} +func (*AService) MissingOperation() {} + +// DuplicateOperations has duplicate operations +//meta:operation GET /a/{a_id} +//meta:operation POST /a/{a_id} +//meta:operation GET /a/{a_id} +func (*AService) DuplicateOperations() {} diff --git a/tools/metadata/testdata/update-go/invalid/openapi_operations.yaml b/tools/metadata/testdata/update-go/invalid/openapi_operations.yaml new file mode 100644 index 00000000000..07b0c3e5013 --- /dev/null +++ b/tools/metadata/testdata/update-go/invalid/openapi_operations.yaml @@ -0,0 +1,16 @@ +operations: + - name: POST /a/{a_id} + documentation_url: https://docs.github.com/rest/a/a#update-a +openapi_operations: + - name: GET /ambiguous/{id} + documentation_url: https://docs.github.com/rest/ambiguous/ + - name: GET /ambiguous/{name} + documentation_url: https://docs.github.com/rest/ambiguous/ + - name: GET /undocumented/{undocumented_id} + - name: GET /a/{a_id} + documentation_url: https://docs.github.com/rest/a/a#get-a +operation_overrides: + - name: GET /a/{a_id} + documentation_url: https://docs.github.com/rest/a/a#overridden-get-a + - name: GET /fake/{a_id} + documentation_url: https://docs.github.com/rest/a/a#overridden-get-a diff --git a/tools/metadata/testdata/update-go/valid/github/a.go b/tools/metadata/testdata/update-go/valid/github/a.go new file mode 100644 index 00000000000..7885efd8c79 --- /dev/null +++ b/tools/metadata/testdata/update-go/valid/github/a.go @@ -0,0 +1,31 @@ +package github + +type AService struct{} + +// Get gets an A +//meta:operation GET /a/{non-canonical-id} +func (s *AService) Get() {} + +// Undocumented uses an undocumented operation +//meta:operation GET /undocumented/{undocumented_id} +func (s *AService) Undocumented() {} + +// OutdatedLinks has links that are outdated or wrong +// +// GitHub API docs: https://docs.github.com/rest/a/a#get-a +// GitHub API docs: https://example.com +// Note: Undocumented uses the undocumented GitHub API endpoint "GET /undocumented/{undocumented_id}". +// +//meta:operation post a/{a_id} +func (s *AService) OutdatedLinks() {} + +//meta:operation GET /a/{a_id} +func (s *AService) Uncommented() {} + +func (s *AService) unexported() {} + +func NotAMethod() {} + +type internalService struct{} + +func (i *internalService) Get() {} diff --git a/tools/metadata/testdata/update-go/valid/github/ignoreme.txt b/tools/metadata/testdata/update-go/valid/github/ignoreme.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tools/metadata/testdata/update-go/valid/openapi_operations.yaml b/tools/metadata/testdata/update-go/valid/openapi_operations.yaml new file mode 100644 index 00000000000..ed401c0d283 --- /dev/null +++ b/tools/metadata/testdata/update-go/valid/openapi_operations.yaml @@ -0,0 +1,13 @@ +openapi_commit: b8dafbe912a3be421d21346faa2b29bf15e6f84d +operations: + - name: POST /a/{a_id} + documentation_url: https://docs.github.com/rest/a/a#update-a +openapi_operations: + - name: GET /a/{a_id} + documentation_url: https://docs.github.com/rest/a/a#get-a + - name: GET /undocumented/{undocumented_id} +operation_overrides: + - name: GET /a/{a_id} + documentation_url: https://docs.github.com/rest/a/a#overridden-get-a + - name: GET /fake/{a_id} + documentation_url: https://docs.github.com/rest/a/a#overridden-get-a diff --git a/tools/metadata/testdata/update-openapi/openapi_operations.yaml b/tools/metadata/testdata/update-openapi/openapi_operations.yaml new file mode 100644 index 00000000000..1577e739ab6 --- /dev/null +++ b/tools/metadata/testdata/update-openapi/openapi_operations.yaml @@ -0,0 +1,4 @@ +operations: + - name: GET /a/{a_id} + documentation_url: https://docs.github.com/rest/a/a#get-a +openapi_commit: s diff --git a/update-urls/activity-events_test.go b/update-urls/activity-events_test.go deleted file mode 100644 index 10dce865b29..00000000000 --- a/update-urls/activity-events_test.go +++ /dev/null @@ -1,190 +0,0 @@ -// Copyright 2020 The go-github AUTHORS. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - _ "embed" - "strings" - "testing" -) - -func newActivitiesEventsPipeline() *pipelineSetup { - return &pipelineSetup{ - baseURL: "https://docs.github.com/en/rest/activity/events/", - endpointsFromWebsite: activityEventsWant, - filename: "activity_events.go", - serviceName: "ActivityService", - originalGoSource: strings.ReplaceAll(activityEventsGoFileOriginal, "\r", ""), - wantGoSource: strings.ReplaceAll(activityEventsGoFileWant, "\r", ""), - wantNumEndpoints: 7, - } -} - -func TestPipeline_ActivityEvents(t *testing.T) { - ps := newActivitiesEventsPipeline() - ps.setup(t, false, false) - ps.validate(t) -} - -func TestPipeline_ActivityEvents_FirstStripAllURLs(t *testing.T) { - ps := newActivitiesEventsPipeline() - ps.setup(t, true, false) - ps.validate(t) -} - -func TestPipeline_ActivityEvents_FirstDestroyReceivers(t *testing.T) { - ps := newActivitiesEventsPipeline() - ps.setup(t, false, true) - ps.validate(t) -} - -func TestPipeline_ActivityEvents_FirstStripAllURLsAndDestroyReceivers(t *testing.T) { - ps := newActivitiesEventsPipeline() - ps.setup(t, true, true) - ps.validate(t) -} - -func TestParseWebPageEndpoints_ActivityEvents(t *testing.T) { - got := parseWebPageEndpoints(activityEventsTestWebPage) - testWebPageHelper(t, got, activityEventsWant) -} - -var activityEventsWant = endpointsByFragmentID{ - "list-public-events": []*Endpoint{ - {urlFormats: []string{"events"}, httpMethod: "GET"}, - }, - - "list-repository-events": []*Endpoint{ - {urlFormats: []string{"repos/%v/%v/events"}, httpMethod: "GET"}, - }, - - "list-public-events-for-a-network-of-repositories": []*Endpoint{ - {urlFormats: []string{"networks/%v/%v/events"}, httpMethod: "GET"}, - }, - - "list-events-received-by-the-authenticated-user": []*Endpoint{ - {urlFormats: []string{"users/%v/received_events"}, httpMethod: "GET"}, - }, - - "list-events-for-the-authenticated-user": []*Endpoint{ - {urlFormats: []string{"users/%v/events"}, httpMethod: "GET"}, - }, - - "list-public-events-for-a-user": []*Endpoint{ - {urlFormats: []string{"users/%v/events/public"}, httpMethod: "GET"}, - }, - - "list-organization-events-for-the-authenticated-user": []*Endpoint{ - {urlFormats: []string{"users/%v/events/orgs/%v"}, httpMethod: "GET"}, - }, - - "list-public-organization-events": []*Endpoint{ - {urlFormats: []string{"orgs/%v/events"}, httpMethod: "GET"}, - }, - - "list-public-events-received-by-a-user": []*Endpoint{ - {urlFormats: []string{"users/%v/received_events/public"}, httpMethod: "GET"}, - }, - - // Updated docs - consolidated into single page. - - "delete-a-thread-subscription": []*Endpoint{ - {urlFormats: []string{"notifications/threads/%v/subscription"}, httpMethod: "DELETE"}, - }, - - "mark-notifications-as-read": []*Endpoint{ - {urlFormats: []string{"notifications"}, httpMethod: "PUT"}, - }, - - "set-a-thread-subscription": []*Endpoint{ - {urlFormats: []string{"notifications/threads/%v/subscription"}, httpMethod: "PUT"}, - }, - - "delete-a-repository-subscription": []*Endpoint{ - {urlFormats: []string{"repos/%v/%v/subscription"}, httpMethod: "DELETE"}, - }, - - "star-a-repository-for-the-authenticated-user": []*Endpoint{ - {urlFormats: []string{"user/starred/%v/%v"}, httpMethod: "PUT"}, - }, - - "list-repositories-starred-by-the-authenticated-user": []*Endpoint{ - {urlFormats: []string{"user/starred"}, httpMethod: "GET"}, - }, - - "list-watchers": []*Endpoint{ - {urlFormats: []string{"repos/%v/%v/subscribers"}, httpMethod: "GET"}, - }, - - "get-feeds": []*Endpoint{ - {urlFormats: []string{"feeds"}, httpMethod: "GET"}, - }, - - "get-a-thread": []*Endpoint{ - {urlFormats: []string{"notifications/threads/%v"}, httpMethod: "GET"}, - }, - - "mark-a-thread-as-read": []*Endpoint{ - {urlFormats: []string{"notifications/threads/%v"}, httpMethod: "PATCH"}, - }, - - "list-stargazers": []*Endpoint{ - {urlFormats: []string{"repos/%v/%v/stargazers"}, httpMethod: "GET"}, - }, - - "list-repositories-watched-by-a-user": []*Endpoint{ - {urlFormats: []string{"users/%v/subscriptions"}, httpMethod: "GET"}, - }, - - "list-repository-notifications-for-the-authenticated-user": []*Endpoint{ - {urlFormats: []string{"repos/%v/%v/notifications"}, httpMethod: "GET"}, - }, - - "mark-repository-notifications-as-read": []*Endpoint{ - {urlFormats: []string{"repos/%v/%v/notifications"}, httpMethod: "PUT"}, - }, - - "check-if-a-repository-is-starred-by-the-authenticated-user": []*Endpoint{ - {urlFormats: []string{"user/starred/%v/%v"}, httpMethod: "GET"}, - }, - - "list-notifications-for-the-authenticated-user": []*Endpoint{ - {urlFormats: []string{"notifications"}, httpMethod: "GET"}, - }, - - "get-a-thread-subscription-for-the-authenticated-user": []*Endpoint{ - {urlFormats: []string{"notifications/threads/%v/subscription"}, httpMethod: "GET"}, - }, - - "unstar-a-repository-for-the-authenticated-user": []*Endpoint{ - {urlFormats: []string{"user/starred/%v/%v"}, httpMethod: "DELETE"}, - }, - - "list-repositories-watched-by-the-authenticated-user": []*Endpoint{ - {urlFormats: []string{"user/subscriptions"}, httpMethod: "GET"}, - }, - - "get-a-repository-subscription": []*Endpoint{ - {urlFormats: []string{"repos/%v/%v/subscription"}, httpMethod: "GET"}, - }, - - "set-a-repository-subscription": []*Endpoint{ - {urlFormats: []string{"repos/%v/%v/subscription"}, httpMethod: "PUT"}, - }, - - "list-repositories-starred-by-a-user": []*Endpoint{ - {urlFormats: []string{"users/%v/starred"}, httpMethod: "GET"}, - }, -} - -//go:embed testdata/activity-events.html -var activityEventsTestWebPage string - -//go:embed testdata/activity_events-original.go -var activityEventsGoFileOriginal string - -//go:embed testdata/activity_events-want.go -var activityEventsGoFileWant string diff --git a/update-urls/go.mod b/update-urls/go.mod deleted file mode 100644 index 81d9a3a5848..00000000000 --- a/update-urls/go.mod +++ /dev/null @@ -1,8 +0,0 @@ -module github.com/google/go-github/v56/update-urls - -go 1.16 - -require ( - github.com/google/go-cmp v0.6.0 - github.com/pmezard/go-difflib v1.0.0 -) diff --git a/update-urls/go.sum b/update-urls/go.sum deleted file mode 100644 index ddc1bfa1ce9..00000000000 --- a/update-urls/go.sum +++ /dev/null @@ -1,4 +0,0 @@ -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= diff --git a/update-urls/main.go b/update-urls/main.go deleted file mode 100644 index 77938be6de7..00000000000 --- a/update-urls/main.go +++ /dev/null @@ -1,1352 +0,0 @@ -// Copyright 2020 The go-github AUTHORS. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// update-urls updates GitHub URL docs for each service endpoint. -// -// It is meant to be used periodically by go-github repo maintainers -// to update stale GitHub Developer v3 API documentation URLs. -// -// Usage (from go-github directory): -// -// go run ./update-urls/main.go -// go generate ./... -// go test ./... -// go vet ./... -// -// When confronted with "PLEASE CHECK MANUALLY AND FIX", the problematic -// URL needs to be debugged. To debug a specific file, run like this: -// -// go run ./update-urls/main.go -v -d enterprise_actions_runners.go -package main - -import ( - "errors" - "flag" - "fmt" - "go/ast" - "go/parser" - "go/token" - "io" - "log" - "net/http" - "os" - "regexp" - "sort" - "strings" - "time" - - "github.com/google/go-cmp/cmp" -) - -const ( - codeLegacySplitString = `` - codeSplitString = `await octokit.request('` - skipPrefix = "gen-" - - // enterpriseURL = "docs.github.com" - stdURL = "docs.github.com" - - enterpriseRefFmt = "// GitHub Enterprise API docs: %v" - stdRefFmt = "// GitHub API docs: %v" - - httpGetDelay = 1 * time.Second -) - -var ( - verbose = flag.Bool("v", false, "Print verbose log messages") - debugFile = flag.String("d", "", "Debug named file only") - - fragmentIDStringRE = regexp.MustCompile(`

]*id="`) - stripHTMLRE = regexp.MustCompile(`<\/?[^>]+\/?>`) - condenseWhitespaceRE = regexp.MustCompile(`\s+`) - - // skipMethods holds methods which are skipped because they do not have GitHub v3 - // API URLs or are otherwise problematic in parsing, discovering, and/or fixing. - skipMethods = map[string]bool{ - "ActionsService.DownloadArtifact": true, - "AdminService.CreateOrg": true, - "AdminService.CreateUser": true, - "AdminService.CreateUserImpersonation": true, - "AdminService.DeleteUserImpersonation": true, - "AdminService.GetAdminStats": true, - "AdminService.RenameOrg": true, - "AdminService.RenameOrgByName": true, - "AdminService.UpdateTeamLDAPMapping": true, - "AdminService.UpdateUserLDAPMapping": true, - "AppsService.CreateAttachment": true, - "AppsService.FindRepositoryInstallationByID": true, - "AuthorizationsService.CreateImpersonation": true, - "AuthorizationsService.DeleteImpersonation": true, - "IssueImportService.CheckStatus": true, - "IssueImportService.CheckStatusSince": true, - "IssueImportService.Create": true, - "MarketplaceService.marketplaceURI": true, - "MigrationService.UserMigrationArchiveURL": true, - "OrganizationsService.GetByID": true, - "RepositoriesService.CompareCommits": true, - "RepositoriesService.CompareCommitsRaw": true, - "RepositoriesService.DeletePreReceiveHook": true, - "RepositoriesService.DownloadContents": true, - "RepositoriesService.DownloadContentsWithMeta": true, - "RepositoriesService.GetArchiveLink": true, - "RepositoriesService.GetByID": true, - "RepositoriesService.GetPreReceiveHook": true, - "RepositoriesService.ListPreReceiveHooks": true, - "RepositoriesService.UpdatePreReceiveHook": true, - "SearchService.search": true, - "TeamsService.ListTeamMembersByID": true, - "UsersService.DemoteSiteAdmin": true, - "UsersService.GetByID": true, - "UsersService.PromoteSiteAdmin": true, - "UsersService.Suspend": true, - "UsersService.Unsuspend": true, - } - - helperOverrides = map[string]overrideFunc{ - "s.search": func(arg string) (httpMethod, url string) { - return "GET", fmt.Sprintf("search/%v", arg) - }, - } - - // methodOverrides contains overrides for troublesome endpoints. - methodOverrides = map[string]string{ - "OrganizationsService.EditOrgMembership: method orgs/%v/memberships/%v": "PUT", - "OrganizationsService.EditOrgMembership: PUT user/memberships/orgs/%v": "PATCH", - } - - paramLegacyRE = regexp.MustCompile(`:[a-z_]+`) - paramRE = regexp.MustCompile(`{[a-z_]+}`) -) - -type overrideFunc func(arg string) (httpMethod, url string) - -func logf(fmt string, args ...interface{}) { - if *verbose { - log.Printf(fmt, args...) - } -} - -type servicesMap map[string]*Service -type endpointsMap map[string]*Endpoint - -func main() { - flag.Parse() - fset := token.NewFileSet() - - sourceFilter := func(fi os.FileInfo) bool { - return !strings.HasSuffix(fi.Name(), "_test.go") && !strings.HasPrefix(fi.Name(), skipPrefix) - } - - if err := os.Chdir("./github"); err != nil { - if err := os.Chdir("../github"); err != nil { - log.Fatalf("Please run this from the go-github directory.") - } - } - - pkgs, err := parser.ParseDir(fset, ".", sourceFilter, parser.ParseComments) - if err != nil { - log.Fatal(err) - } - - // Step 1 - get a map of all services. - services := findAllServices(pkgs) - - // Step 2 - find all the API service endpoints. - iter := &realAstFileIterator{fset: fset, pkgs: pkgs} - endpoints, err := findAllServiceEndpoints(iter, services) - if err != nil { - log.Fatalf("\n%v", err) - } - - // Step 3 - resolve all missing httpMethods from helperMethods. - // Additionally, use existing URLs as hints to pre-cache all apiDocs. - docCache := &documentCache{positioner: iter} - usedHelpers, endpointsByFilename := resolveHelpersAndCacheDocs(endpoints, docCache) - - // Step 4 - validate and rewrite all URLs, skipping used helper methods. - frw := &liveFileRewriter{fset: fset} - validateRewriteURLs(usedHelpers, endpointsByFilename, docCache, frw) - - logf("Done.") -} - -type usedHelpersMap map[string]bool -type endpointsByFilenameMap map[string][]*Endpoint - -// FileRewriter read/writes files and converts AST token positions. -type FileRewriter interface { - Position(token.Pos) token.Position - ReadFile(filename string) ([]byte, error) - WriteFile(filename string, buf []byte, mode os.FileMode) error -} - -// liveFileRewriter implements FileRewriter. -type liveFileRewriter struct { - fset *token.FileSet -} - -func (lfr *liveFileRewriter) Position(pos token.Pos) token.Position { return lfr.fset.Position(pos) } -func (lfr *liveFileRewriter) ReadFile(filename string) ([]byte, error) { - return os.ReadFile(filename) -} -func (lfr *liveFileRewriter) WriteFile(filename string, buf []byte, mode os.FileMode) error { - return os.WriteFile(filename, buf, mode) -} - -func validateRewriteURLs(usedHelpers usedHelpersMap, endpointsByFilename endpointsByFilenameMap, docCache documentCacheReader, fileRewriter FileRewriter) { - for filename, slc := range endpointsByFilename { - logf("Step 4 - Processing %v methods in %v ...", len(slc), filename) - - var fileEdits []*FileEdit - for _, endpoint := range slc { - fullName := fmt.Sprintf("%v.%v", endpoint.serviceName, endpoint.endpointName) - if usedHelpers[fullName] { - logf("Step 4 - skipping used helper method %q", fullName) - continue - } - - // First, find the correct GitHub v3 API URL by httpMethod and urlFormat. - for _, path := range endpoint.urlFormats { - path = strings.ReplaceAll(path, "%d", "%v") - path = strings.ReplaceAll(path, "%s", "%v") - - // Check the overrides. - endpoint.checkHTTPMethodOverride(path) - - methodAndPath := fmt.Sprintf("%v %v", endpoint.httpMethod, path) - url, ok := docCache.URLByMethodAndPath(methodAndPath) - if !ok { - if i := len(endpoint.endpointComments); i > 0 { - pos := fileRewriter.Position(endpoint.endpointComments[i-1].Pos()) - fmt.Printf("%v:%v:%v: WARNING: unable to find online docs for %q: (%v)\nPLEASE CHECK MANUALLY AND FIX.\n", pos.Filename, pos.Line, pos.Column, fullName, methodAndPath) - } else { - fmt.Printf("%v: WARNING: unable to find online docs for %q: (%v)\nPLEASE CHECK MANUALLY AND FIX.\n", filename, fullName, methodAndPath) - } - continue - } - logf("found %q for: %q (%v)", url, fullName, methodAndPath) - - // Make sure URL is up-to-date. - switch { - case len(endpoint.enterpriseRefLines) > 1: - log.Printf("WARNING: multiple Enterprise GitHub URLs found - skipping:") - for i, refLine := range endpoint.enterpriseRefLines { - log.Printf("line %v: %#v", i, refLine) - } - case len(endpoint.enterpriseRefLines) > 0: - line := fmt.Sprintf(enterpriseRefFmt, url) - cmt := endpoint.enterpriseRefLines[0] - if cmt.Text != line { - pos := fileRewriter.Position(cmt.Pos()) - logf("At byte offset %v:\nFOUND %q\nWANT: %q", pos.Offset, cmt.Text, line) - fileEdits = append(fileEdits, &FileEdit{ - pos: pos, - fromText: cmt.Text, - toText: line, - }) - } - case len(endpoint.stdRefLines) > 1: - var foundMatch bool - line := fmt.Sprintf(stdRefFmt, url) - for i, stdRefLine := range endpoint.stdRefLines { - if stdRefLine.Text == line { - foundMatch = true - logf("found match with %v, not editing and removing from list", line) - // Remove matching line - endpoint.stdRefLines = append(endpoint.stdRefLines[:i], endpoint.stdRefLines[i+1:]...) - break - } - } - if !foundMatch { // Edit last stdRefLine, then remove it. - cmt := endpoint.stdRefLines[len(endpoint.stdRefLines)-1] - pos := fileRewriter.Position(cmt.Pos()) - logf("stdRefLines=%v: At byte offset %v:\nFOUND %q\nWANT: %q", len(endpoint.stdRefLines), pos.Offset, cmt.Text, line) - fileEdits = append(fileEdits, &FileEdit{ - pos: pos, - fromText: cmt.Text, - toText: line, - }) - endpoint.stdRefLines = endpoint.stdRefLines[:len(endpoint.stdRefLines)-1] - } - case len(endpoint.stdRefLines) > 0: - line := fmt.Sprintf(stdRefFmt, url) - cmt := endpoint.stdRefLines[0] - if cmt.Text != line { - pos := fileRewriter.Position(cmt.Pos()) - logf("stdRefLines=1: At byte offset %v:\nFOUND %q\nWANT: %q", pos.Offset, cmt.Text, line) - fileEdits = append(fileEdits, &FileEdit{ - pos: pos, - fromText: cmt.Text, - toText: line, - }) - } - endpoint.stdRefLines = nil - case len(endpoint.endpointComments) > 0: - lastCmt := endpoint.endpointComments[len(endpoint.endpointComments)-1] - // logf("lastCmt.Text=%q (len=%v)", lastCmt.Text, len(lastCmt.Text)) - pos := fileRewriter.Position(lastCmt.Pos()) - pos.Offset += len(lastCmt.Text) - line := "\n" + fmt.Sprintf(stdRefFmt, url) - if lastCmt.Text != "//" { - line = "\n//" + line // Add blank comment line before URL. - } - // logf("line=%q (len=%v)", line, len(line)) - // logf("At byte offset %v: adding missing documentation:\n%q", pos.Offset, line) - fileEdits = append(fileEdits, &FileEdit{ - pos: pos, - fromText: "", - toText: line, - }) - default: // Missing documentation - add it. - log.Printf("WARNING: file %v has no godoc comment string for method %v", fullName, methodAndPath) - } - } - } - - if len(fileEdits) > 0 { - b, err := fileRewriter.ReadFile(filename) - if err != nil { - log.Fatalf("ReadFile: %v", err) - } - - log.Printf("Performing %v edits on file %v", len(fileEdits), filename) - b = performBufferEdits(b, fileEdits) - - if err := fileRewriter.WriteFile(filename, b, 0644); err != nil { - log.Fatalf("WriteFile: %v", err) - } - } - } -} - -func performBufferEdits(b []byte, fileEdits []*FileEdit) []byte { - fileEdits = sortAndMergeFileEdits(fileEdits) - - for _, edit := range fileEdits { - prelude := b[0:edit.pos.Offset] - postlude := b[edit.pos.Offset+len(edit.fromText):] - logf("At byte offset %v, replacing %v bytes with %v bytes\nBEFORE: %v\nAFTER : %v", edit.pos.Offset, len(edit.fromText), len(edit.toText), edit.fromText, edit.toText) - b = []byte(fmt.Sprintf("%s%v%s", prelude, edit.toText, postlude)) - } - - return b -} - -func sortAndMergeFileEdits(fileEdits []*FileEdit) []*FileEdit { - // Sort edits from last to first in the file. - // If the offsets are identical, sort the comment "toText" strings, ascending. - var foundDups bool - sort.Slice(fileEdits, func(a, b int) bool { - if fileEdits[a].pos.Offset == fileEdits[b].pos.Offset { - foundDups = true - return fileEdits[a].toText < fileEdits[b].toText - } - return fileEdits[a].pos.Offset > fileEdits[b].pos.Offset - }) - - if !foundDups { - return fileEdits - } - - // Merge the duplicate edits. - var mergedEdits []*FileEdit - var dupOffsets []*FileEdit - - mergeFunc := func() { - if len(dupOffsets) > 1 { - isInsert := dupOffsets[0].fromText == "" - var hasBlankCommentLine bool - - // Merge dups - var lines []string - for _, dup := range dupOffsets { - if isInsert && strings.HasPrefix(dup.toText, "\n//\n//") { - lines = append(lines, strings.TrimPrefix(dup.toText, "\n//")) - hasBlankCommentLine = true - } else { - lines = append(lines, dup.toText) - } - } - sort.Strings(lines) - - var joinStr string - // if insert, no extra newlines - if !isInsert { // if replacement - add newlines - joinStr = "\n" - } - toText := strings.Join(lines, joinStr) - if hasBlankCommentLine { // Add back in - toText = "\n//" + toText - } - mergedEdits = append(mergedEdits, &FileEdit{ - pos: dupOffsets[0].pos, - fromText: dupOffsets[0].fromText, - toText: toText, - }) - } else if len(dupOffsets) > 0 { - // Move non-dup to final output - mergedEdits = append(mergedEdits, dupOffsets[0]) - } - dupOffsets = nil - } - - lastOffset := -1 - for _, fileEdit := range fileEdits { - if fileEdit.pos.Offset != lastOffset { - mergeFunc() - } - dupOffsets = append(dupOffsets, fileEdit) - lastOffset = fileEdit.pos.Offset - } - mergeFunc() - return mergedEdits -} - -// astFileIterator iterates over all files in an ast.Package. -type astFileIterator interface { - // Finds the position of a token. - Position(token.Pos) token.Position - // Reset resets the iterator. - Reset() - // Next returns the next filenameAstFilePair pair or nil if done. - Next() *filenameAstFilePair -} - -type filenameAstFilePair struct { - filename string - astFile *ast.File -} - -// realAstFileIterator implements astFileIterator. -type realAstFileIterator struct { - fset *token.FileSet - pkgs map[string]*ast.Package - ch chan *filenameAstFilePair - closed bool -} - -func (rafi *realAstFileIterator) Position(pos token.Pos) token.Position { - return rafi.fset.Position(pos) -} - -func (rafi *realAstFileIterator) Reset() { - if !rafi.closed && rafi.ch != nil { - logf("Closing old channel on Reset") - close(rafi.ch) - } - rafi.ch = make(chan *filenameAstFilePair, 10) - rafi.closed = false - - go func() { - var count int - for _, pkg := range rafi.pkgs { - for filename, f := range pkg.Files { - // logf("Sending file #%v: %v to channel", count, filename) - rafi.ch <- &filenameAstFilePair{filename: filename, astFile: f} - count++ - } - } - rafi.closed = true - close(rafi.ch) - logf("Closed channel after sending %v files", count) - if count == 0 { - log.Fatalf("Processed no files. Did you run this from the go-github directory?") - } - }() -} - -func (rafi *realAstFileIterator) Next() *filenameAstFilePair { - for pair := range rafi.ch { - // logf("Next: returning file %v", pair.filename) - return pair - } - return nil -} - -func findAllServices(pkgs map[string]*ast.Package) servicesMap { - services := servicesMap{} - for _, pkg := range pkgs { - for filename, f := range pkg.Files { - if filename != "github.go" { - continue - } - - logf("Step 1 - Processing %v ...", filename) - if err := findClientServices(f, services); err != nil { - log.Fatal(err) - } - } - } - return services -} - -func findAllServiceEndpoints(iter astFileIterator, services servicesMap) (endpointsMap, error) { - endpoints := endpointsMap{} - iter.Reset() - var errs []string // Collect all the errors and return in a big batch. - for next := iter.Next(); next != nil; next = iter.Next() { - filename, f := next.filename, next.astFile - if filename == "github.go" { - continue - } - - if *debugFile != "" && !strings.Contains(filename, *debugFile) { - continue - } - - logf("Step 2 - Processing %v ...", filename) - if err := processAST(filename, f, services, endpoints, iter); err != nil { - errs = append(errs, err.Error()) - } - } - - if len(errs) > 0 { - return nil, errors.New(strings.Join(errs, "\n")) - } - - return endpoints, nil -} - -func resolveHelpersAndCacheDocs(endpoints endpointsMap, docCache documentCacheWriter) (usedHelpers usedHelpersMap, endpointsByFilename endpointsByFilenameMap) { - logf("Step 3 - resolving helpers and cache docs ...") - usedHelpers = usedHelpersMap{} - endpointsByFilename = endpointsByFilenameMap{} - for k, v := range endpoints { - if _, ok := endpointsByFilename[v.filename]; !ok { - endpointsByFilename[v.filename] = []*Endpoint{} - } - endpointsByFilename[v.filename] = append(endpointsByFilename[v.filename], v) - - for _, cmt := range v.enterpriseRefLines { - docCache.CacheDocFromInternet(cmt.Text, v.filename, docCache.Position(cmt.Pos())) - } - for _, cmt := range v.stdRefLines { - docCache.CacheDocFromInternet(cmt.Text, v.filename, docCache.Position(cmt.Pos())) - } - - if v.httpMethod == "" && v.helperMethod != "" { - fullName := fmt.Sprintf("%v.%v", v.serviceName, v.helperMethod) - hm, ok := endpoints[fullName] - if !ok { - log.Fatalf("Unable to find helper method %q for %q", fullName, k) - } - if hm.httpMethod == "" { - log.Fatalf("Helper method %q for %q has empty httpMethod: %#v", fullName, k, hm) - } - v.httpMethod = hm.httpMethod - usedHelpers[fullName] = true - } - } - - return usedHelpers, endpointsByFilename -} - -type documentCacheReader interface { - URLByMethodAndPath(string) (string, bool) -} - -type documentCacheWriter interface { - CacheDocFromInternet(urlWithFragmentID, filename string, pos token.Position) - Position(token.Pos) token.Position -} - -type positioner interface { - Position(token.Pos) token.Position -} - -// documentCache implements documentCacheReader and documentCachWriter. -type documentCache struct { - apiDocs map[string]map[string][]*Endpoint // cached by URL, then mapped by web fragment identifier. - urlByMethodAndPath map[string]string - positioner positioner -} - -func (dc *documentCache) URLByMethodAndPath(methodAndPath string) (string, bool) { - url, ok := dc.urlByMethodAndPath[methodAndPath] - return url, ok -} - -func (dc *documentCache) CacheDocFromInternet(urlWithID, filename string, pos token.Position) { - if dc.apiDocs == nil { - dc.apiDocs = map[string]map[string][]*Endpoint{} // cached by URL, then mapped by web fragment identifier. - dc.urlByMethodAndPath = map[string]string{} - } - - baseURL, fullURL := getURL(urlWithID) - if _, ok := dc.apiDocs[baseURL]; ok { - return // already cached - } - - logf("GET %q ...", fullURL) - time.Sleep(httpGetDelay) - //nolint:gosec // G107: Potential HTTP request made with variable url - resp, err := http.Get(fullURL) - check("Unable to get URL: %v: %v", fullURL, err) - switch resp.StatusCode { - case http.StatusTooManyRequests, http.StatusServiceUnavailable: - logf("Sleeping 60 seconds and trying again...") - time.Sleep(60 * time.Second) - //nolint:gosec // G107: Potential HTTP request made with variable url - resp, err = http.Get(fullURL) - check("Unable to get URL: %v: %v", fullURL, err) - case http.StatusOK: - default: - log.Fatalf("url %v - StatusCode=%v\ngithub/%v:%v:%v %v", fullURL, resp.StatusCode, filename, pos.Line, pos.Column, urlWithID) - } - - finalURL := resp.Request.URL.String() - baseURL, fullURL = getURL(finalURL) - url := baseURL - logf("urlWithID: %v ; finalURL: %v ; baseURL: %v, fullURL: %v", urlWithID, finalURL, baseURL, fullURL) - - b, err := io.ReadAll(resp.Body) - check("Unable to read body of URL: %v, %v", url, err) - check("Unable to close body of URL: %v, %v", url, resp.Body.Close()) - dc.apiDocs[url] = parseWebPageEndpoints(string(b)) - check("Unable to parse web page endpoints: url: %v, filename: %v, err: %v", url, filename, err) - logf("Found %v web page fragment identifiers.", len(dc.apiDocs[url])) - if len(dc.apiDocs[url]) == 0 { - logf("webage text: %s", b) - } - - // Now reverse-map the methods+paths to URLs. - for fragID, v := range dc.apiDocs[url] { - logf("For fragID=%q, found %v endpoints.", fragID, len(v)) - for _, endpoint := range v { - logf("For fragID=%q, endpoint=%q, found %v paths.", fragID, endpoint, len(endpoint.urlFormats)) - for _, path := range endpoint.urlFormats { - methodAndPath := fmt.Sprintf("%v %v", endpoint.httpMethod, path) - dc.urlByMethodAndPath[methodAndPath] = fmt.Sprintf("%v#%v", strings.TrimRight(url, "/"), fragID) - logf("urlByMethodAndPath[%q] = %q", methodAndPath, dc.urlByMethodAndPath[methodAndPath]) - } - } - } -} - -func (dc *documentCache) Position(pos token.Pos) token.Position { - return dc.positioner.Position(pos) -} - -// FileEdit represents an edit that needs to be performed on a file. -type FileEdit struct { - pos token.Position - fromText string - toText string -} - -func getURL(s string) (baseURL, fullURL string) { - i := strings.Index(s, "http") - if i < 0 { - return "", "" - } - j := strings.Index(s, "#") - if j < i { - if !strings.HasSuffix(s, "/") { // Prevent unnecessary redirects if possible. - s += "/" - } - baseURL = s[i:] - fullURL = s[i:] - } else { - fullURL = s[i:] - baseURL = s[i:j] - if !strings.HasSuffix(baseURL, "/") { // Prevent unnecessary redirects if possible. - baseURL += "/" - } - } - return baseURL, fullURL -} - -// Service represents a go-github service. -type Service struct { - serviceName string -} - -// Endpoint represents an API endpoint in this repo. -type Endpoint struct { - endpointName string - filename string - serviceName string - urlFormats []string - httpMethod string - helperMethod string // If populated, httpMethod lives in helperMethod. - - enterpriseRefLines []*ast.Comment - stdRefLines []*ast.Comment - endpointComments []*ast.Comment -} - -// String helps with debugging by providing an easy-to-read summary of the endpoint. -func (e *Endpoint) String() string { - if e == nil { - return "Endpoint{nil}" - } - var b strings.Builder - if e.filename != "" { - b.WriteString(fmt.Sprintf(" filename: %v\n", e.filename)) - } - if e.serviceName != "" { - b.WriteString(fmt.Sprintf(" serviceName: %v\n", e.serviceName)) - } - if e.endpointName != "" { - b.WriteString(fmt.Sprintf(" endpointName: %v\n", e.endpointName)) - } - b.WriteString(fmt.Sprintf(" httpMethod: %v\n", e.httpMethod)) - if e.helperMethod != "" { - b.WriteString(fmt.Sprintf(" helperMethod: %v\n", e.helperMethod)) - } - for i := 0; i < len(e.urlFormats); i++ { - b.WriteString(fmt.Sprintf(" urlFormats[%v]: %v\n", i, e.urlFormats[i])) - } - for i := 0; i < len(e.enterpriseRefLines); i++ { - b.WriteString(fmt.Sprintf(" enterpriseRefLines[%v]: comment: %v\n", i, e.enterpriseRefLines[i].Text)) - } - for i := 0; i < len(e.stdRefLines); i++ { - b.WriteString(fmt.Sprintf(" stdRefLines[%v]: comment: %v\n", i, e.stdRefLines[i].Text)) - } - return b.String() -} - -func (e *Endpoint) checkHTTPMethodOverride(path string) { - lookupOverride := fmt.Sprintf("%v.%v: %v %v", e.serviceName, e.endpointName, e.httpMethod, path) - logf("Looking up override for %q", lookupOverride) - if v, ok := methodOverrides[lookupOverride]; ok { - logf("overriding method for %v to %q", lookupOverride, v) - e.httpMethod = v - return - } -} - -func processAST(filename string, f *ast.File, services servicesMap, endpoints endpointsMap, iter astFileIterator) error { - var errs []string - - for _, decl := range f.Decls { - switch decl := decl.(type) { - case *ast.FuncDecl: // Doc, Recv, Name, Type, Body - if decl.Recv == nil || len(decl.Recv.List) != 1 || decl.Name == nil || decl.Body == nil { - continue - } - - recv := decl.Recv.List[0] - se, ok := recv.Type.(*ast.StarExpr) // Star, X - if !ok || se.X == nil || len(recv.Names) != 1 { - if decl.Name.Name != "String" && decl.Name.Name != "Equal" && decl.Name.Name != "IsPullRequest" { - pos := iter.Position(recv.Pos()) - if id, ok := recv.Type.(*ast.Ident); ok { - pos = iter.Position(id.Pos()) - } - errs = append(errs, fmt.Sprintf("%v:%v:%v: method %v does not use a pointer receiver and needs fixing!", pos.Filename, pos.Line, pos.Column, decl.Name)) - } - continue - } - recvType, ok := se.X.(*ast.Ident) // NamePos, Name, Obj - if !ok { - return fmt.Errorf("unhandled se.X = %T", se.X) - } - serviceName := recvType.Name - if _, ok := services[serviceName]; !ok { - continue - } - endpointName := decl.Name.Name - fullName := fmt.Sprintf("%v.%v", serviceName, endpointName) - if skipMethods[fullName] { - logf("skipping %v", fullName) - continue - } - - receiverName := recv.Names[0].Name - - logf("\n\nast.FuncDecl: %#v", *decl) // Doc, Recv, Name, Type, Body - logf("ast.FuncDecl.Name: %#v", *decl.Name) // NamePos, Name, Obj(nil) - // logf("ast.FuncDecl.Recv: %#v", *decl.Recv) // Opening, List, Closing - logf("ast.FuncDecl.Recv.List[0]: %#v", *recv) // Doc, Names, Type, Tag, Comment - // for i, name := range decl.Recv.List[0].Names { - // logf("recv.name[%v] = %v", i, name.Name) - // } - logf("recvType = %#v", recvType) - var enterpriseRefLines []*ast.Comment - var stdRefLines []*ast.Comment - var endpointComments []*ast.Comment - if decl.Doc != nil { - endpointComments = decl.Doc.List - for i, comment := range decl.Doc.List { - logf("doc.comment[%v] = %#v", i, *comment) - // if strings.Contains(comment.Text, enterpriseURL) { - // enterpriseRefLines = append(enterpriseRefLines, comment) - // } else - if strings.Contains(comment.Text, stdURL) { - stdRefLines = append(stdRefLines, comment) - } - } - logf("%v comment lines, %v enterprise URLs, %v standard URLs", len(decl.Doc.List), len(enterpriseRefLines), len(stdRefLines)) - } - - bd := &bodyData{receiverName: receiverName} - if err := bd.parseBody(decl.Body); err != nil { // Lbrace, List, Rbrace - return fmt.Errorf("parseBody: %v", err) - } - - ep := &Endpoint{ - endpointName: endpointName, - filename: filename, - serviceName: serviceName, - urlFormats: bd.urlFormats, - httpMethod: bd.httpMethod, - helperMethod: bd.helperMethod, - enterpriseRefLines: enterpriseRefLines, - stdRefLines: stdRefLines, - endpointComments: endpointComments, - } - // ep.checkHTTPMethodOverride("") - endpoints[fullName] = ep - logf("endpoints[%q] = %#v", fullName, endpoints[fullName]) - if ep.httpMethod == "" && (ep.helperMethod == "" || len(ep.urlFormats) == 0) { - return fmt.Errorf("filename=%q, endpoint=%q: could not find body info: %#v", filename, fullName, *ep) - } - case *ast.GenDecl: - default: - return fmt.Errorf("unhandled decl type: %T", decl) - } - } - - if len(errs) > 0 { - return errors.New(strings.Join(errs, "\n")) - } - - return nil -} - -// bodyData contains information found in a BlockStmt. -type bodyData struct { - receiverName string // receiver name of method to help identify helper methods. - httpMethod string - urlVarName string - urlFormats []string - assignments []lhsrhs - helperMethod string // If populated, httpMethod lives in helperMethod. -} - -func (b *bodyData) parseBody(body *ast.BlockStmt) error { - logf("body=%#v", *body) - - // Find the variable used for the format string, its one-or-more values, - // and the httpMethod used for the NewRequest. - for _, stmt := range body.List { - switch stmt := stmt.(type) { - case *ast.AssignStmt: - hm, uvn, hlp, asgn := processAssignStmt(b.receiverName, stmt) - if b.httpMethod != "" && hm != "" && b.httpMethod != hm { - return fmt.Errorf("found two httpMethod values: %q and %q", b.httpMethod, hm) - } - if hm != "" { - b.httpMethod = hm - // logf("parseBody: httpMethod=%v", b.httpMethod) - } - if hlp != "" { - b.helperMethod = hlp - } - b.assignments = append(b.assignments, asgn...) - // logf("assignments=%#v", b.assignments) - if b.urlVarName == "" && uvn != "" { - b.urlVarName = uvn - // logf("parseBody: urlVarName=%v", b.urlVarName) - // By the time the urlVarName is found, all assignments should - // have already taken place so that we can find the correct - // ones and determine the urlFormats. - for _, lr := range b.assignments { - if lr.lhs == b.urlVarName { - b.urlFormats = append(b.urlFormats, lr.rhs) - logf("found urlFormat: %v", lr.rhs) - } - } - } - case *ast.DeclStmt: - logf("*ast.DeclStmt: %#v", *stmt) - case *ast.DeferStmt: - logf("*ast.DeferStmt: %#v", *stmt) - case *ast.ExprStmt: - logf("*ast.ExprStmt: %#v", *stmt) - case *ast.IfStmt: - if err := b.parseIf(stmt); err != nil { - return err - } - case *ast.RangeStmt: - logf("*ast.RangeStmt: %#v", *stmt) - case *ast.ReturnStmt: // Return Results - logf("*ast.ReturnStmt: %#v", *stmt) - if len(stmt.Results) > 0 { - switch rslt0 := stmt.Results[0].(type) { - case *ast.CallExpr: - recv, funcName, args := processCallExpr(rslt0) - logf("return CallExpr: recv=%q, funcName=%q, args=%#v", recv, funcName, args) - // If the httpMethod has not been found at this point, but - // this method is calling a helper function, then see if - // any of its arguments match a previous assignment, then - // record the urlFormat and remember the helper method. - if b.httpMethod == "" && len(args) > 1 && recv == b.receiverName { - if args[0] != "ctx" { - return fmt.Errorf("expected helper function to get ctx as first arg: %#v, %#v", args, *b) - } - if len(b.assignments) == 0 && len(b.urlFormats) == 0 { - b.urlFormats = append(b.urlFormats, strings.Trim(args[1], `"`)) - b.helperMethod = funcName - switch b.helperMethod { - case "deleteReaction": - b.httpMethod = "DELETE" - default: - logf("WARNING: helper method %q not found", b.helperMethod) - } - logf("found urlFormat: %v and helper method: %v, httpMethod: %v", b.urlFormats[0], b.helperMethod, b.httpMethod) - } else { - for _, lr := range b.assignments { - if lr.lhs == args[1] { // Multiple matches are possible. Loop over all assignments. - b.urlVarName = args[1] - b.urlFormats = append(b.urlFormats, lr.rhs) - b.helperMethod = funcName - switch b.helperMethod { - case "deleteReaction": - b.httpMethod = "DELETE" - default: - logf("WARNING: helper method %q not found", b.helperMethod) - } - logf("found urlFormat: %v and helper method: %v, httpMethod: %v", lr.rhs, b.helperMethod, b.httpMethod) - } - } - } - } - default: - logf("WARNING: stmt.Results[0] unhandled type = %T = %#v", stmt.Results[0], stmt.Results[0]) - } - } - case *ast.SwitchStmt: - logf("*ast.SwitchStmt: %#v", *stmt) - default: - return fmt.Errorf("unhandled stmt type: %T", stmt) - } - } - logf("parseBody: assignments=%#v", b.assignments) - - return nil -} - -func (b *bodyData) parseIf(stmt *ast.IfStmt) error { - logf("parseIf: *ast.IfStmt: %#v", *stmt) - if err := b.parseBody(stmt.Body); err != nil { - return err - } - logf("parseIf: if body: b=%#v", *b) - if stmt.Else != nil { - switch els := stmt.Else.(type) { - case *ast.BlockStmt: - if err := b.parseBody(els); err != nil { - return err - } - logf("parseIf: if else: b=%#v", *b) - case *ast.IfStmt: - if err := b.parseIf(els); err != nil { - return err - } - default: - return fmt.Errorf("unhandled else stmt type %T", els) - } - } - - return nil -} - -// lhsrhs represents an assignment with a variable name on the left -// and a string on the right - used to find the URL format string. -type lhsrhs struct { - lhs string - rhs string -} - -func processAssignStmt(receiverName string, stmt *ast.AssignStmt) (httpMethod, urlVarName, helperMethod string, assignments []lhsrhs) { - logf("*ast.AssignStmt: %#v", *stmt) // Lhs, TokPos, Tok, Rhs - var lhs []string - for _, expr := range stmt.Lhs { - switch expr := expr.(type) { - case *ast.Ident: // NamePos, Name, Obj - logf("processAssignStmt: *ast.Ident: %#v", expr) - lhs = append(lhs, expr.Name) - case *ast.SelectorExpr: // X, Sel - logf("processAssignStmt: *ast.SelectorExpr: %#v", expr) - default: - log.Fatalf("unhandled AssignStmt Lhs type: %T", expr) - } - } - - for i, expr := range stmt.Rhs { - switch expr := expr.(type) { - case *ast.BasicLit: // ValuePos, Kind, Value - v := strings.Trim(expr.Value, `"`) - if !strings.HasPrefix(v, "?") { // Hack to remove "?recursive=1" - assignments = append(assignments, lhsrhs{lhs: lhs[i], rhs: v}) - } - case *ast.BinaryExpr: - logf("processAssignStmt: *ast.BinaryExpr: %#v", *expr) - case *ast.CallExpr: // Fun, Lparen, Args, Ellipsis, Rparen - recv, funcName, args := processCallExpr(expr) - logf("processAssignStmt: CallExpr: recv=%q, funcName=%q, args=%#v", recv, funcName, args) - switch funcName { - case "addOptions": - if v := strings.Trim(args[0], `"`); v != args[0] { - assignments = append(assignments, lhsrhs{lhs: lhs[i], rhs: v}) - urlVarName = lhs[i] - } else { - urlVarName = args[0] - } - case "Sprintf": - assignments = append(assignments, lhsrhs{lhs: lhs[i], rhs: strings.Trim(args[0], `"`)}) - case "NewRequest": - httpMethod = strings.Trim(args[0], `"`) - urlVarName = args[1] - case "NewUploadRequest": - httpMethod = "POST" - urlVarName = args[0] - case "roundTripWithOptionalFollowRedirect": - httpMethod = "GET" - urlVarName = args[1] - default: - logf("WARNING: processAssignStmt: unhandled CallExpr: recv=%q, funcName=%q, args=%#v", recv, funcName, args) - } - if recv == receiverName && len(args) > 1 && args[0] == "ctx" { // This might be a helper method. - fullName := fmt.Sprintf("%v.%v", recv, funcName) - logf("checking for override: fullName=%v", fullName) - if fn, ok := helperOverrides[fullName]; ok { - logf("found helperOverride for %v", fullName) - hm, url := fn(strings.Trim(args[1], `"`)) - httpMethod = hm - urlVarName = "u" // arbitrary - assignments = []lhsrhs{{lhs: urlVarName, rhs: url}} - } else { - urlVarName = args[1] // For this to work correctly, the URL must be the second arg to the helper method! - helperMethod = funcName - logf("found possible helper method: funcName=%v, urlVarName=%v", funcName, urlVarName) - } - } - case *ast.CompositeLit: // Type, Lbrace, Elts, Rbrace, Incomplete - logf("processAssignStmt: *ast.CompositeLit: %#v", *expr) - case *ast.FuncLit: - logf("processAssignStmt: *ast.FuncLit: %#v", *expr) - case *ast.SelectorExpr: - logf("processAssignStmt: *ast.SelectorExpr: %#v", *expr) - case *ast.UnaryExpr: // OpPos, Op, X - logf("processAssignStmt: *ast.UnaryExpr: %#v", *expr) - case *ast.TypeAssertExpr: // X, Lparen, Type, Rparen - logf("processAssignStmt: *ast.TypeAssertExpr: %#v", *expr) - case *ast.Ident: // NamePos, Name, Obj - logf("processAssignStmt: *ast.Ident: %#v", *expr) - default: - log.Fatalf("unhandled AssignStmt Rhs type: %T", expr) - } - } - logf("urlVarName=%v, assignments=%#v", urlVarName, assignments) - - return httpMethod, urlVarName, helperMethod, assignments -} - -func processCallExpr(expr *ast.CallExpr) (recv, funcName string, args []string) { - logf("*ast.CallExpr: %#v", *expr) - - for _, arg := range expr.Args { - switch arg := arg.(type) { - case *ast.ArrayType: - logf("processCallExpr: *ast.ArrayType: %#v", arg) - case *ast.BasicLit: // ValuePos, Kind, Value - args = append(args, arg.Value) // Do not trim quotes here so as to identify it later as a string literal. - case *ast.CallExpr: // Fun, Lparen, Args, Ellipsis, Rparen - logf("processCallExpr: *ast.CallExpr: %#v", arg) - r, fn, as := processCallExpr(arg) - if r == "fmt" && fn == "Sprintf" && len(as) > 0 { // Special case - return format string. - args = append(args, as[0]) - } - case *ast.CompositeLit: - logf("processCallExpr: *ast.CompositeLit: %#v", arg) // Type, Lbrace, Elts, Rbrace, Incomplete - case *ast.Ident: // NamePos, Name, Obj - args = append(args, arg.Name) - case *ast.MapType: - logf("processCallExpr: *ast.MapType: %#v", arg) - case *ast.SelectorExpr: // X, Sel - logf("processCallExpr: *ast.SelectorExpr: %#v", arg) - x, ok := arg.X.(*ast.Ident) - if ok { // special case - switch name := fmt.Sprintf("%v.%v", x.Name, arg.Sel.Name); name { - case "http.MethodGet": - args = append(args, http.MethodGet) - case "http.MethodHead": - args = append(args, http.MethodHead) - case "http.MethodPost": - args = append(args, http.MethodPost) - case "http.MethodPut": - args = append(args, http.MethodPut) - case "http.MethodPatch": - args = append(args, http.MethodPatch) - case "http.MethodDelete": - args = append(args, http.MethodDelete) - case "http.MethodConnect": - args = append(args, http.MethodConnect) - case "http.MethodOptions": - args = append(args, http.MethodOptions) - case "http.MethodTrace": - args = append(args, http.MethodTrace) - default: - args = append(args, name) - } - } - case *ast.StarExpr: - logf("processCallExpr: *ast.StarExpr: %#v", arg) - case *ast.StructType: - logf("processCallExpr: *ast.StructType: %#v", arg) - case *ast.UnaryExpr: // OpPos, Op, X - switch x := arg.X.(type) { - case *ast.Ident: - args = append(args, x.Name) - case *ast.CompositeLit: // Type, Lbrace, Elts, Rbrace, Incomplete - logf("processCallExpr: *ast.CompositeLit: %#v", x) - default: - log.Fatalf("processCallExpr: unhandled UnaryExpr.X arg type: %T", arg.X) - } - default: - log.Fatalf("processCallExpr: unhandled arg type: %T", arg) - } - } - - switch fun := expr.Fun.(type) { - case *ast.Ident: // NamePos, Name, Obj - funcName = fun.Name - case *ast.SelectorExpr: // X, Sel - funcName = fun.Sel.Name - switch x := fun.X.(type) { - case *ast.Ident: // NamePos, Name, Obj - logf("processCallExpr: X recv *ast.Ident=%#v", x) - recv = x.Name - case *ast.ParenExpr: - logf("processCallExpr: X recv *ast.ParenExpr: %#v", x) - case *ast.SelectorExpr: // X, Sel - logf("processCallExpr: X recv *ast.SelectorExpr: %#v", x.Sel) - recv = x.Sel.Name - case *ast.CallExpr: // Fun, LParen, Args, Ellipsis, RParen - logf("processCallExpr: X recv *ast.CallExpr: %#v", x) - default: - log.Fatalf("processCallExpr: unhandled X receiver type: %T, funcName=%q", x, funcName) - } - default: - log.Fatalf("processCallExpr: unhandled Fun: %T", expr.Fun) - } - - return recv, funcName, args -} - -// findClientServices finds all go-github services from the Client struct. -func findClientServices(f *ast.File, services servicesMap) error { - for _, decl := range f.Decls { - switch decl := decl.(type) { - case *ast.GenDecl: - if decl.Tok != token.TYPE || len(decl.Specs) != 1 { - continue - } - ts, ok := decl.Specs[0].(*ast.TypeSpec) - if !ok || decl.Doc == nil || ts.Name == nil || ts.Type == nil || ts.Name.Name != "Client" { - continue - } - st, ok := ts.Type.(*ast.StructType) - if !ok || st.Fields == nil || len(st.Fields.List) == 0 { - continue - } - - for _, field := range st.Fields.List { - se, ok := field.Type.(*ast.StarExpr) - if !ok || se.X == nil || len(field.Names) != 1 { - continue - } - id, ok := se.X.(*ast.Ident) - if !ok { - continue - } - name := id.Name - if !strings.HasSuffix(name, "Service") { - continue - } - - services[name] = &Service{serviceName: name} - } - - return nil // Found all services in Client struct. - } - } - - return fmt.Errorf("unable to find Client struct in github.go") -} - -func check(fmtStr string, args ...interface{}) { - if err := args[len(args)-1]; err != nil { - log.Fatalf(fmtStr, args...) - } -} - -func endpointsEqual(a, b *Endpoint) bool { - if a == nil || b == nil { - return false - } - if a.httpMethod != b.httpMethod { - return false - } - return cmp.Equal(a.urlFormats, b.urlFormats) -} - -// parseWebPageEndpoints returns endpoint information, mapped by -// web page fragment identifier. -func parseWebPageEndpoints(buf string) map[string][]*Endpoint { - result := map[string][]*Endpoint{} - - // The GitHub v3 API web pages do not appear to be auto-generated - // and therefore, the XML decoder is too strict to reliably parse them. - // Here is a tiny example where the XML decoder completely fails - // due to mal-formed HTML: - // - // - //

- // - // ... - // - - parts := splitHTML(buf) - var lastFragmentID string - - addDedup := func(endpoint *Endpoint) { - for _, v := range result[lastFragmentID] { - if endpointsEqual(v, endpoint) { - return - } - } - result[lastFragmentID] = append(result[lastFragmentID], endpoint) - } - - for i, part := range parts { - noHTML := stripHTML(part) - - m := fragmentIDStringRE.FindAllStringSubmatch(part, -1) - if len(m) > 0 { - fragmentIDString := m[len(m)-1][0] - if i := strings.LastIndex(part, fragmentIDString); i >= 0 { - b := part[i+len(fragmentIDString):] - i = strings.Index(b, `"`) - if i >= 0 { - lastFragmentID = b[:i] - if j := strings.Index(lastFragmentID, "--"); j > 0 { - lastFragmentID = lastFragmentID[:j] // chop off trailing "--code-samples" for example. - } - logf("Found lastFragmentID: %v", lastFragmentID) - } - } - } - - for _, method := range httpMethods { - if strings.HasPrefix(part, method) { - if lastFragmentID == "" { - logf("WARNING: ignoring empty lastFragmentID: part #%v: noHTML=\n%v", i+1, noHTML) - continue - } - endpoint := parseEndpoint(part, method) - addDedup(endpoint) - continue - } - - if endpoint := parseNewfangledEndpoint(noHTML, method); endpoint != nil && lastFragmentID != "" { - logf("part #%v: adding newfangled endpoint: %#v", i+1, endpoint) - addDedup(endpoint) - } - } - } - - return result -} - -func stripHTML(s string) string { - s = strings.ReplaceAll(s, "", "") - s = strings.ReplaceAll(s, "", "") - s = stripHTMLRE.ReplaceAllString(s, " ") - return condenseWhitespaceRE.ReplaceAllString(s, " ") -} - -func splitHTML(buf string) []string { - var result []string - for buf != "" { - i := strings.Index(buf, codeLegacySplitString) - j := strings.Index(buf, codeSplitString) - switch { - case i < 0 && j < 0: - result = append(result, buf) - buf = "" - logf("splitHTML region #%v (%v bytes): case 1: i=%v, j=%v", len(result), len(result[len(result)-1]), i, j) - case j < 0, i >= 0 && j >= 0 && i < j: - result = append(result, buf[:i]) - buf = buf[i+len(codeLegacySplitString):] - logf("splitHTML region #%v (%v bytes): case 2: i=%v, j=%v", len(result), len(result[len(result)-1]), i, j) - case i < 0, i >= 0 && j >= 0 && j < i: - result = append(result, buf[:j]) - buf = buf[j+len(codeSplitString):] - logf("splitHTML region #%v (%v bytes): case 3: i=%v, j=%v", len(result), len(result[len(result)-1]), i, j) - default: - log.Fatalf("splitHTML: i=%v, j=%v", i, j) - } - } - return result -} - -func parseNewfangledEndpoint(s, method string) *Endpoint { - parts := strings.Split(s, " ") - if len(parts) < 2 { - return nil - } - for i, part := range parts[:len(parts)-1] { - if strings.EqualFold(part, method) && strings.HasPrefix(parts[i+1], "/") { - return parseEndpoint(method+" "+parts[i+1], method) - } - } - return nil -} - -func parseEndpoint(s, method string) *Endpoint { - eol := strings.Index(s, "\n") - if eol < 0 { - eol = len(s) - } - if v := strings.Index(s, "'"); v > len(method) && v < eol { - eol = v - } - if v := strings.Index(s, "<"); v > len(method) && v < eol { - eol = v - } - // if v := strings.Index(s, "{"); v > len(method) && v < eol { - // eol = v - // } - path := strings.TrimSpace(s[len(method):eol]) - path = strings.TrimPrefix(path, "{server}") - path = paramLegacyRE.ReplaceAllString(path, "%v") - path = paramRE.ReplaceAllString(path, "%v") - // strip leading garbage - if i := strings.Index(path, "/"); i >= 0 { - path = path[i+1:] - } - path = strings.TrimSuffix(path, ".") - logf("Found endpoint: %v %v", method, path) - return &Endpoint{ - urlFormats: []string{path}, - httpMethod: method, - } -} - -var httpMethods = []string{ - "GET", - "HEAD", - "POST", - "PUT", - "PATCH", - "DELETE", - "CONNECT", - "OPTIONS", - "TRACE", -} diff --git a/update-urls/main_test.go b/update-urls/main_test.go deleted file mode 100644 index d4696e1e967..00000000000 --- a/update-urls/main_test.go +++ /dev/null @@ -1,617 +0,0 @@ -// Copyright 2020 The go-github AUTHORS. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "fmt" - "go/parser" - "go/token" - "os" - "regexp" - "strings" - "testing" - - "github.com/google/go-cmp/cmp" - "github.com/pmezard/go-difflib/difflib" -) - -type pipelineSetup struct { - // Fields filled in by the unit test: - baseURL string - endpointsFromWebsite endpointsByFragmentID - filename string - serviceName string - originalGoSource string - wantGoSource string - wantNumEndpoints int - - // Fields filled in by setup: - docCache *fakeDocCache - fileRewriter *fakeFileRewriter - iter *fakeAstFileIterator - services servicesMap - wantFailure bool -} - -func (ps *pipelineSetup) setup(t *testing.T, stripURLs, destroyReceiverPointers bool) *pipelineSetup { - t.Helper() - - if stripURLs { - // For every GitHub API doc URL, remove it from the original source, - // and alternate between stripping the previous blank comment line and not. - for removeBlank := false; true; removeBlank = !removeBlank { - var changes bool - if removeBlank { - ps.originalGoSource, changes = removeNextURLAndOptionalBlank(ps.originalGoSource) - } else { - ps.originalGoSource, changes = removeNextURLLineOnly(ps.originalGoSource) - } - if !changes { - break - } - } - // log.Printf("Modified Go Source:\n%v", ps.originalGoSource) - } - - if destroyReceiverPointers { - from := fmt.Sprintf(" *%v) ", ps.serviceName) - to := fmt.Sprintf(" %v) ", ps.serviceName) - ps.originalGoSource = strings.ReplaceAll(ps.originalGoSource, from, to) - ps.wantFailure = true // receiver pointers must be fixed before running. - } - - ps.docCache = &fakeDocCache{ - t: t, - baseURL: ps.baseURL, - endpoints: ps.endpointsFromWebsite, - } - fset := token.NewFileSet() - ps.fileRewriter = &fakeFileRewriter{fset: fset, in: ps.originalGoSource} - ps.services = servicesMap{ps.serviceName: &Service{serviceName: ps.serviceName}} - astFile, err := parser.ParseFile(fset, ps.filename, ps.originalGoSource, parser.ParseComments) - if err != nil { - t.Fatalf("ParseFile: %v", err) - } - ps.iter = &fakeAstFileIterator{ - fset: fset, - orig: &filenameAstFilePair{ - filename: ps.filename, - astFile: astFile, - }, - } - - return ps -} - -func (ps *pipelineSetup) validate(t *testing.T) { - t.Helper() - - // Call pipeline - endpoints, err := findAllServiceEndpoints(ps.iter, ps.services) - if ps.wantFailure { - if err != nil { - // test successful - receivers must be pointers first - return - } - t.Fatalf("Expected non-pointer receivers to fail parsing, but no error was raised") - } - if err != nil { - t.Fatalf("Fail detected but not expected: %v", err) - } - - // log.Printf("endpoints=%#v (%v)", endpoints, len(endpoints)) - if len(endpoints) != ps.wantNumEndpoints { - t.Errorf("got %v endpoints, want %v", len(endpoints), ps.wantNumEndpoints) - } - usedHelpers, endpointsByFilename := resolveHelpersAndCacheDocs(endpoints, ps.docCache) - // log.Printf("endpointsByFilename=%#v (%v)", endpointsByFilename, len(endpointsByFilename[ps.filename])) - if len(endpointsByFilename[ps.filename]) != ps.wantNumEndpoints { - t.Errorf("got %v endpointsByFilename, want %v", len(endpointsByFilename[ps.filename]), ps.wantNumEndpoints) - } - validateRewriteURLs(usedHelpers, endpointsByFilename, ps.docCache, ps.fileRewriter) - - if ps.fileRewriter.out == "" { - t.Fatalf("No modifications were made to the file") - } - - if ps.fileRewriter.out != ps.wantGoSource { - diff := difflib.ContextDiff{ - A: difflib.SplitLines(ps.fileRewriter.out), - B: difflib.SplitLines(ps.wantGoSource), - FromFile: "got", - ToFile: "want", - Context: 1, - Eol: "\n", - } - result, _ := difflib.GetContextDiffString(diff) - t.Errorf(strings.Replace(result, "\t", " ", -1)) - } -} - -var ( - urlWithBlankCommentRE = regexp.MustCompile(`(//\n)?// GitHub API docs: [^\n]+\n`) - urlLineOnlyRE = regexp.MustCompile(`// GitHub API docs: [^\n]+\n`) -) - -func removeNextURLAndOptionalBlank(s string) (string, bool) { - parts := urlWithBlankCommentRE.Split(s, 2) - if len(parts) == 1 { - return parts[0], false - } - return parts[0] + parts[1], true -} - -func TestRemoveNextURLAndOptionalBlank(t *testing.T) { - tests := []struct { - name string - s string - want string - changes bool - }{ - {name: "empty string"}, - {name: "no URLs", s: "// line 1\n//\n// line 3", want: "// line 1\n//\n// line 3"}, - { - name: "URL without prior blank comment", - s: "// line 1\n// GitHub API docs: yeah\nfunc MyFunc() {\n", - want: "// line 1\nfunc MyFunc() {\n", - changes: true, - }, - { - name: "URL with prior blank comment", - s: "// line 1\n//\n// GitHub API docs: yeah\nfunc MyFunc() {\n", - want: "// line 1\nfunc MyFunc() {\n", - changes: true, - }, - } - - for i, tt := range tests { - t.Run(fmt.Sprintf("test #%v: %v", i, tt.name), func(t *testing.T) { - got, changes := removeNextURLAndOptionalBlank(tt.s) - if got != tt.want { - t.Errorf("got = %v, want %v", got, tt.want) - } - if changes != tt.changes { - t.Errorf("got changes = %v, want %v", changes, tt.changes) - } - }) - } -} - -func removeNextURLLineOnly(s string) (string, bool) { - parts := urlLineOnlyRE.Split(s, 2) - if len(parts) == 1 { - return parts[0], false - } - return parts[0] + parts[1], true -} - -func TestRemoveNextURLLineOnly(t *testing.T) { - tests := []struct { - name string - s string - want string - changes bool - }{ - {name: "empty string"}, - {name: "no URLs", s: "// line 1\n//\n// line 3", want: "// line 1\n//\n// line 3"}, - { - name: "URL without prior blank comment", - s: "// line 1\n// GitHub API docs: yeah\nfunc MyFunc() {\n", - want: "// line 1\nfunc MyFunc() {\n", - changes: true, - }, - { - name: "URL with prior blank comment", - s: "// line 1\n//\n// GitHub API docs: yeah\nfunc MyFunc() {\n", - want: "// line 1\n//\nfunc MyFunc() {\n", - changes: true, - }, - } - - for i, tt := range tests { - t.Run(fmt.Sprintf("test #%v: %v", i, tt.name), func(t *testing.T) { - got, changes := removeNextURLLineOnly(tt.s) - if got != tt.want { - t.Errorf("got = %v, want %v", got, tt.want) - } - if changes != tt.changes { - t.Errorf("got changes = %v, want %v", changes, tt.changes) - } - }) - } -} - -type endpointsByFragmentID map[string][]*Endpoint - -// fakeDocCache implements documentCacheReader and documentCacheWriter. -type fakeDocCache struct { - t *testing.T - baseURL string - endpoints endpointsByFragmentID -} - -func (f *fakeDocCache) URLByMethodAndPath(methodAndPath string) (string, bool) { - f.t.Helper() - for fragmentID, endpoints := range f.endpoints { - for _, endpoint := range endpoints { - for _, urlFormat := range endpoint.urlFormats { - key := fmt.Sprintf("%v %v", endpoint.httpMethod, urlFormat) - if key == methodAndPath { - url := fmt.Sprintf("%v#%v", f.baseURL, fragmentID) - // log.Printf("URLByMethodAndPath(%q) = (%q, true)", methodAndPath, url) - return url, true - } - } - } - } - f.t.Fatalf("fakeDocCache.URLByMethodAndPath: unable to find method %v", methodAndPath) - return "", false -} - -func (f *fakeDocCache) CacheDocFromInternet(url, filename string, pos token.Position) {} // no-op -func (f *fakeDocCache) Position(pos token.Pos) token.Position { return token.Position{} } // no-op - -// fakeFileRewriter implements FileRewriter. -type fakeFileRewriter struct { - fset *token.FileSet - in string - out string -} - -func (f *fakeFileRewriter) Position(pos token.Pos) token.Position { - return f.fset.Position(pos) -} - -func (f *fakeFileRewriter) ReadFile(filename string) ([]byte, error) { - return []byte(f.in), nil -} - -func (f *fakeFileRewriter) WriteFile(filename string, buf []byte, mode os.FileMode) error { - f.out = string(buf) - return nil -} - -// fakeAstFileIterator implements astFileIterator. -type fakeAstFileIterator struct { - orig, next *filenameAstFilePair - fset *token.FileSet -} - -func (f *fakeAstFileIterator) Position(pos token.Pos) token.Position { return f.fset.Position(pos) } -func (f *fakeAstFileIterator) Reset() { f.next = f.orig } -func (f *fakeAstFileIterator) Next() *filenameAstFilePair { - v := f.next - f.next = nil - return v -} - -func TestSortAndMergeFileEdits(t *testing.T) { - tests := []struct { - name string - fileEdits []*FileEdit - want []*FileEdit - }{ - {name: "no edits"}, - { - name: "one edit", - fileEdits: []*FileEdit{ - {toText: "one edit"}, - }, - want: []*FileEdit{ - {toText: "one edit"}, - }, - }, - { - name: "two inserts at same offset - no extra blank comment", - fileEdits: []*FileEdit{ - {pos: token.Position{Offset: 2}, fromText: "", toText: "\n// one insert"}, - {pos: token.Position{Offset: 2}, fromText: "", toText: "\n// second insert"}, - }, - want: []*FileEdit{ - {pos: token.Position{Offset: 2}, toText: "\n// one insert\n// second insert"}, - }, - }, - { - name: "two inserts at same offset - strip extra blank comment", - fileEdits: []*FileEdit{ - {pos: token.Position{Offset: 2}, fromText: "", toText: "\n//\n// one insert"}, - {pos: token.Position{Offset: 2}, fromText: "", toText: "\n//\n// second insert"}, - }, - want: []*FileEdit{ - {pos: token.Position{Offset: 2}, toText: "\n//\n// one insert\n// second insert"}, - }, - }, - { - name: "two non-overlapping edits, low offset to high", - fileEdits: []*FileEdit{ - {fromText: ".", pos: token.Position{Offset: 0}, toText: "edit one"}, - {fromText: ".", pos: token.Position{Offset: 100}, toText: "edit two"}, - }, - want: []*FileEdit{ - {fromText: ".", pos: token.Position{Offset: 100}, toText: "edit two"}, - {fromText: ".", pos: token.Position{Offset: 0}, toText: "edit one"}, - }, - }, - { - name: "two non-overlapping edits, high offset to low", - fileEdits: []*FileEdit{ - {fromText: ".", pos: token.Position{Offset: 100}, toText: "edit two"}, - {fromText: ".", pos: token.Position{Offset: 0}, toText: "edit one"}, - }, - want: []*FileEdit{ - {fromText: ".", pos: token.Position{Offset: 100}, toText: "edit two"}, - {fromText: ".", pos: token.Position{Offset: 0}, toText: "edit one"}, - }, - }, - { - name: "two overlapping edits, text low to high", - fileEdits: []*FileEdit{ - {fromText: ".", toText: "edit 0"}, - {fromText: ".", toText: "edit 1"}, - }, - want: []*FileEdit{ - {fromText: ".", toText: "edit 0\nedit 1"}, - }, - }, - { - name: "two overlapping edits, text high to low", - fileEdits: []*FileEdit{ - {fromText: ".", toText: "edit 1"}, - {fromText: ".", toText: "edit 0"}, - }, - want: []*FileEdit{ - {fromText: ".", toText: "edit 0\nedit 1"}, - }, - }, - { - name: "dup, non-dup", - fileEdits: []*FileEdit{ - {fromText: ".", toText: "edit 1"}, - {fromText: ".", toText: "edit 0"}, - {fromText: ".", pos: token.Position{Offset: 100}, toText: "edit 2"}, - }, - want: []*FileEdit{ - {fromText: ".", pos: token.Position{Offset: 100}, toText: "edit 2"}, - {fromText: ".", toText: "edit 0\nedit 1"}, - }, - }, - { - name: "non-dup, dup", - fileEdits: []*FileEdit{ - {fromText: ".", toText: "edit 2"}, - {fromText: ".", pos: token.Position{Offset: 100}, toText: "edit 1"}, - {fromText: ".", pos: token.Position{Offset: 100}, toText: "edit 0"}, - }, - want: []*FileEdit{ - {fromText: ".", pos: token.Position{Offset: 100}, toText: "edit 0\nedit 1"}, - {fromText: ".", toText: "edit 2"}, - }, - }, - { - name: "dup, non-dup, dup", - fileEdits: []*FileEdit{ - {fromText: ".", toText: "edit 1"}, - {fromText: ".", toText: "edit 0"}, - {fromText: ".", pos: token.Position{Offset: 100}, toText: "edit 2"}, - {fromText: ".", pos: token.Position{Offset: 200}, toText: "edit 4"}, - {fromText: ".", pos: token.Position{Offset: 200}, toText: "edit 3"}, - }, - want: []*FileEdit{ - {fromText: ".", pos: token.Position{Offset: 200}, toText: "edit 3\nedit 4"}, - {fromText: ".", pos: token.Position{Offset: 100}, toText: "edit 2"}, - {fromText: ".", toText: "edit 0\nedit 1"}, - }, - }, - { - name: "non-dup, dup, non-dup", - fileEdits: []*FileEdit{ - {fromText: ".", toText: "edit 2"}, - {fromText: ".", pos: token.Position{Offset: 100}, toText: "edit 1"}, - {fromText: ".", pos: token.Position{Offset: 100}, toText: "edit 0"}, - {fromText: ".", pos: token.Position{Offset: 200}, toText: "edit 3"}, - }, - want: []*FileEdit{ - {fromText: ".", pos: token.Position{Offset: 200}, toText: "edit 3"}, - {fromText: ".", pos: token.Position{Offset: 100}, toText: "edit 0\nedit 1"}, - {fromText: ".", toText: "edit 2"}, - }, - }, - { - name: "triplet, non-dup", - fileEdits: []*FileEdit{ - {fromText: ".", toText: "edit 1"}, - {fromText: ".", toText: "edit 0"}, - {fromText: ".", toText: "edit 2"}, - {fromText: ".", pos: token.Position{Offset: 100}, toText: "edit 3"}, - }, - want: []*FileEdit{ - {fromText: ".", pos: token.Position{Offset: 100}, toText: "edit 3"}, - {fromText: ".", toText: "edit 0\nedit 1\nedit 2"}, - }, - }, - } - - fileEditEqual := cmp.Comparer(func(a, b *FileEdit) bool { - return a.fromText == b.fromText && a.pos == b.pos && a.toText == b.toText - }) - - for i, tt := range tests { - t.Run(fmt.Sprintf("test #%v: %v", i, tt.name), func(t *testing.T) { - got := sortAndMergeFileEdits(tt.fileEdits) - - if len(got) != len(tt.want) { - t.Errorf("len(got) = %v, len(want) = %v", len(got), len(tt.want)) - } - for i := 0; i < len(got); i++ { - var wantFileEdit *FileEdit - if i < len(tt.want) { - wantFileEdit = tt.want[i] - } - if !cmp.Equal(got[i], wantFileEdit, fileEditEqual) { - t.Errorf("got[%v] =\n%#v\nwant[%v]:\n%#v", i, got[i], i, wantFileEdit) - } - } - }) - } -} - -func TestPerformBufferEdits(t *testing.T) { - tests := []struct { - name string - fileEdits []*FileEdit - s string - want string - }{ - {name: "no edits", s: "my\nshort\nfile\n", want: "my\nshort\nfile\n"}, - { - name: "one edit", - fileEdits: []*FileEdit{ - {pos: token.Position{Offset: 3}, fromText: "short", toText: "one edit"}, - }, - s: "my\nshort\nfile\n", - want: "my\none edit\nfile\n", - }, - { - name: "one insert", - fileEdits: []*FileEdit{ - {pos: token.Position{Offset: 2}, fromText: "", toText: "\none insert"}, - }, - s: "my\nshort\nfile\n", - want: "my\none insert\nshort\nfile\n", - }, - { - name: "two inserts at same offset", - fileEdits: []*FileEdit{ - {pos: token.Position{Offset: 2}, fromText: "", toText: "\none insert"}, - {pos: token.Position{Offset: 2}, fromText: "", toText: "\nsecond insert"}, - }, - s: "my\nshort\nfile\n", - want: "my\none insert\nsecond insert\nshort\nfile\n", - }, - } - - for i, tt := range tests { - t.Run(fmt.Sprintf("test #%v: %v", i, tt.name), func(t *testing.T) { - b := performBufferEdits([]byte(tt.s), tt.fileEdits) - got := string(b) - - if len(got) != len(tt.want) { - t.Errorf("len(got) = %v, len(want) = %v", len(got), len(tt.want)) - } - if got != tt.want { - t.Errorf("got = %v, want = %v", got, tt.want) - } - }) - } -} - -func TestGitURL(t *testing.T) { - tests := []struct { - name string - s string - wantBase string - wantFull string - }{ - {name: "empty string"}, - {name: "non-http", s: "howdy"}, - { - name: "normal URL, no slash", - s: "https://docs.github.com/en/rest/activity/events", - wantBase: "https://docs.github.com/en/rest/activity/events/", - wantFull: "https://docs.github.com/en/rest/activity/events/", - }, - { - name: "normal URL, with slash", - s: "https://docs.github.com/en/rest/activity/events/", - wantBase: "https://docs.github.com/en/rest/activity/events/", - wantFull: "https://docs.github.com/en/rest/activity/events/", - }, - { - name: "normal URL, with fragment identifier", - s: "https://docs.github.com/en/rest/activity/events/#list-public-events", - wantBase: "https://docs.github.com/en/rest/activity/events/", - wantFull: "https://docs.github.com/en/rest/activity/events/#list-public-events", - }, - } - - for i, tt := range tests { - t.Run(fmt.Sprintf("test #%v: %v", i, tt.name), func(t *testing.T) { - gotBase, gotFull := getURL(tt.s) - - if gotBase != tt.wantBase { - t.Errorf("getURL base = %v ; want %v", gotBase, tt.wantBase) - } - - if gotFull != tt.wantFull { - t.Errorf("getURL full = %v ; want %v", gotFull, tt.wantFull) - } - }) - } -} - -var endpointsEqualCmp = cmp.Comparer(endpointsEqual) - -func testWebPageHelper(t *testing.T, got, want map[string][]*Endpoint) { - t.Helper() - - for k := range got { - w, ok := want[k] - if len(got[k]) != len(w) { - t.Errorf("len(got[%q]) = %v, len(want[%q]) = %v", k, len(got[k]), k, len(w)) - } - - for i := 0; i < len(got[k]); i++ { - var wantEndpoint *Endpoint - if ok && i < len(w) { - wantEndpoint = w[i] - } - - if diff := cmp.Diff(wantEndpoint, got[k][i], endpointsEqualCmp); diff != "" { - t.Errorf("endpoint %q i=%v mismatch (-want +got):\n%v", k, i, diff) - } - } - } - - for k := range want { - if _, ok := got[k]; !ok { - t.Errorf("got[%q] = nil\nwant[%q]:\n%#v", k, k, want[k]) - } - } -} - -func TestParseEndpoint(t *testing.T) { - tests := []struct { - name string - s string - method string - want *Endpoint - }{ - { - name: "orgs_projects: list-repository-projects", - s: `GET /repos/{owner}/{repo}/projects'
, { -`, - method: "GET", - want: &Endpoint{urlFormats: []string{"repos/%v/%v/projects"}, httpMethod: "GET"}, - }, - { - name: "orgs_projects: ListProjects", - s: `GET /orgs/{org}/projects', { -`, - method: "GET", - want: &Endpoint{urlFormats: []string{"orgs/%v/projects"}, httpMethod: "GET"}, - }, - } - - for i, tt := range tests { - t.Run(fmt.Sprintf("test #%v: %v", i, tt.name), func(t *testing.T) { - got := parseEndpoint(tt.s, tt.method) - - if !cmp.Equal(got, tt.want, endpointsEqualCmp) { - t.Errorf("parseEndpoint = %#v, want %#v", got, tt.want) - } - }) - } -} diff --git a/update-urls/reactions_test.go b/update-urls/reactions_test.go deleted file mode 100644 index 8d0504ec699..00000000000 --- a/update-urls/reactions_test.go +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright 2020 The go-github AUTHORS. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - _ "embed" - "strings" - "testing" -) - -func newReactionsPipeline() *pipelineSetup { - return &pipelineSetup{ - baseURL: "https://docs.github.com/en/rest/reactions/", - endpointsFromWebsite: reactionsWant, - filename: "reactions.go", - serviceName: "ReactionsService", - originalGoSource: strings.ReplaceAll(reactionsGoFileOriginal, "\r", ""), - wantGoSource: strings.ReplaceAll(reactionsGoFileWant, "\r", ""), - wantNumEndpoints: 25, - } -} - -func TestPipeline_Reactions(t *testing.T) { - ps := newReactionsPipeline() - ps.setup(t, false, false) - ps.validate(t) -} - -func TestPipeline_Reactions_FirstStripAllURLs(t *testing.T) { - ps := newReactionsPipeline() - ps.setup(t, true, false) - ps.validate(t) -} - -func TestPipeline_Reactions_FirstDestroyReceivers(t *testing.T) { - ps := newReactionsPipeline() - ps.setup(t, false, true) - ps.validate(t) -} - -func TestPipeline_Reactions_FirstStripAllURLsAndDestroyReceivers(t *testing.T) { - ps := newReactionsPipeline() - ps.setup(t, true, true) - ps.validate(t) -} - -func TestParseWebPageEndpoints_Reactions(t *testing.T) { - got := parseWebPageEndpoints(reactionsTestWebPage) - testWebPageHelper(t, got, reactionsWant) -} - -var reactionsWant = endpointsByFragmentID{ - "list-reactions-for-a-commit-comment": []*Endpoint{{urlFormats: []string{"repos/%v/%v/comments/%v/reactions"}, httpMethod: "GET"}}, - - "delete-a-commit-comment-reaction": []*Endpoint{ - {urlFormats: []string{"repositories/%v/comments/%v/reactions/%v"}, httpMethod: "DELETE"}, - {urlFormats: []string{"repos/%v/%v/comments/%v/reactions/%v"}, httpMethod: "DELETE"}, - }, - - "create-reaction-for-an-issue": []*Endpoint{{urlFormats: []string{"repos/%v/%v/issues/%v/reactions"}, httpMethod: "POST"}}, - - "delete-an-issue-reaction": []*Endpoint{ - {urlFormats: []string{"repositories/%v/issues/%v/reactions/%v"}, httpMethod: "DELETE"}, - {urlFormats: []string{"repos/%v/%v/issues/%v/reactions/%v"}, httpMethod: "DELETE"}, - }, - - "create-reaction-for-a-pull-request-review-comment": []*Endpoint{{urlFormats: []string{"repos/%v/%v/pulls/comments/%v/reactions"}, httpMethod: "POST"}}, - - "list-reactions-for-a-team-discussion": []*Endpoint{ - {urlFormats: []string{"organizations/%v/team/%v/discussions/%v/reactions"}, httpMethod: "GET"}, - {urlFormats: []string{"orgs/%v/teams/%v/discussions/%v/reactions"}, httpMethod: "GET"}, - }, - - "delete-a-reaction-legacy": []*Endpoint{{urlFormats: []string{"reactions/%v"}, httpMethod: "DELETE"}}, - - "list-reactions-for-a-team-discussion-comment-legacy": []*Endpoint{{urlFormats: []string{"teams/%v/discussions/%v/comments/%v/reactions"}, httpMethod: "GET"}}, - - "delete-an-issue-comment-reaction": []*Endpoint{ - {urlFormats: []string{"repositories/%v/issues/comments/%v/reactions/%v"}, httpMethod: "DELETE"}, - {urlFormats: []string{"repos/%v/%v/issues/comments/%v/reactions/%v"}, httpMethod: "DELETE"}, - }, - - "list-reactions-for-a-pull-request-review-comment": []*Endpoint{{urlFormats: []string{"repos/%v/%v/pulls/comments/%v/reactions"}, httpMethod: "GET"}}, - - "create-reaction-for-a-team-discussion-legacy": []*Endpoint{{urlFormats: []string{"teams/%v/discussions/%v/reactions"}, httpMethod: "POST"}}, - - "create-reaction-for-a-team-discussion-comment-legacy": []*Endpoint{{urlFormats: []string{"teams/%v/discussions/%v/comments/%v/reactions"}, httpMethod: "POST"}}, - - "create-reaction-for-a-commit-comment": []*Endpoint{{urlFormats: []string{"repos/%v/%v/comments/%v/reactions"}, httpMethod: "POST"}}, - - "list-reactions-for-an-issue": []*Endpoint{{urlFormats: []string{"repos/%v/%v/issues/%v/reactions"}, httpMethod: "GET"}}, - - "create-reaction-for-an-issue-comment": []*Endpoint{{urlFormats: []string{"repos/%v/%v/issues/comments/%v/reactions"}, httpMethod: "POST"}}, - - "create-reaction-for-a-team-discussion": []*Endpoint{ - {urlFormats: []string{"organizations/%v/team/%v/discussions/%v/reactions"}, httpMethod: "POST"}, - {urlFormats: []string{"orgs/%v/teams/%v/discussions/%v/reactions"}, httpMethod: "POST"}, - }, - - "delete-team-discussion-reaction": []*Endpoint{ - {urlFormats: []string{"organizations/%v/team/%v/discussions/%v/reactions/%v"}, httpMethod: "DELETE"}, - {urlFormats: []string{"orgs/%v/teams/%v/discussions/%v/reactions/%v"}, httpMethod: "DELETE"}, - }, - - "create-reaction-for-a-team-discussion-comment": []*Endpoint{ - {urlFormats: []string{"organizations/%v/team/%v/discussions/%v/comments/%v/reactions"}, httpMethod: "POST"}, - {urlFormats: []string{"orgs/%v/teams/%v/discussions/%v/comments/%v/reactions"}, httpMethod: "POST"}, - }, - - "list-reactions-for-an-issue-comment": []*Endpoint{{urlFormats: []string{"repos/%v/%v/issues/comments/%v/reactions"}, httpMethod: "GET"}}, - - "delete-a-pull-request-comment-reaction": []*Endpoint{ - {urlFormats: []string{"repositories/%v/pulls/comments/%v/reactions/%v"}, httpMethod: "DELETE"}, - {urlFormats: []string{"repos/%v/%v/pulls/comments/%v/reactions/%v"}, httpMethod: "DELETE"}, - }, - - "list-reactions-for-a-team-discussion-comment": []*Endpoint{ - {urlFormats: []string{"organizations/%v/team/%v/discussions/%v/comments/%v/reactions"}, httpMethod: "GET"}, - {urlFormats: []string{"orgs/%v/teams/%v/discussions/%v/comments/%v/reactions"}, httpMethod: "GET"}, - }, - - "delete-team-discussion-comment-reaction": []*Endpoint{ - {urlFormats: []string{"organizations/%v/team/%v/discussions/%v/comments/%v/reactions/%v"}, httpMethod: "DELETE"}, - {urlFormats: []string{"orgs/%v/teams/%v/discussions/%v/comments/%v/reactions/%v"}, httpMethod: "DELETE"}, - }, - - "list-reactions-for-a-team-discussion-legacy": []*Endpoint{{urlFormats: []string{"teams/%v/discussions/%v/reactions"}, httpMethod: "GET"}}, -} - -//go:embed testdata/reactions.html -var reactionsTestWebPage string - -//go:embed testdata/reactions-original.go -var reactionsGoFileOriginal string - -//go:embed testdata/reactions-want.go -var reactionsGoFileWant string diff --git a/update-urls/testdata/activity-events.html b/update-urls/testdata/activity-events.html deleted file mode 100644 index 90eac2f59ff..00000000000 --- a/update-urls/testdata/activity-events.html +++ /dev/null @@ -1,5686 +0,0 @@ - - - Activity - GitHub Docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - -
- - - - -
-
- - -
-
- - - -
-
- -
- - - Article version: GitHub.com - - - - -
- - -
-
- - -
-
- -
- -
-
-

Activity

-
- -
-
- - - - - - - - -
-
-
- -

In this article

- - -
- -
-

- Did this doc help you? -

-

- - - - -

- - - - - -

- - -

- - -
- -
-
-
-
- -

Events

-

The Events API is a read-only API to the GitHub events. These events power the various activity streams on the site.

-

The Events API can return different types of events triggered by activity on GitHub. For more information about the specific events that you can receive from the Events API, see "GitHub Event types." An events API for repository issues is also available. For more information, see the "Issue Events API."

-

Events are optimized for polling with the "ETag" header. If no new events have been triggered, you will see a "304 Not Modified" response, and your current rate limit will be untouched. There is also an "X-Poll-Interval" header that specifies how often (in seconds) you are allowed to poll. In times of high server load, the time may increase. Please obey the header.

-
$ curl -I https://api.github.com/users/tater/events
-> HTTP/1.1 200 OK
-> X-Poll-Interval: 60
-> ETag: "a18c3bded88eb5dbb5c849a489412bf3"
-
-# The quotes around the ETag value are important
-$ curl -I https://api.github.com/users/tater/events \
-$    -H 'If-None-Match: "a18c3bded88eb5dbb5c849a489412bf3"'
-> HTTP/1.1 304 Not Modified
-> X-Poll-Interval: 60
-

Events support pagination, however the per_page option is unsupported. The fixed page size is 30 items. Fetching up to ten pages is supported, for a total of 300 events. For information, see "Traversing with pagination."

-

Only events created within the past 90 days will be included in timelines. Events older than 90 days will not be included (even if the total number of events in the timeline is less than 300).

-
-
-

- List public events -

-

We delay the public events feed by five minutes, which means the most recent event returned by the public events API actually occurred at least five minutes ago.

-
-
get /events
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/events
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /events')
-
- - - - -

Response

-
Status: 200 OK
-
- - -

Notes

- - - -
-
-
-
- -
get /networks/{owner}/{repo}/events
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
ownerstringpath - - -
repostringpath - - -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/networks/octocat/hello-world/events
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /networks/{owner}/{repo}/events', {
-  owner: 'octocat',
-  repo: 'hello-world'
-})
-
- - - - -

Response

-
Status: 200 OK
-
- - -

Notes

- - - -
-
-
-
- -
get /orgs/{org}/events
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
orgstringpath - - -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/orgs/ORG/events
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /orgs/{org}/events', {
-  org: 'org'
-})
-
- - - - -

Response

-
Status: 200 OK
-
- - -

Notes

- - - -
-
-
-
- -
get /repos/{owner}/{repo}/events
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
ownerstringpath - - -
repostringpath - - -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/repos/octocat/hello-world/events
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /repos/{owner}/{repo}/events', {
-  owner: 'octocat',
-  repo: 'hello-world'
-})
-
- - - - -

Response

-
Status: 200 OK
-
- - -

Notes

- - - -
-
-
-
-
-

- List events for the authenticated user -

-

If you are authenticated as the given user, you will see your private events. Otherwise, you'll only see public events.

-
-
get /users/{username}/events
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
usernamestringpath - - -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/users/USERNAME/events
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /users/{username}/events', {
-  username: 'username'
-})
-
- - - - -

Response

-
Status: 200 OK
-
- - -

Notes

- - - -
-
-
-
-
-

- List organization events for the authenticated user -

-

This is the user's organization dashboard. You must be authenticated as the user to view this.

-
-
get /users/{username}/events/orgs/{org}
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
usernamestringpath - - -
orgstringpath - - -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/users/USERNAME/events/orgs/ORG
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /users/{username}/events/orgs/{org}', {
-  username: 'username',
-  org: 'org'
-})
-
- - - - -

Response

-
Status: 200 OK
-
- - - -
-
-
-
- -
get /users/{username}/events/public
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
usernamestringpath - - -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/users/USERNAME/events/public
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /users/{username}/events/public', {
-  username: 'username'
-})
-
- - - - -

Response

-
Status: 200 OK
-
- - -

Notes

- - - -
-
-
-
-
-

- List events received by the authenticated user -

-

These are events that you've received by watching repos and following users. If you are authenticated as the given user, you will see private events. Otherwise, you'll only see public events.

-
-
get /users/{username}/received_events
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
usernamestringpath - - -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/users/USERNAME/received_events
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /users/{username}/received_events', {
-  username: 'username'
-})
-
- - - - -

Response

-
Status: 200 OK
-
- - -

Notes

- - - -
-
-
-
- -
get /users/{username}/received_events/public
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
usernamestringpath - - -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/users/USERNAME/received_events/public
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /users/{username}/received_events/public', {
-  username: 'username'
-})
-
- - - - -

Response

-
Status: 200 OK
-
- - -

Notes

- - - -
-
-
-

Feeds

-
-
-

- Get feeds -

-

GitHub provides several timeline resources in Atom format. The Feeds API lists all the feeds available to the authenticated user:

-
    -
  • Timeline: The GitHub global public timeline
  • -
  • User: The public timeline for any user, using URI template
  • -
  • Current user public: The public timeline for the authenticated user
  • -
  • Current user: The private timeline for the authenticated user
  • -
  • Current user actor: The private timeline for activity created by the authenticated user
  • -
  • Current user organizations: The private timeline for the organizations the authenticated user is a member of.
  • -
  • Security advisories: A collection of public announcements that provide information about security-related vulnerabilities in software on GitHub.
  • -
-

Note: Private feeds are only returned when authenticating via Basic Auth since current feed URIs use the older, non revocable auth tokens.

-
-
get /feeds
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/feeds
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /feeds')
-
- - - - -

Default response

-
Status: 200 OK
-
{
-  "timeline_url": "https://github.com/timeline",
-  "user_url": "https://github.com/{user}",
-  "current_user_public_url": "https://github.com/octocat",
-  "current_user_url": "https://github.com/octocat.private?token=abc123",
-  "current_user_actor_url": "https://github.com/octocat.private.actor?token=abc123",
-  "current_user_organization_url": "",
-  "current_user_organization_urls": [
-    "https://github.com/organizations/github/octocat.private.atom?token=abc123"
-  ],
-  "security_advisories_url": "https://github.com/security-advisories",
-  "_links": {
-    "timeline": {
-      "href": "https://github.com/timeline",
-      "type": "application/atom+xml"
-    },
-    "user": {
-      "href": "https://github.com/{user}",
-      "type": "application/atom+xml"
-    },
-    "current_user_public": {
-      "href": "https://github.com/octocat",
-      "type": "application/atom+xml"
-    },
-    "current_user": {
-      "href": "https://github.com/octocat.private?token=abc123",
-      "type": "application/atom+xml"
-    },
-    "current_user_actor": {
-      "href": "https://github.com/octocat.private.actor?token=abc123",
-      "type": "application/atom+xml"
-    },
-    "current_user_organization": {
-      "href": "",
-      "type": ""
-    },
-    "current_user_organizations": [
-      {
-        "href": "https://github.com/organizations/github/octocat.private.atom?token=abc123",
-        "type": "application/atom+xml"
-      }
-    ],
-    "security_advisories": {
-      "href": "https://github.com/security-advisories",
-      "type": "application/atom+xml"
-    }
-  }
-}
-
- - -

Notes

- - - -
-
-
-

Example of getting an Atom feed

-

To get a feed in Atom format, you must specify the application/atom+xml type in the Accept header. For example, to get the Atom feed for GitHub security advisories:

-
curl -H "Accept: application/atom+xml" https://github.com/security-advisories
-
-

Response

-
Status: 200 OK
-
<?xml version="1.0" encoding="UTF-8"?>
-<feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xml:lang="en-US">
-  <id>tag:github.com,2008:/security-advisories</id>
-  <link rel="self" type="application/atom+xml" href="https://github.com/security-advisories.atom"/>
-  <title>GitHub Security Advisory Feed</title>
-  <author>
-    <name>GitHub</name>
-  </author>
-  <updated>2019-01-14T19:34:52Z</updated>
-     <entry>
-      <id>tag:github.com,2008:GHSA-abcd-12ab-23cd</id>
-      <published>2018-07-26T15:14:52Z</published>
-      <updated>2019-01-14T19:34:52Z</updated>
-      <title type="html">[GHSA-abcd-12ab-23cd] Moderate severity vulnerability that affects Octoapp</title>
-        <category term="NPM"/>
-      <content type="html">
-        &lt;p&gt;Octoapp node module before 4.17.5 suffers from a Modification of Assumed-Immutable Data (MAID) vulnerability via defaultsDeep, merge, and mergeWith functions, which allows a malicious user to modify the prototype of &quot;Object&quot; via &lt;strong&gt;proto&lt;/strong&gt;, causing the addition or modification of an existing property that will exist on all objects.&lt;/p&gt;
-          &lt;p&gt;&lt;strong&gt;Affected Packages&lt;/strong&gt;&lt;/p&gt;
-
-  &lt;dl&gt;
-      &lt;dt&gt;Octoapp&lt;/dt&gt;
-      &lt;dd&gt;Ecosystem: npm&lt;/dd&gt;
-      &lt;dd&gt;Severity: moderate&lt;/dd&gt;
-      &lt;dd&gt;Versions: &amp;lt; 4.17.5&lt;/dd&gt;
-        &lt;dd&gt;Fixed in: 4.17.5&lt;/dd&gt;
-  &lt;/dl&gt;
-
-          &lt;p&gt;&lt;strong&gt;References&lt;/strong&gt;&lt;/p&gt;
-
-  &lt;ul&gt;
-      &lt;li&gt;https://nvd.nist.gov/vuln/detail/CVE-2018-123&lt;/li&gt;
-  &lt;/ul&gt;
-
-      </content>
-    </entry>
-</feed>
-
-

Notifications

-

Users receive notifications for conversations in repositories they watch including:

-
    -
  • Issues and their comments
  • -
  • Pull Requests and their comments
  • -
  • Comments on any commits
  • -
-

Notifications are also sent for conversations in unwatched repositories when the user is involved including:

-
    -
  • @mentions
  • -
  • Issue assignments
  • -
  • Commits the user authors or commits
  • -
  • Any discussion in which the user actively participates
  • -
-

All Notification API calls require the notifications or repo API scopes. Doing this will give read-only access to some issue and commit content. You will still need the repo scope to access issues and commits from their respective endpoints.

-

Notifications come back as "threads". A thread contains information about the current discussion of an issue, pull request, or commit.

-

Notifications are optimized for polling with the Last-Modified header. If there are no new notifications, you will see a 304 Not Modified response, leaving your current rate limit untouched. There is an X-Poll-Interval header that specifies how often (in seconds) you are allowed to poll. In times of high server load, the time may increase. Please obey the header.

-
# Add authentication to your requests
-$ curl -I https://api.github.com/notifications
-HTTP/1.1 200 OK
-Last-Modified: Thu, 25 Oct 2012 15:16:27 GMT
-X-Poll-Interval: 60
-
-# Pass the Last-Modified header exactly
-$ curl -I https://api.github.com/notifications
-$    -H "If-Modified-Since: Thu, 25 Oct 2012 15:16:27 GMT"
-> HTTP/1.1 304 Not Modified
-> X-Poll-Interval: 60
-

Notification reasons

-

When retrieving responses from the Notifications API, each payload has a key titled reason. These correspond to events that trigger a notification.

-

Here's a list of potential reasons for receiving a notification:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Reason NameDescription
assignYou were assigned to the issue.
authorYou created the thread.
commentYou commented on the thread.
invitationYou accepted an invitation to contribute to the repository.
manualYou subscribed to the thread (via an issue or pull request).
mentionYou were specifically @mentioned in the content.
review_requestedYou, or a team you're a member of, were requested to review a pull request.
security_alertGitHub discovered a security vulnerability in your repository.
state_changeYou changed the thread state (for example, closing an issue or merging a pull request).
subscribedYou're watching the repository.
team_mentionYou were on a team that was mentioned.
-

Note that the reason is modified on a per-thread basis, and can change, if the reason on a later notification is different.

-

For example, if you are the author of an issue, subsequent notifications on that issue will have a reason of author. If you're then @mentioned on the same issue, the notifications you fetch thereafter will have a reason of mention. The reason remains as mention, regardless of whether you're ever mentioned again.

-
-
-

- List notifications for the authenticated user -

-

List all notifications for the current user, sorted by most recently updated.

-
-
get /notifications
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
allbooleanquery -

If true, show notifications marked as read.

- -
participatingbooleanquery -

If true, only shows notifications in which the user is directly participating or mentioned.

- -
sincestringquery -

Only show notifications updated after the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.

- -
beforestringquery -

Only show notifications updated before the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.

- -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/notifications
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /notifications')
-
- - - - -

Default response

-
Status: 200 OK
-
[
-  {
-    "id": "1",
-    "repository": {
-      "id": 1296269,
-      "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
-      "name": "Hello-World",
-      "full_name": "octocat/Hello-World",
-      "owner": {
-        "login": "octocat",
-        "id": 1,
-        "node_id": "MDQ6VXNlcjE=",
-        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-        "gravatar_id": "",
-        "url": "https://api.github.com/users/octocat",
-        "html_url": "https://github.com/octocat",
-        "followers_url": "https://api.github.com/users/octocat/followers",
-        "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-        "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-        "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-        "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-        "organizations_url": "https://api.github.com/users/octocat/orgs",
-        "repos_url": "https://api.github.com/users/octocat/repos",
-        "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-        "received_events_url": "https://api.github.com/users/octocat/received_events",
-        "type": "User",
-        "site_admin": false
-      },
-      "private": false,
-      "html_url": "https://github.com/octocat/Hello-World",
-      "description": "This your first repo!",
-      "fork": false,
-      "url": "https://api.github.com/repos/octocat/Hello-World",
-      "archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
-      "assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
-      "blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
-      "branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
-      "collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
-      "comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
-      "commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
-      "compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
-      "contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
-      "contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
-      "deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
-      "downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
-      "events_url": "http://api.github.com/repos/octocat/Hello-World/events",
-      "forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
-      "git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
-      "git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
-      "git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
-      "git_url": "git:github.com/octocat/Hello-World.git",
-      "issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
-      "issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
-      "issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
-      "keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
-      "labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
-      "languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
-      "merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
-      "milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
-      "notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
-      "pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
-      "releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
-      "ssh_url": "git@github.com:octocat/Hello-World.git",
-      "stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
-      "statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
-      "subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
-      "subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
-      "tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
-      "teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
-      "trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}"
-    },
-    "subject": {
-      "title": "Greetings",
-      "url": "https://api.github.com/repos/octokit/octokit.rb/issues/123",
-      "latest_comment_url": "https://api.github.com/repos/octokit/octokit.rb/issues/comments/123",
-      "type": "Issue"
-    },
-    "reason": "subscribed",
-    "unread": true,
-    "updated_at": "2014-11-07T22:01:45Z",
-    "last_read_at": "2014-11-07T22:01:45Z",
-    "url": "https://api.github.com/notifications/threads/1"
-  }
-]
-
- - - -
-
-
-
-
-

- Mark notifications as read -

-

Marks all notifications as "read" removes it from the default view on GitHub. If the number of notifications is too large to complete in one request, you will receive a 202 Accepted status and GitHub will run an asynchronous process to mark notifications as "read." To check whether any "unread" notifications remain, you can use the List notifications for the authenticated user endpoint and pass the query parameter all=false.

-
-
put /notifications
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
last_read_atstringbody -

Describes the last point that notifications were checked. Anything updated since this time will not be marked as read. If you omit this parameter, all notifications are marked as read. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. Default: The current timestamp.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X PUT \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/notifications \
-  -d '{"last_read_at":"last_read_at"}'
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('PUT /notifications', {
-  last_read_at: 'last_read_at'
-})
-
- - - - -

Response

-
Status: 205 Reset Content
-
- - - -
-
-
-
-
-

- Get a thread -

- -
-
get /notifications/threads/{thread_id}
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
thread_idintegerpath - - -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/notifications/threads/42
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /notifications/threads/{thread_id}', {
-  thread_id: 42
-})
-
- - - - -

Default response

-
Status: 200 OK
-
{
-  "id": "1",
-  "repository": {
-    "id": 1296269,
-    "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
-    "name": "Hello-World",
-    "full_name": "octocat/Hello-World",
-    "owner": {
-      "login": "octocat",
-      "id": 1,
-      "node_id": "MDQ6VXNlcjE=",
-      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-      "gravatar_id": "",
-      "url": "https://api.github.com/users/octocat",
-      "html_url": "https://github.com/octocat",
-      "followers_url": "https://api.github.com/users/octocat/followers",
-      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-      "organizations_url": "https://api.github.com/users/octocat/orgs",
-      "repos_url": "https://api.github.com/users/octocat/repos",
-      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-      "received_events_url": "https://api.github.com/users/octocat/received_events",
-      "type": "User",
-      "site_admin": false
-    },
-    "private": false,
-    "html_url": "https://github.com/octocat/Hello-World",
-    "description": "This your first repo!",
-    "fork": false,
-    "url": "https://api.github.com/repos/octocat/Hello-World",
-    "archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
-    "assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
-    "blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
-    "branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
-    "collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
-    "comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
-    "commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
-    "compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
-    "contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
-    "contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
-    "deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
-    "downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
-    "events_url": "http://api.github.com/repos/octocat/Hello-World/events",
-    "forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
-    "git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
-    "git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
-    "git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
-    "git_url": "git:github.com/octocat/Hello-World.git",
-    "issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
-    "issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
-    "issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
-    "keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
-    "labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
-    "languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
-    "merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
-    "milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
-    "notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
-    "pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
-    "releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
-    "ssh_url": "git@github.com:octocat/Hello-World.git",
-    "stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
-    "statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
-    "subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
-    "subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
-    "tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
-    "teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
-    "trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}"
-  },
-  "subject": {
-    "title": "Greetings",
-    "url": "https://api.github.com/repos/octokit/octokit.rb/issues/123",
-    "latest_comment_url": "https://api.github.com/repos/octokit/octokit.rb/issues/comments/123",
-    "type": "Issue"
-  },
-  "reason": "subscribed",
-  "unread": true,
-  "updated_at": "2014-11-07T22:01:45Z",
-  "last_read_at": "2014-11-07T22:01:45Z",
-  "url": "https://api.github.com/notifications/threads/1"
-}
-
- - - -
-
-
-
- -
patch /notifications/threads/{thread_id}
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
thread_idintegerpath - - -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X PATCH \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/notifications/threads/42
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('PATCH /notifications/threads/{thread_id}', {
-  thread_id: 42
-})
-
- - - - -

Response

-
Status: 205 Reset Content
-
- - - -
-
-
-
-
-

- Get a thread subscription for the authenticated user -

-

This checks to see if the current user is subscribed to a thread. You can also get a repository subscription.

-

Note that subscriptions are only generated if a user is participating in a conversation--for example, they've replied to the thread, were @mentioned, or manually subscribe to a thread.

-
-
get /notifications/threads/{thread_id}/subscription
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
thread_idintegerpath - - -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/notifications/threads/42/subscription
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /notifications/threads/{thread_id}/subscription', {
-  thread_id: 42
-})
-
- - - - -

Default response

-
Status: 200 OK
-
{
-  "subscribed": true,
-  "ignored": false,
-  "reason": null,
-  "created_at": "2012-10-06T21:34:12Z",
-  "url": "https://api.github.com/notifications/threads/1/subscription",
-  "thread_url": "https://api.github.com/notifications/threads/1"
-}
-
- - - -
-
-
-
-
-

- Set a thread subscription -

-

If you are watching a repository, you receive notifications for all threads by default. Use this endpoint to ignore future notifications for threads until you comment on the thread or get an @mention.

-

You can also use this endpoint to subscribe to threads that you are currently not receiving notifications for or to subscribed to threads that you have previously ignored.

-

Unsubscribing from a conversation in a repository that you are not watching is functionally equivalent to the Delete a thread subscription endpoint.

-
-
put /notifications/threads/{thread_id}/subscription
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
thread_idintegerpath - - -
ignoredbooleanbody -

Unsubscribes and subscribes you to a conversation. Set ignored to true to block all notifications from this thread.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X PUT \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/notifications/threads/42/subscription \
-  -d '{"ignored":true}'
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('PUT /notifications/threads/{thread_id}/subscription', {
-  thread_id: 42,
-  ignored: true
-})
-
- - - - -

Default response

-
Status: 200 OK
-
{
-  "subscribed": true,
-  "ignored": false,
-  "reason": null,
-  "created_at": "2012-10-06T21:34:12Z",
-  "url": "https://api.github.com/notifications/threads/1/subscription",
-  "thread_url": "https://api.github.com/notifications/threads/1"
-}
-
- - - -
-
-
-
-
-

- Delete a thread subscription -

-

Mutes all future notifications for a conversation until you comment on the thread or get an @mention. If you are watching the repository of the thread, you will still receive notifications. To ignore future notifications for a repository you are watching, use the Set a thread subscription endpoint and set ignore to true.

-
-
delete /notifications/threads/{thread_id}/subscription
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
thread_idintegerpath - - -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X DELETE \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/notifications/threads/42/subscription
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('DELETE /notifications/threads/{thread_id}/subscription', {
-  thread_id: 42
-})
-
- - - - -

Default Response

-
Status: 204 No Content
-
- - - -
-
-
-
-
-

- List repository notifications for the authenticated user -

-

List all notifications for the current user.

-
-
get /repos/{owner}/{repo}/notifications
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
ownerstringpath - - -
repostringpath - - -
allbooleanquery -

If true, show notifications marked as read.

- -
participatingbooleanquery -

If true, only shows notifications in which the user is directly participating or mentioned.

- -
sincestringquery -

Only show notifications updated after the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.

- -
beforestringquery -

Only show notifications updated before the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.

- -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/repos/octocat/hello-world/notifications
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /repos/{owner}/{repo}/notifications', {
-  owner: 'octocat',
-  repo: 'hello-world'
-})
-
- - - - -

Default response

-
Status: 200 OK
-
[
-  {
-    "id": "1",
-    "repository": {
-      "id": 1296269,
-      "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
-      "name": "Hello-World",
-      "full_name": "octocat/Hello-World",
-      "owner": {
-        "login": "octocat",
-        "id": 1,
-        "node_id": "MDQ6VXNlcjE=",
-        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-        "gravatar_id": "",
-        "url": "https://api.github.com/users/octocat",
-        "html_url": "https://github.com/octocat",
-        "followers_url": "https://api.github.com/users/octocat/followers",
-        "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-        "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-        "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-        "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-        "organizations_url": "https://api.github.com/users/octocat/orgs",
-        "repos_url": "https://api.github.com/users/octocat/repos",
-        "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-        "received_events_url": "https://api.github.com/users/octocat/received_events",
-        "type": "User",
-        "site_admin": false
-      },
-      "private": false,
-      "html_url": "https://github.com/octocat/Hello-World",
-      "description": "This your first repo!",
-      "fork": false,
-      "url": "https://api.github.com/repos/octocat/Hello-World",
-      "archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
-      "assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
-      "blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
-      "branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
-      "collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
-      "comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
-      "commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
-      "compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
-      "contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
-      "contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
-      "deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
-      "downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
-      "events_url": "http://api.github.com/repos/octocat/Hello-World/events",
-      "forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
-      "git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
-      "git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
-      "git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
-      "git_url": "git:github.com/octocat/Hello-World.git",
-      "issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
-      "issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
-      "issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
-      "keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
-      "labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
-      "languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
-      "merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
-      "milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
-      "notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
-      "pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
-      "releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
-      "ssh_url": "git@github.com:octocat/Hello-World.git",
-      "stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
-      "statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
-      "subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
-      "subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
-      "tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
-      "teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
-      "trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}"
-    },
-    "subject": {
-      "title": "Greetings",
-      "url": "https://api.github.com/repos/octokit/octokit.rb/issues/123",
-      "latest_comment_url": "https://api.github.com/repos/octokit/octokit.rb/issues/comments/123",
-      "type": "Issue"
-    },
-    "reason": "subscribed",
-    "unread": true,
-    "updated_at": "2014-11-07T22:01:45Z",
-    "last_read_at": "2014-11-07T22:01:45Z",
-    "url": "https://api.github.com/notifications/threads/1"
-  }
-]
-
- - - -
-
-
-
-
-

- Mark repository notifications as read -

-

Marks all notifications in a repository as "read" removes them from the default view on GitHub. If the number of notifications is too large to complete in one request, you will receive a 202 Accepted status and GitHub will run an asynchronous process to mark notifications as "read." To check whether any "unread" notifications remain, you can use the List repository notifications for the authenticated user endpoint and pass the query parameter all=false.

-
-
put /repos/{owner}/{repo}/notifications
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
ownerstringpath - - -
repostringpath - - -
last_read_atstringbody -

Describes the last point that notifications were checked. Anything updated since this time will not be marked as read. If you omit this parameter, all notifications are marked as read. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. Default: The current timestamp.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X PUT \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/repos/octocat/hello-world/notifications \
-  -d '{"last_read_at":"last_read_at"}'
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('PUT /repos/{owner}/{repo}/notifications', {
-  owner: 'octocat',
-  repo: 'hello-world',
-  last_read_at: 'last_read_at'
-})
-
- - - - -

Response

-
Status: 205 Reset Content
-
- - - -
-
-
-

Starring

-

Repository starring is a feature that lets users bookmark repositories. Stars are shown next to repositories to show an approximate level of interest. Stars have no effect on notifications or the activity feed.

-

Starring vs. Watching

-

In August 2012, we changed the way watching -works on GitHub. Many API -client applications may be using the original "watcher" endpoints for accessing -this data. You can now start using the "star" endpoints instead (described -below). For more information, see the Watcher API Change post and the "Repository Watching API."

-

Custom media types for starring

-

There is one supported custom media type for the Starring REST API. When you use this custom media type, you will receive a response with the starred_at timestamp property that indicates the time the star was created. The response also has a second property that includes the resource that is returned when the custom media type is not included. The property that contains the resource will be either user or repo.

-
application/vnd.github.v3.star+json
-
-

For more information about media types, see "Custom media types."

-
-
-

- List stargazers -

-

Lists the people that have starred the repository.

-

You can also find out when stars were created by passing the following custom media type via the Accept header:

-
-
get /repos/{owner}/{repo}/stargazers
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
ownerstringpath - - -
repostringpath - - -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/repos/octocat/hello-world/stargazers
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /repos/{owner}/{repo}/stargazers', {
-  owner: 'octocat',
-  repo: 'hello-world'
-})
-
- - - - -

Default response

-
Status: 200 OK
-
[
-  {
-    "login": "octocat",
-    "id": 1,
-    "node_id": "MDQ6VXNlcjE=",
-    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-    "gravatar_id": "",
-    "url": "https://api.github.com/users/octocat",
-    "html_url": "https://github.com/octocat",
-    "followers_url": "https://api.github.com/users/octocat/followers",
-    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-    "organizations_url": "https://api.github.com/users/octocat/orgs",
-    "repos_url": "https://api.github.com/users/octocat/repos",
-    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-    "received_events_url": "https://api.github.com/users/octocat/received_events",
-    "type": "User",
-    "site_admin": false
-  }
-]
-
- - -

Notes

- - - -
-
-
-
-
-

- List repositories starred by the authenticated user -

-

Lists repositories the authenticated user has starred.

-

You can also find out when stars were created by passing the following custom media type via the Accept header:

-
-
get /user/starred
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
sortstringquery -

One of created (when the repository was starred) or updated (when it was last pushed to).

- -
directionstringquery -

One of asc (ascending) or desc (descending).

- -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/user/starred
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /user/starred')
-
- - - - -

Default response

-
Status: 200 OK
-
[
-  {
-    "id": 1296269,
-    "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
-    "name": "Hello-World",
-    "full_name": "octocat/Hello-World",
-    "owner": {
-      "login": "octocat",
-      "id": 1,
-      "node_id": "MDQ6VXNlcjE=",
-      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-      "gravatar_id": "",
-      "url": "https://api.github.com/users/octocat",
-      "html_url": "https://github.com/octocat",
-      "followers_url": "https://api.github.com/users/octocat/followers",
-      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-      "organizations_url": "https://api.github.com/users/octocat/orgs",
-      "repos_url": "https://api.github.com/users/octocat/repos",
-      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-      "received_events_url": "https://api.github.com/users/octocat/received_events",
-      "type": "User",
-      "site_admin": false
-    },
-    "private": false,
-    "html_url": "https://github.com/octocat/Hello-World",
-    "description": "This your first repo!",
-    "fork": false,
-    "url": "https://api.github.com/repos/octocat/Hello-World",
-    "archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
-    "assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
-    "blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
-    "branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
-    "collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
-    "comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
-    "commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
-    "compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
-    "contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
-    "contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
-    "deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
-    "downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
-    "events_url": "http://api.github.com/repos/octocat/Hello-World/events",
-    "forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
-    "git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
-    "git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
-    "git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
-    "git_url": "git:github.com/octocat/Hello-World.git",
-    "issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
-    "issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
-    "issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
-    "keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
-    "labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
-    "languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
-    "merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
-    "milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
-    "notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
-    "pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
-    "releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
-    "ssh_url": "git@github.com:octocat/Hello-World.git",
-    "stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
-    "statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
-    "subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
-    "subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
-    "tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
-    "teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
-    "trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
-    "clone_url": "https://github.com/octocat/Hello-World.git",
-    "mirror_url": "git:git.example.com/octocat/Hello-World",
-    "hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks",
-    "svn_url": "https://svn.github.com/octocat/Hello-World",
-    "homepage": "https://github.com",
-    "language": null,
-    "forks_count": 9,
-    "stargazers_count": 80,
-    "watchers_count": 80,
-    "size": 108,
-    "default_branch": "master",
-    "open_issues_count": 0,
-    "is_template": true,
-    "topics": [
-      "octocat",
-      "atom",
-      "electron",
-      "api"
-    ],
-    "has_issues": true,
-    "has_projects": true,
-    "has_wiki": true,
-    "has_pages": false,
-    "has_downloads": true,
-    "archived": false,
-    "disabled": false,
-    "visibility": "public",
-    "pushed_at": "2011-01-26T19:06:43Z",
-    "created_at": "2011-01-26T19:01:12Z",
-    "updated_at": "2011-01-26T19:14:43Z",
-    "permissions": {
-      "admin": false,
-      "push": false,
-      "pull": true
-    },
-    "allow_rebase_merge": true,
-    "template_repository": null,
-    "temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O",
-    "allow_squash_merge": true,
-    "delete_branch_on_merge": true,
-    "allow_merge_commit": true,
-    "subscribers_count": 42,
-    "network_count": 0
-  }
-]
-
- - - -
-
-
-
- -
get /user/starred/{owner}/{repo}
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
ownerstringpath - - -
repostringpath - - -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/user/starred/octocat/hello-world
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /user/starred/{owner}/{repo}', {
-  owner: 'octocat',
-  repo: 'hello-world'
-})
-
- - - - -

Response if this repository is starred by you

-
Status: 204 No Content
-
- -

Response if this repository is not starred by you

-
Status: 404 Not Found
-
- - - -
-
-
-
-
-

- Star a repository for the authenticated user -

-

Note that you'll need to set Content-Length to zero when calling out to this endpoint. For more information, see "HTTP verbs."

-
-
put /user/starred/{owner}/{repo}
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
ownerstringpath - - -
repostringpath - - -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X PUT \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/user/starred/octocat/hello-world
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('PUT /user/starred/{owner}/{repo}', {
-  owner: 'octocat',
-  repo: 'hello-world'
-})
-
- - - - -

Default Response

-
Status: 204 No Content
-
- - - -
-
-
-
- -
delete /user/starred/{owner}/{repo}
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
ownerstringpath - - -
repostringpath - - -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X DELETE \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/user/starred/octocat/hello-world
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('DELETE /user/starred/{owner}/{repo}', {
-  owner: 'octocat',
-  repo: 'hello-world'
-})
-
- - - - -

Default Response

-
Status: 204 No Content
-
- - - -
-
-
-
-
-

- List repositories starred by a user -

-

Lists repositories a user has starred.

-

You can also find out when stars were created by passing the following custom media type via the Accept header:

-
-
get /users/{username}/starred
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
usernamestringpath - - -
sortstringquery -

One of created (when the repository was starred) or updated (when it was last pushed to).

- -
directionstringquery -

One of asc (ascending) or desc (descending).

- -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/users/USERNAME/starred
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /users/{username}/starred', {
-  username: 'username'
-})
-
- - - - -

Default response

-
Status: 200 OK
-
[
-  {
-    "id": 1296269,
-    "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
-    "name": "Hello-World",
-    "full_name": "octocat/Hello-World",
-    "owner": {
-      "login": "octocat",
-      "id": 1,
-      "node_id": "MDQ6VXNlcjE=",
-      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-      "gravatar_id": "",
-      "url": "https://api.github.com/users/octocat",
-      "html_url": "https://github.com/octocat",
-      "followers_url": "https://api.github.com/users/octocat/followers",
-      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-      "organizations_url": "https://api.github.com/users/octocat/orgs",
-      "repos_url": "https://api.github.com/users/octocat/repos",
-      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-      "received_events_url": "https://api.github.com/users/octocat/received_events",
-      "type": "User",
-      "site_admin": false
-    },
-    "private": false,
-    "html_url": "https://github.com/octocat/Hello-World",
-    "description": "This your first repo!",
-    "fork": false,
-    "url": "https://api.github.com/repos/octocat/Hello-World",
-    "archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
-    "assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
-    "blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
-    "branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
-    "collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
-    "comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
-    "commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
-    "compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
-    "contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
-    "contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
-    "deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
-    "downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
-    "events_url": "http://api.github.com/repos/octocat/Hello-World/events",
-    "forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
-    "git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
-    "git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
-    "git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
-    "git_url": "git:github.com/octocat/Hello-World.git",
-    "issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
-    "issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
-    "issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
-    "keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
-    "labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
-    "languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
-    "merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
-    "milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
-    "notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
-    "pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
-    "releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
-    "ssh_url": "git@github.com:octocat/Hello-World.git",
-    "stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
-    "statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
-    "subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
-    "subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
-    "tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
-    "teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
-    "trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
-    "clone_url": "https://github.com/octocat/Hello-World.git",
-    "mirror_url": "git:git.example.com/octocat/Hello-World",
-    "hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks",
-    "svn_url": "https://svn.github.com/octocat/Hello-World",
-    "homepage": "https://github.com",
-    "language": null,
-    "forks_count": 9,
-    "stargazers_count": 80,
-    "watchers_count": 80,
-    "size": 108,
-    "default_branch": "master",
-    "open_issues_count": 0,
-    "is_template": true,
-    "topics": [
-      "octocat",
-      "atom",
-      "electron",
-      "api"
-    ],
-    "has_issues": true,
-    "has_projects": true,
-    "has_wiki": true,
-    "has_pages": false,
-    "has_downloads": true,
-    "archived": false,
-    "disabled": false,
-    "visibility": "public",
-    "pushed_at": "2011-01-26T19:06:43Z",
-    "created_at": "2011-01-26T19:01:12Z",
-    "updated_at": "2011-01-26T19:14:43Z",
-    "permissions": {
-      "admin": false,
-      "push": false,
-      "pull": true
-    },
-    "allow_rebase_merge": true,
-    "template_repository": null,
-    "temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O",
-    "allow_squash_merge": true,
-    "delete_branch_on_merge": true,
-    "allow_merge_commit": true,
-    "subscribers_count": 42,
-    "network_count": 0
-  }
-]
-
- - -

Notes

- - - -
-
-
-

Watching

-

Watching a repository registers the user to receive notifications on new discussions, as well as events in the user's activity feed. For simple repository bookmarks, see "Repository starring."

-
-
-

- List watchers -

-

Lists the people watching the specified repository.

-
-
get /repos/{owner}/{repo}/subscribers
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
ownerstringpath - - -
repostringpath - - -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/repos/octocat/hello-world/subscribers
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /repos/{owner}/{repo}/subscribers', {
-  owner: 'octocat',
-  repo: 'hello-world'
-})
-
- - - - -

Default response

-
Status: 200 OK
-
[
-  {
-    "login": "octocat",
-    "id": 1,
-    "node_id": "MDQ6VXNlcjE=",
-    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-    "gravatar_id": "",
-    "url": "https://api.github.com/users/octocat",
-    "html_url": "https://github.com/octocat",
-    "followers_url": "https://api.github.com/users/octocat/followers",
-    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-    "organizations_url": "https://api.github.com/users/octocat/orgs",
-    "repos_url": "https://api.github.com/users/octocat/repos",
-    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-    "received_events_url": "https://api.github.com/users/octocat/received_events",
-    "type": "User",
-    "site_admin": false
-  }
-]
-
- - -

Notes

- - - -
-
-
-
- -
get /repos/{owner}/{repo}/subscription
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
ownerstringpath - - -
repostringpath - - -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/repos/octocat/hello-world/subscription
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /repos/{owner}/{repo}/subscription', {
-  owner: 'octocat',
-  repo: 'hello-world'
-})
-
- - - - -

Response if you subscribe to the repository

-
Status: 200 OK
-
{
-  "subscribed": true,
-  "ignored": false,
-  "reason": null,
-  "created_at": "2012-10-06T21:34:12Z",
-  "url": "https://api.github.com/repos/octocat/example/subscription",
-  "repository_url": "https://api.github.com/repos/octocat/example"
-}
-
- -

Response if you don t subscribe to the repository

-
Status: 404 Not Found
-
- - - -
-
-
-
-
-

- Set a repository subscription -

-

If you would like to watch a repository, set subscribed to true. If you would like to ignore notifications made within a repository, set ignored to true. If you would like to stop watching a repository, delete the repository's subscription completely.

-
-
put /repos/{owner}/{repo}/subscription
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
ownerstringpath - - -
repostringpath - - -
subscribedbooleanbody -

Determines if notifications should be received from this repository.

- -
ignoredbooleanbody -

Determines if all notifications should be blocked from this repository.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X PUT \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/repos/octocat/hello-world/subscription \
-  -d '{"subscribed":true}'
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('PUT /repos/{owner}/{repo}/subscription', {
-  owner: 'octocat',
-  repo: 'hello-world',
-  subscribed: true
-})
-
- - - - -

Default response

-
Status: 200 OK
-
{
-  "subscribed": true,
-  "ignored": false,
-  "reason": null,
-  "created_at": "2012-10-06T21:34:12Z",
-  "url": "https://api.github.com/repos/octocat/example/subscription",
-  "repository_url": "https://api.github.com/repos/octocat/example"
-}
-
- - - -
-
-
-
-
-

- Delete a repository subscription -

-

This endpoint should only be used to stop watching a repository. To control whether or not you wish to receive notifications from a repository, set the repository's subscription manually.

-
-
delete /repos/{owner}/{repo}/subscription
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
ownerstringpath - - -
repostringpath - - -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X DELETE \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/repos/octocat/hello-world/subscription
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('DELETE /repos/{owner}/{repo}/subscription', {
-  owner: 'octocat',
-  repo: 'hello-world'
-})
-
- - - - -

Default Response

-
Status: 204 No Content
-
- - - -
-
-
-
-
-

- List repositories watched by the authenticated user -

-

Lists repositories the authenticated user is watching.

-
-
get /user/subscriptions
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/user/subscriptions
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /user/subscriptions')
-
- - - - -

Default response

-
Status: 200 OK
-
[
-  {
-    "id": 1296269,
-    "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
-    "name": "Hello-World",
-    "full_name": "octocat/Hello-World",
-    "owner": {
-      "login": "octocat",
-      "id": 1,
-      "node_id": "MDQ6VXNlcjE=",
-      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-      "gravatar_id": "",
-      "url": "https://api.github.com/users/octocat",
-      "html_url": "https://github.com/octocat",
-      "followers_url": "https://api.github.com/users/octocat/followers",
-      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-      "organizations_url": "https://api.github.com/users/octocat/orgs",
-      "repos_url": "https://api.github.com/users/octocat/repos",
-      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-      "received_events_url": "https://api.github.com/users/octocat/received_events",
-      "type": "User",
-      "site_admin": false
-    },
-    "private": false,
-    "html_url": "https://github.com/octocat/Hello-World",
-    "description": "This your first repo!",
-    "fork": false,
-    "url": "https://api.github.com/repos/octocat/Hello-World",
-    "archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
-    "assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
-    "blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
-    "branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
-    "collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
-    "comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
-    "commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
-    "compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
-    "contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
-    "contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
-    "deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
-    "downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
-    "events_url": "http://api.github.com/repos/octocat/Hello-World/events",
-    "forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
-    "git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
-    "git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
-    "git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
-    "git_url": "git:github.com/octocat/Hello-World.git",
-    "issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
-    "issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
-    "issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
-    "keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
-    "labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
-    "languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
-    "merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
-    "milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
-    "notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
-    "pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
-    "releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
-    "ssh_url": "git@github.com:octocat/Hello-World.git",
-    "stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
-    "statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
-    "subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
-    "subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
-    "tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
-    "teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
-    "trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
-    "clone_url": "https://github.com/octocat/Hello-World.git",
-    "mirror_url": "git:git.example.com/octocat/Hello-World",
-    "hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks",
-    "svn_url": "https://svn.github.com/octocat/Hello-World",
-    "homepage": "https://github.com",
-    "language": null,
-    "forks_count": 9,
-    "stargazers_count": 80,
-    "watchers_count": 80,
-    "size": 108,
-    "default_branch": "master",
-    "open_issues_count": 0,
-    "is_template": true,
-    "topics": [
-      "octocat",
-      "atom",
-      "electron",
-      "api"
-    ],
-    "has_issues": true,
-    "has_projects": true,
-    "has_wiki": true,
-    "has_pages": false,
-    "has_downloads": true,
-    "archived": false,
-    "disabled": false,
-    "visibility": "public",
-    "pushed_at": "2011-01-26T19:06:43Z",
-    "created_at": "2011-01-26T19:01:12Z",
-    "updated_at": "2011-01-26T19:14:43Z",
-    "permissions": {
-      "admin": false,
-      "push": false,
-      "pull": true
-    },
-    "template_repository": null,
-    "temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O",
-    "delete_branch_on_merge": true,
-    "subscribers_count": 42,
-    "network_count": 0,
-    "license": {
-      "key": "mit",
-      "name": "MIT License",
-      "spdx_id": "MIT",
-      "url": "https://api.github.com/licenses/mit",
-      "node_id": "MDc6TGljZW5zZW1pdA=="
-    }
-  }
-]
-
- - - -
-
-
-
-
-

- List repositories watched by a user -

-

Lists repositories a user is watching.

-
-
get /users/{username}/subscriptions
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

Setting to application/vnd.github.v3+json is recommended

- -
usernamestringpath - - -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.v3+json" \
-  https://api.github.com/users/USERNAME/subscriptions
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /users/{username}/subscriptions', {
-  username: 'username'
-})
-
- - - - -

Default response

-
Status: 200 OK
-
[
-  {
-    "id": 1296269,
-    "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
-    "name": "Hello-World",
-    "full_name": "octocat/Hello-World",
-    "owner": {
-      "login": "octocat",
-      "id": 1,
-      "node_id": "MDQ6VXNlcjE=",
-      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-      "gravatar_id": "",
-      "url": "https://api.github.com/users/octocat",
-      "html_url": "https://github.com/octocat",
-      "followers_url": "https://api.github.com/users/octocat/followers",
-      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-      "organizations_url": "https://api.github.com/users/octocat/orgs",
-      "repos_url": "https://api.github.com/users/octocat/repos",
-      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-      "received_events_url": "https://api.github.com/users/octocat/received_events",
-      "type": "User",
-      "site_admin": false
-    },
-    "private": false,
-    "html_url": "https://github.com/octocat/Hello-World",
-    "description": "This your first repo!",
-    "fork": false,
-    "url": "https://api.github.com/repos/octocat/Hello-World",
-    "archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
-    "assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
-    "blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
-    "branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
-    "collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
-    "comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
-    "commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
-    "compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
-    "contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
-    "contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
-    "deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
-    "downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
-    "events_url": "http://api.github.com/repos/octocat/Hello-World/events",
-    "forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
-    "git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
-    "git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
-    "git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
-    "git_url": "git:github.com/octocat/Hello-World.git",
-    "issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
-    "issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
-    "issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
-    "keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
-    "labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
-    "languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
-    "merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
-    "milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
-    "notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
-    "pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
-    "releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
-    "ssh_url": "git@github.com:octocat/Hello-World.git",
-    "stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
-    "statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
-    "subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
-    "subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
-    "tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
-    "teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
-    "trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
-    "clone_url": "https://github.com/octocat/Hello-World.git",
-    "mirror_url": "git:git.example.com/octocat/Hello-World",
-    "hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks",
-    "svn_url": "https://svn.github.com/octocat/Hello-World",
-    "homepage": "https://github.com",
-    "language": null,
-    "forks_count": 9,
-    "stargazers_count": 80,
-    "watchers_count": 80,
-    "size": 108,
-    "default_branch": "master",
-    "open_issues_count": 0,
-    "is_template": true,
-    "topics": [
-      "octocat",
-      "atom",
-      "electron",
-      "api"
-    ],
-    "has_issues": true,
-    "has_projects": true,
-    "has_wiki": true,
-    "has_pages": false,
-    "has_downloads": true,
-    "archived": false,
-    "disabled": false,
-    "visibility": "public",
-    "pushed_at": "2011-01-26T19:06:43Z",
-    "created_at": "2011-01-26T19:01:12Z",
-    "updated_at": "2011-01-26T19:14:43Z",
-    "permissions": {
-      "admin": false,
-      "push": false,
-      "pull": true
-    },
-    "template_repository": null,
-    "temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O",
-    "delete_branch_on_merge": true,
-    "subscribers_count": 42,
-    "network_count": 0,
-    "license": {
-      "key": "mit",
-      "name": "MIT License",
-      "spdx_id": "MIT",
-      "url": "https://api.github.com/licenses/mit",
-      "node_id": "MDc6TGljZW5zZW1pdA=="
-    }
-  }
-]
-
- - -

Notes

- - - -
-
-
-
-
-
-
- -
-

- Did this doc help you? -

-

- - - - -

- - - - - -

- - -

- - -
- -
-
- - - -
-
-
-
-

Ask a human

-

Can't find what you're looking for?

- Contact us -
-
- -
-
-
-
- - - - - -
- - diff --git a/update-urls/testdata/activity_events-original.go b/update-urls/testdata/activity_events-original.go deleted file mode 100644 index eec0f956de7..00000000000 --- a/update-urls/testdata/activity_events-original.go +++ /dev/null @@ -1,196 +0,0 @@ -// Copyright 2013 The go-github AUTHORS. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package github - -import ( - "context" - "fmt" -) - -// ListEvents drinks from the firehose of all public events across GitHub. -// -// GitHub API docs: https://docs.github.com/en/rest/activity/events/#list-public-events -func (s *ActivityService) ListEvents(ctx context.Context, opts *ListOptions) ([]*Event, *Response, error) { - u, err := addOptions("events", opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var events []*Event - resp, err := s.client.Do(ctx, req, &events) - if err != nil { - return nil, resp, err - } - - return events, resp, nil -} - -// ListRepositoryEvents lists events for a repository. -// -// GitHub API docs: https://docs.github.com/en/rest/activity/events/#list-repository-events -func (s *ActivityService) ListRepositoryEvents(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Event, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/events", owner, repo) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var events []*Event - resp, err := s.client.Do(ctx, req, &events) - if err != nil { - return nil, resp, err - } - - return events, resp, nil -} - -// Note that ActivityService.ListIssueEventsForRepository was moved to: -// IssuesService.ListRepositoryEvents. - -// ListEventsForRepoNetwork lists public events for a network of repositories. -// -// GitHub API docs: https://docs.github.com/en/rest/activity/events/#list-public-events-for-a-network-of-repositories -func (s *ActivityService) ListEventsForRepoNetwork(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Event, *Response, error) { - u := fmt.Sprintf("networks/%v/%v/events", owner, repo) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var events []*Event - resp, err := s.client.Do(ctx, req, &events) - if err != nil { - return nil, resp, err - } - - return events, resp, nil -} - -// ListEventsForOrganization lists public events for an organization. -// -// GitHub API docs: https://docs.github.com/en/rest/activity/events/#list-public-events-for-an-organization -func (s *ActivityService) ListEventsForOrganization(ctx context.Context, org string, opts *ListOptions) ([]*Event, *Response, error) { - u := fmt.Sprintf("orgs/%v/events", org) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var events []*Event - resp, err := s.client.Do(ctx, req, &events) - if err != nil { - return nil, resp, err - } - - return events, resp, nil -} - -// ListEventsPerformedByUser lists the events performed by a user. If publicOnly is -// true, only public events will be returned. -// -// GitHub API docs: https://docs.github.com/en/rest/activity/events/#list-events-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/rest/activity/events/#list-public-events-for-a-user -func (s *ActivityService) ListEventsPerformedByUser(ctx context.Context, user string, publicOnly bool, opts *ListOptions) ([]*Event, *Response, error) { - var u string - if publicOnly { - u = fmt.Sprintf("users/%v/events/public", user) - } else { - u = fmt.Sprintf("users/%v/events", user) - } - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var events []*Event - resp, err := s.client.Do(ctx, req, &events) - if err != nil { - return nil, resp, err - } - - return events, resp, nil -} - -// ListEventsReceivedByUser lists the events received by a user. If publicOnly is -// true, only public events will be returned. -// -// GitHub API docs: https://docs.github.com/en/rest/activity/events/#list-events-received-by-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/rest/activity/events/#list-public-events-received-by-a-user -func (s *ActivityService) ListEventsReceivedByUser(ctx context.Context, user string, publicOnly bool, opts *ListOptions) ([]*Event, *Response, error) { - var u string - if publicOnly { - u = fmt.Sprintf("users/%v/received_events/public", user) - } else { - u = fmt.Sprintf("users/%v/received_events", user) - } - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var events []*Event - resp, err := s.client.Do(ctx, req, &events) - if err != nil { - return nil, resp, err - } - - return events, resp, nil -} - -// ListUserEventsForOrganization provides the user’s organization dashboard. You -// must be authenticated as the user to view this. -// -// GitHub API docs: https://docs.github.com/en/rest/activity/events/#list-events-for-an-organization -func (s *ActivityService) ListUserEventsForOrganization(ctx context.Context, org, user string, opts *ListOptions) ([]*Event, *Response, error) { - u := fmt.Sprintf("users/%v/events/orgs/%v", user, org) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var events []*Event - resp, err := s.client.Do(ctx, req, &events) - if err != nil { - return nil, resp, err - } - - return events, resp, nil -} diff --git a/update-urls/testdata/activity_events-want.go b/update-urls/testdata/activity_events-want.go deleted file mode 100644 index 760793e6985..00000000000 --- a/update-urls/testdata/activity_events-want.go +++ /dev/null @@ -1,196 +0,0 @@ -// Copyright 2013 The go-github AUTHORS. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package github - -import ( - "context" - "fmt" -) - -// ListEvents drinks from the firehose of all public events across GitHub. -// -// GitHub API docs: https://docs.github.com/en/rest/activity/events/#list-public-events -func (s *ActivityService) ListEvents(ctx context.Context, opts *ListOptions) ([]*Event, *Response, error) { - u, err := addOptions("events", opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var events []*Event - resp, err := s.client.Do(ctx, req, &events) - if err != nil { - return nil, resp, err - } - - return events, resp, nil -} - -// ListRepositoryEvents lists events for a repository. -// -// GitHub API docs: https://docs.github.com/en/rest/activity/events/#list-repository-events -func (s *ActivityService) ListRepositoryEvents(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Event, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/events", owner, repo) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var events []*Event - resp, err := s.client.Do(ctx, req, &events) - if err != nil { - return nil, resp, err - } - - return events, resp, nil -} - -// Note that ActivityService.ListIssueEventsForRepository was moved to: -// IssuesService.ListRepositoryEvents. - -// ListEventsForRepoNetwork lists public events for a network of repositories. -// -// GitHub API docs: https://docs.github.com/en/rest/activity/events/#list-public-events-for-a-network-of-repositories -func (s *ActivityService) ListEventsForRepoNetwork(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Event, *Response, error) { - u := fmt.Sprintf("networks/%v/%v/events", owner, repo) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var events []*Event - resp, err := s.client.Do(ctx, req, &events) - if err != nil { - return nil, resp, err - } - - return events, resp, nil -} - -// ListEventsForOrganization lists public events for an organization. -// -// GitHub API docs: https://docs.github.com/en/rest/activity/events/#list-public-organization-events -func (s *ActivityService) ListEventsForOrganization(ctx context.Context, org string, opts *ListOptions) ([]*Event, *Response, error) { - u := fmt.Sprintf("orgs/%v/events", org) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var events []*Event - resp, err := s.client.Do(ctx, req, &events) - if err != nil { - return nil, resp, err - } - - return events, resp, nil -} - -// ListEventsPerformedByUser lists the events performed by a user. If publicOnly is -// true, only public events will be returned. -// -// GitHub API docs: https://docs.github.com/en/rest/activity/events/#list-events-for-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/rest/activity/events/#list-public-events-for-a-user -func (s *ActivityService) ListEventsPerformedByUser(ctx context.Context, user string, publicOnly bool, opts *ListOptions) ([]*Event, *Response, error) { - var u string - if publicOnly { - u = fmt.Sprintf("users/%v/events/public", user) - } else { - u = fmt.Sprintf("users/%v/events", user) - } - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var events []*Event - resp, err := s.client.Do(ctx, req, &events) - if err != nil { - return nil, resp, err - } - - return events, resp, nil -} - -// ListEventsReceivedByUser lists the events received by a user. If publicOnly is -// true, only public events will be returned. -// -// GitHub API docs: https://docs.github.com/en/rest/activity/events/#list-events-received-by-the-authenticated-user -// GitHub API docs: https://docs.github.com/en/rest/activity/events/#list-public-events-received-by-a-user -func (s *ActivityService) ListEventsReceivedByUser(ctx context.Context, user string, publicOnly bool, opts *ListOptions) ([]*Event, *Response, error) { - var u string - if publicOnly { - u = fmt.Sprintf("users/%v/received_events/public", user) - } else { - u = fmt.Sprintf("users/%v/received_events", user) - } - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var events []*Event - resp, err := s.client.Do(ctx, req, &events) - if err != nil { - return nil, resp, err - } - - return events, resp, nil -} - -// ListUserEventsForOrganization provides the user’s organization dashboard. You -// must be authenticated as the user to view this. -// -// GitHub API docs: https://docs.github.com/en/rest/activity/events/#list-organization-events-for-the-authenticated-user -func (s *ActivityService) ListUserEventsForOrganization(ctx context.Context, org, user string, opts *ListOptions) ([]*Event, *Response, error) { - u := fmt.Sprintf("users/%v/events/orgs/%v", user, org) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - var events []*Event - resp, err := s.client.Do(ctx, req, &events) - if err != nil { - return nil, resp, err - } - - return events, resp, nil -} diff --git a/update-urls/testdata/reactions-original.go b/update-urls/testdata/reactions-original.go deleted file mode 100644 index d3e57bdb819..00000000000 --- a/update-urls/testdata/reactions-original.go +++ /dev/null @@ -1,490 +0,0 @@ -// Copyright 2016 The go-github AUTHORS. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package github - -import ( - "context" - "fmt" - "net/http" -) - -// ReactionsService provides access to the reactions-related functions in the -// GitHub API. -type ReactionsService service - -// Reaction represents a GitHub reaction. -type Reaction struct { - // ID is the Reaction ID. - ID *int64 `json:"id,omitempty"` - User *User `json:"user,omitempty"` - NodeID *string `json:"node_id,omitempty"` - // Content is the type of reaction. - // Possible values are: - // "+1", "-1", "laugh", "confused", "heart", "hooray". - Content *string `json:"content,omitempty"` -} - -// Reactions represents a summary of GitHub reactions. -type Reactions struct { - TotalCount *int `json:"total_count,omitempty"` - PlusOne *int `json:"+1,omitempty"` - MinusOne *int `json:"-1,omitempty"` - Laugh *int `json:"laugh,omitempty"` - Confused *int `json:"confused,omitempty"` - Heart *int `json:"heart,omitempty"` - Hooray *int `json:"hooray,omitempty"` - URL *string `json:"url,omitempty"` -} - -func (r Reaction) String() string { - return Stringify(r) -} - -// ListCommentReactionOptions specifies the optional parameters to the -// ReactionsService.ListCommentReactions method. -type ListCommentReactionOptions struct { - // Content restricts the returned comment reactions to only those with the given type. - // Omit this parameter to list all reactions to a commit comment. - // Possible values are: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes". - Content string `url:"content,omitempty"` - - ListOptions -} - -// ListCommentReactions lists the reactions for a commit comment. -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#list-reactions-for-a-commit-comment -func (s *ReactionsService) ListCommentReactions(ctx context.Context, owner, repo string, id int64, opts *ListCommentReactionOptions) ([]*Reaction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions", owner, repo, id) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - var m []*Reaction - resp, err := s.client.Do(ctx, req, &m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// CreateCommentReaction creates a reaction for a commit comment. -// Note that if you have already created a reaction of type content, the -// previously created reaction will be returned with Status: 200 OK. -// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#create-reaction-for-a-commit-comment -func (s *ReactionsService) CreateCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions", owner, repo, id) - - body := &Reaction{Content: String(content)} - req, err := s.client.NewRequest("POST", u, body) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - m := &Reaction{} - resp, err := s.client.Do(ctx, req, m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// DeleteCommentReaction deletes the reaction for a commit comment. -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-a-commit-comment-reaction -func (s *ReactionsService) DeleteCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions/%v", owner, repo, commentID, reactionID) - - return s.deleteReaction(ctx, u) -} - -// DeleteCommentReactionByID deletes the reaction for a commit comment by repository ID. -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-a-commit-comment-reaction -func (s *ReactionsService) DeleteCommentReactionByID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) { - u := fmt.Sprintf("repositories/%v/comments/%v/reactions/%v", repoID, commentID, reactionID) - - return s.deleteReaction(ctx, u) -} - -// ListIssueReactions lists the reactions for an issue. -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#list-reactions-for-an-issue -func (s *ReactionsService) ListIssueReactions(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*Reaction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%v/reactions", owner, repo, number) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - var m []*Reaction - resp, err := s.client.Do(ctx, req, &m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// CreateIssueReaction creates a reaction for an issue. -// Note that if you have already created a reaction of type content, the -// previously created reaction will be returned with Status: 200 OK. -// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#create-reaction-for-an-issue -func (s *ReactionsService) CreateIssueReaction(ctx context.Context, owner, repo string, number int, content string) (*Reaction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%v/reactions", owner, repo, number) - - body := &Reaction{Content: String(content)} - req, err := s.client.NewRequest("POST", u, body) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - m := &Reaction{} - resp, err := s.client.Do(ctx, req, m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// DeleteIssueReaction deletes the reaction to an issue. -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-an-issue-reaction -func (s *ReactionsService) DeleteIssueReaction(ctx context.Context, owner, repo string, issueNumber int, reactionID int64) (*Response, error) { - url := fmt.Sprintf("repos/%v/%v/issues/%v/reactions/%v", owner, repo, issueNumber, reactionID) - - return s.deleteReaction(ctx, url) -} - -// DeleteIssueReactionByID deletes the reaction to an issue by repository ID. -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-an-issue-reaction -func (s *ReactionsService) DeleteIssueReactionByID(ctx context.Context, repoID, issueNumber int, reactionID int64) (*Response, error) { - url := fmt.Sprintf("repositories/%v/issues/%v/reactions/%v", repoID, issueNumber, reactionID) - - return s.deleteReaction(ctx, url) -} - -// ListIssueCommentReactions lists the reactions for an issue comment. -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#list-reactions-for-an-issue-comment -func (s *ReactionsService) ListIssueCommentReactions(ctx context.Context, owner, repo string, id int64, opts *ListOptions) ([]*Reaction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions", owner, repo, id) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - var m []*Reaction - resp, err := s.client.Do(ctx, req, &m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// CreateIssueCommentReaction creates a reaction for an issue comment. -// Note that if you have already created a reaction of type content, the -// previously created reaction will be returned with Status: 200 OK. -// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#create-reaction-for-an-issue-comment -func (s *ReactionsService) CreateIssueCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions", owner, repo, id) - - body := &Reaction{Content: String(content)} - req, err := s.client.NewRequest("POST", u, body) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - m := &Reaction{} - resp, err := s.client.Do(ctx, req, m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// DeleteIssueCommentReaction deletes the reaction to an issue comment. -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-an-issue-comment-reaction -func (s *ReactionsService) DeleteIssueCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) { - url := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions/%v", owner, repo, commentID, reactionID) - - return s.deleteReaction(ctx, url) -} - -// DeleteIssueCommentReactionByID deletes the reaction to an issue comment by repository ID. -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-an-issue-comment-reaction -func (s *ReactionsService) DeleteIssueCommentReactionByID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) { - url := fmt.Sprintf("repositories/%v/issues/comments/%v/reactions/%v", repoID, commentID, reactionID) - - return s.deleteReaction(ctx, url) -} - -// ListPullRequestCommentReactions lists the reactions for a pull request review comment. -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#list-reactions-for-an-issue-comment -func (s *ReactionsService) ListPullRequestCommentReactions(ctx context.Context, owner, repo string, id int64, opts *ListOptions) ([]*Reaction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions", owner, repo, id) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - var m []*Reaction - resp, err := s.client.Do(ctx, req, &m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// CreatePullRequestCommentReaction creates a reaction for a pull request review comment. -// Note that if you have already created a reaction of type content, the -// previously created reaction will be returned with Status: 200 OK. -// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#create-reaction-for-an-issue-comment -func (s *ReactionsService) CreatePullRequestCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions", owner, repo, id) - - body := &Reaction{Content: String(content)} - req, err := s.client.NewRequest("POST", u, body) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - m := &Reaction{} - resp, err := s.client.Do(ctx, req, m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// DeletePullRequestCommentReaction deletes the reaction to a pull request review comment. -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-a-pull-request-comment-reaction -func (s *ReactionsService) DeletePullRequestCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) { - url := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions/%v", owner, repo, commentID, reactionID) - - return s.deleteReaction(ctx, url) -} - -// DeletePullRequestCommentReactionByID deletes the reaction to a pull request review comment by repository ID. -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-a-pull-request-comment-reaction -func (s *ReactionsService) DeletePullRequestCommentReactionByID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) { - url := fmt.Sprintf("repositories/%v/pulls/comments/%v/reactions/%v", repoID, commentID, reactionID) - - return s.deleteReaction(ctx, url) -} - -// ListTeamDiscussionReactions lists the reactions for a team discussion. -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#list-reactions-for-a-team-discussion -func (s *ReactionsService) ListTeamDiscussionReactions(ctx context.Context, teamID int64, discussionNumber int, opts *ListOptions) ([]*Reaction, *Response, error) { - u := fmt.Sprintf("teams/%v/discussions/%v/reactions", teamID, discussionNumber) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - req.Header.Set("Accept", mediaTypeReactionsPreview) - - var m []*Reaction - resp, err := s.client.Do(ctx, req, &m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// CreateTeamDiscussionReaction creates a reaction for a team discussion. -// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#create-reaction-for-a-team-discussion -func (s *ReactionsService) CreateTeamDiscussionReaction(ctx context.Context, teamID int64, discussionNumber int, content string) (*Reaction, *Response, error) { - u := fmt.Sprintf("teams/%v/discussions/%v/reactions", teamID, discussionNumber) - - body := &Reaction{Content: String(content)} - req, err := s.client.NewRequest("POST", u, body) - if err != nil { - return nil, nil, err - } - - req.Header.Set("Accept", mediaTypeReactionsPreview) - - m := &Reaction{} - resp, err := s.client.Do(ctx, req, m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// DeleteTeamDiscussionReaction deletes the reaction to a team discussion. -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-team-discussion-reaction -func (s *ReactionsService) DeleteTeamDiscussionReaction(ctx context.Context, org, teamSlug string, discussionNumber int, reactionID int64) (*Response, error) { - url := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/reactions/%v", org, teamSlug, discussionNumber, reactionID) - - return s.deleteReaction(ctx, url) -} - -// DeleteTeamDiscussionReactionByOrgIDAndTeamID deletes the reaction to a team discussion by organization ID and team ID. -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-team-discussion-reaction -func (s *ReactionsService) DeleteTeamDiscussionReactionByOrgIDAndTeamID(ctx context.Context, orgID, teamID, discussionNumber int, reactionID int64) (*Response, error) { - url := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/reactions/%v", orgID, teamID, discussionNumber, reactionID) - - return s.deleteReaction(ctx, url) -} - -// ListTeamDiscussionCommentReactions lists the reactions for a team discussion comment. -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#list-reactions-for-a-team-discussion-comment -func (s *ReactionsService) ListTeamDiscussionCommentReactions(ctx context.Context, teamID int64, discussionNumber, commentNumber int, opts *ListOptions) ([]*Reaction, *Response, error) { - u := fmt.Sprintf("teams/%v/discussions/%v/comments/%v/reactions", teamID, discussionNumber, commentNumber) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - req.Header.Set("Accept", mediaTypeReactionsPreview) - - var m []*Reaction - resp, err := s.client.Do(ctx, req, &m) - if err != nil { - return nil, nil, err - } - return m, resp, nil -} - -// CreateTeamDiscussionCommentReaction creates a reaction for a team discussion comment. -// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#create-reaction-for-a-team-discussion-comment -func (s *ReactionsService) CreateTeamDiscussionCommentReaction(ctx context.Context, teamID int64, discussionNumber, commentNumber int, content string) (*Reaction, *Response, error) { - u := fmt.Sprintf("teams/%v/discussions/%v/comments/%v/reactions", teamID, discussionNumber, commentNumber) - - body := &Reaction{Content: String(content)} - req, err := s.client.NewRequest("POST", u, body) - if err != nil { - return nil, nil, err - } - - req.Header.Set("Accept", mediaTypeReactionsPreview) - - m := &Reaction{} - resp, err := s.client.Do(ctx, req, m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// DeleteTeamDiscussionCommentReaction deletes the reaction to a team discussion comment. -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-team-discussion-comment-reaction -func (s *ReactionsService) DeleteTeamDiscussionCommentReaction(ctx context.Context, org, teamSlug string, discussionNumber, commentNumber int, reactionID int64) (*Response, error) { - url := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments/%v/reactions/%v", org, teamSlug, discussionNumber, commentNumber, reactionID) - - return s.deleteReaction(ctx, url) -} - -// DeleteTeamDiscussionCommentReactionByOrgIDAndTeamID deletes the reaction to a team discussion comment by organization ID and team ID. -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-team-discussion-comment-reaction -func (s *ReactionsService) DeleteTeamDiscussionCommentReactionByOrgIDAndTeamID(ctx context.Context, orgID, teamID, discussionNumber, commentNumber int, reactionID int64) (*Response, error) { - url := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments/%v/reactions/%v", orgID, teamID, discussionNumber, commentNumber, reactionID) - - return s.deleteReaction(ctx, url) -} - -func (s *ReactionsService) deleteReaction(ctx context.Context, url string) (*Response, error) { - req, err := s.client.NewRequest(http.MethodDelete, url, nil) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - return s.client.Do(ctx, req, nil) -} diff --git a/update-urls/testdata/reactions-want.go b/update-urls/testdata/reactions-want.go deleted file mode 100644 index 4e70c458706..00000000000 --- a/update-urls/testdata/reactions-want.go +++ /dev/null @@ -1,490 +0,0 @@ -// Copyright 2016 The go-github AUTHORS. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package github - -import ( - "context" - "fmt" - "net/http" -) - -// ReactionsService provides access to the reactions-related functions in the -// GitHub API. -type ReactionsService service - -// Reaction represents a GitHub reaction. -type Reaction struct { - // ID is the Reaction ID. - ID *int64 `json:"id,omitempty"` - User *User `json:"user,omitempty"` - NodeID *string `json:"node_id,omitempty"` - // Content is the type of reaction. - // Possible values are: - // "+1", "-1", "laugh", "confused", "heart", "hooray". - Content *string `json:"content,omitempty"` -} - -// Reactions represents a summary of GitHub reactions. -type Reactions struct { - TotalCount *int `json:"total_count,omitempty"` - PlusOne *int `json:"+1,omitempty"` - MinusOne *int `json:"-1,omitempty"` - Laugh *int `json:"laugh,omitempty"` - Confused *int `json:"confused,omitempty"` - Heart *int `json:"heart,omitempty"` - Hooray *int `json:"hooray,omitempty"` - URL *string `json:"url,omitempty"` -} - -func (r Reaction) String() string { - return Stringify(r) -} - -// ListCommentReactionOptions specifies the optional parameters to the -// ReactionsService.ListCommentReactions method. -type ListCommentReactionOptions struct { - // Content restricts the returned comment reactions to only those with the given type. - // Omit this parameter to list all reactions to a commit comment. - // Possible values are: "+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", or "eyes". - Content string `url:"content,omitempty"` - - ListOptions -} - -// ListCommentReactions lists the reactions for a commit comment. -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#list-reactions-for-a-commit-comment -func (s *ReactionsService) ListCommentReactions(ctx context.Context, owner, repo string, id int64, opts *ListCommentReactionOptions) ([]*Reaction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions", owner, repo, id) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - var m []*Reaction - resp, err := s.client.Do(ctx, req, &m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// CreateCommentReaction creates a reaction for a commit comment. -// Note that if you have already created a reaction of type content, the -// previously created reaction will be returned with Status: 200 OK. -// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#create-reaction-for-a-commit-comment -func (s *ReactionsService) CreateCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions", owner, repo, id) - - body := &Reaction{Content: String(content)} - req, err := s.client.NewRequest("POST", u, body) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - m := &Reaction{} - resp, err := s.client.Do(ctx, req, m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// DeleteCommentReaction deletes the reaction for a commit comment. -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-a-commit-comment-reaction -func (s *ReactionsService) DeleteCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) { - u := fmt.Sprintf("repos/%v/%v/comments/%v/reactions/%v", owner, repo, commentID, reactionID) - - return s.deleteReaction(ctx, u) -} - -// DeleteCommentReactionByID deletes the reaction for a commit comment by repository ID. -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-a-commit-comment-reaction -func (s *ReactionsService) DeleteCommentReactionByID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) { - u := fmt.Sprintf("repositories/%v/comments/%v/reactions/%v", repoID, commentID, reactionID) - - return s.deleteReaction(ctx, u) -} - -// ListIssueReactions lists the reactions for an issue. -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#list-reactions-for-an-issue -func (s *ReactionsService) ListIssueReactions(ctx context.Context, owner, repo string, number int, opts *ListOptions) ([]*Reaction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%v/reactions", owner, repo, number) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - var m []*Reaction - resp, err := s.client.Do(ctx, req, &m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// CreateIssueReaction creates a reaction for an issue. -// Note that if you have already created a reaction of type content, the -// previously created reaction will be returned with Status: 200 OK. -// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#create-reaction-for-an-issue -func (s *ReactionsService) CreateIssueReaction(ctx context.Context, owner, repo string, number int, content string) (*Reaction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/%v/reactions", owner, repo, number) - - body := &Reaction{Content: String(content)} - req, err := s.client.NewRequest("POST", u, body) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - m := &Reaction{} - resp, err := s.client.Do(ctx, req, m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// DeleteIssueReaction deletes the reaction to an issue. -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-an-issue-reaction -func (s *ReactionsService) DeleteIssueReaction(ctx context.Context, owner, repo string, issueNumber int, reactionID int64) (*Response, error) { - url := fmt.Sprintf("repos/%v/%v/issues/%v/reactions/%v", owner, repo, issueNumber, reactionID) - - return s.deleteReaction(ctx, url) -} - -// DeleteIssueReactionByID deletes the reaction to an issue by repository ID. -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-an-issue-reaction -func (s *ReactionsService) DeleteIssueReactionByID(ctx context.Context, repoID, issueNumber int, reactionID int64) (*Response, error) { - url := fmt.Sprintf("repositories/%v/issues/%v/reactions/%v", repoID, issueNumber, reactionID) - - return s.deleteReaction(ctx, url) -} - -// ListIssueCommentReactions lists the reactions for an issue comment. -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#list-reactions-for-an-issue-comment -func (s *ReactionsService) ListIssueCommentReactions(ctx context.Context, owner, repo string, id int64, opts *ListOptions) ([]*Reaction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions", owner, repo, id) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - var m []*Reaction - resp, err := s.client.Do(ctx, req, &m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// CreateIssueCommentReaction creates a reaction for an issue comment. -// Note that if you have already created a reaction of type content, the -// previously created reaction will be returned with Status: 200 OK. -// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#create-reaction-for-an-issue-comment -func (s *ReactionsService) CreateIssueCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions", owner, repo, id) - - body := &Reaction{Content: String(content)} - req, err := s.client.NewRequest("POST", u, body) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - m := &Reaction{} - resp, err := s.client.Do(ctx, req, m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// DeleteIssueCommentReaction deletes the reaction to an issue comment. -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-an-issue-comment-reaction -func (s *ReactionsService) DeleteIssueCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) { - url := fmt.Sprintf("repos/%v/%v/issues/comments/%v/reactions/%v", owner, repo, commentID, reactionID) - - return s.deleteReaction(ctx, url) -} - -// DeleteIssueCommentReactionByID deletes the reaction to an issue comment by repository ID. -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-an-issue-comment-reaction -func (s *ReactionsService) DeleteIssueCommentReactionByID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) { - url := fmt.Sprintf("repositories/%v/issues/comments/%v/reactions/%v", repoID, commentID, reactionID) - - return s.deleteReaction(ctx, url) -} - -// ListPullRequestCommentReactions lists the reactions for a pull request review comment. -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#list-reactions-for-a-pull-request-review-comment -func (s *ReactionsService) ListPullRequestCommentReactions(ctx context.Context, owner, repo string, id int64, opts *ListOptions) ([]*Reaction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions", owner, repo, id) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - var m []*Reaction - resp, err := s.client.Do(ctx, req, &m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// CreatePullRequestCommentReaction creates a reaction for a pull request review comment. -// Note that if you have already created a reaction of type content, the -// previously created reaction will be returned with Status: 200 OK. -// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#create-reaction-for-a-pull-request-review-comment -func (s *ReactionsService) CreatePullRequestCommentReaction(ctx context.Context, owner, repo string, id int64, content string) (*Reaction, *Response, error) { - u := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions", owner, repo, id) - - body := &Reaction{Content: String(content)} - req, err := s.client.NewRequest("POST", u, body) - if err != nil { - return nil, nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - m := &Reaction{} - resp, err := s.client.Do(ctx, req, m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// DeletePullRequestCommentReaction deletes the reaction to a pull request review comment. -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-a-pull-request-comment-reaction -func (s *ReactionsService) DeletePullRequestCommentReaction(ctx context.Context, owner, repo string, commentID, reactionID int64) (*Response, error) { - url := fmt.Sprintf("repos/%v/%v/pulls/comments/%v/reactions/%v", owner, repo, commentID, reactionID) - - return s.deleteReaction(ctx, url) -} - -// DeletePullRequestCommentReactionByID deletes the reaction to a pull request review comment by repository ID. -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-a-pull-request-comment-reaction -func (s *ReactionsService) DeletePullRequestCommentReactionByID(ctx context.Context, repoID, commentID, reactionID int64) (*Response, error) { - url := fmt.Sprintf("repositories/%v/pulls/comments/%v/reactions/%v", repoID, commentID, reactionID) - - return s.deleteReaction(ctx, url) -} - -// ListTeamDiscussionReactions lists the reactions for a team discussion. -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#list-reactions-for-a-team-discussion-legacy -func (s *ReactionsService) ListTeamDiscussionReactions(ctx context.Context, teamID int64, discussionNumber int, opts *ListOptions) ([]*Reaction, *Response, error) { - u := fmt.Sprintf("teams/%v/discussions/%v/reactions", teamID, discussionNumber) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - req.Header.Set("Accept", mediaTypeReactionsPreview) - - var m []*Reaction - resp, err := s.client.Do(ctx, req, &m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// CreateTeamDiscussionReaction creates a reaction for a team discussion. -// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#create-reaction-for-a-team-discussion-legacy -func (s *ReactionsService) CreateTeamDiscussionReaction(ctx context.Context, teamID int64, discussionNumber int, content string) (*Reaction, *Response, error) { - u := fmt.Sprintf("teams/%v/discussions/%v/reactions", teamID, discussionNumber) - - body := &Reaction{Content: String(content)} - req, err := s.client.NewRequest("POST", u, body) - if err != nil { - return nil, nil, err - } - - req.Header.Set("Accept", mediaTypeReactionsPreview) - - m := &Reaction{} - resp, err := s.client.Do(ctx, req, m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// DeleteTeamDiscussionReaction deletes the reaction to a team discussion. -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-team-discussion-reaction -func (s *ReactionsService) DeleteTeamDiscussionReaction(ctx context.Context, org, teamSlug string, discussionNumber int, reactionID int64) (*Response, error) { - url := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/reactions/%v", org, teamSlug, discussionNumber, reactionID) - - return s.deleteReaction(ctx, url) -} - -// DeleteTeamDiscussionReactionByOrgIDAndTeamID deletes the reaction to a team discussion by organization ID and team ID. -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-team-discussion-reaction -func (s *ReactionsService) DeleteTeamDiscussionReactionByOrgIDAndTeamID(ctx context.Context, orgID, teamID, discussionNumber int, reactionID int64) (*Response, error) { - url := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/reactions/%v", orgID, teamID, discussionNumber, reactionID) - - return s.deleteReaction(ctx, url) -} - -// ListTeamDiscussionCommentReactions lists the reactions for a team discussion comment. -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#list-reactions-for-a-team-discussion-comment-legacy -func (s *ReactionsService) ListTeamDiscussionCommentReactions(ctx context.Context, teamID int64, discussionNumber, commentNumber int, opts *ListOptions) ([]*Reaction, *Response, error) { - u := fmt.Sprintf("teams/%v/discussions/%v/comments/%v/reactions", teamID, discussionNumber, commentNumber) - u, err := addOptions(u, opts) - if err != nil { - return nil, nil, err - } - - req, err := s.client.NewRequest("GET", u, nil) - if err != nil { - return nil, nil, err - } - - req.Header.Set("Accept", mediaTypeReactionsPreview) - - var m []*Reaction - resp, err := s.client.Do(ctx, req, &m) - if err != nil { - return nil, nil, err - } - return m, resp, nil -} - -// CreateTeamDiscussionCommentReaction creates a reaction for a team discussion comment. -// The content should have one of the following values: "+1", "-1", "laugh", "confused", "heart", "hooray". -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#create-reaction-for-a-team-discussion-comment-legacy -func (s *ReactionsService) CreateTeamDiscussionCommentReaction(ctx context.Context, teamID int64, discussionNumber, commentNumber int, content string) (*Reaction, *Response, error) { - u := fmt.Sprintf("teams/%v/discussions/%v/comments/%v/reactions", teamID, discussionNumber, commentNumber) - - body := &Reaction{Content: String(content)} - req, err := s.client.NewRequest("POST", u, body) - if err != nil { - return nil, nil, err - } - - req.Header.Set("Accept", mediaTypeReactionsPreview) - - m := &Reaction{} - resp, err := s.client.Do(ctx, req, m) - if err != nil { - return nil, resp, err - } - - return m, resp, nil -} - -// DeleteTeamDiscussionCommentReaction deletes the reaction to a team discussion comment. -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-team-discussion-comment-reaction -func (s *ReactionsService) DeleteTeamDiscussionCommentReaction(ctx context.Context, org, teamSlug string, discussionNumber, commentNumber int, reactionID int64) (*Response, error) { - url := fmt.Sprintf("orgs/%v/teams/%v/discussions/%v/comments/%v/reactions/%v", org, teamSlug, discussionNumber, commentNumber, reactionID) - - return s.deleteReaction(ctx, url) -} - -// DeleteTeamDiscussionCommentReactionByOrgIDAndTeamID deletes the reaction to a team discussion comment by organization ID and team ID. -// -// GitHub API docs: https://docs.github.com/en/rest/reactions/#delete-team-discussion-comment-reaction -func (s *ReactionsService) DeleteTeamDiscussionCommentReactionByOrgIDAndTeamID(ctx context.Context, orgID, teamID, discussionNumber, commentNumber int, reactionID int64) (*Response, error) { - url := fmt.Sprintf("organizations/%v/team/%v/discussions/%v/comments/%v/reactions/%v", orgID, teamID, discussionNumber, commentNumber, reactionID) - - return s.deleteReaction(ctx, url) -} - -func (s *ReactionsService) deleteReaction(ctx context.Context, url string) (*Response, error) { - req, err := s.client.NewRequest(http.MethodDelete, url, nil) - if err != nil { - return nil, err - } - - // TODO: remove custom Accept headers when APIs fully launch. - req.Header.Set("Accept", mediaTypeReactionsPreview) - - return s.client.Do(ctx, req, nil) -} diff --git a/update-urls/testdata/reactions.html b/update-urls/testdata/reactions.html deleted file mode 100644 index 2669f856c09..00000000000 --- a/update-urls/testdata/reactions.html +++ /dev/null @@ -1,5690 +0,0 @@ - - - Reactions - GitHub Docs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - -
- - - - -
-
- - -
-
- - - -
-
- -
- - - Article version: GitHub.com - - - - -
- - -
-
- - -
-
- -
- -
-
-

Reactions

-
- -
-
- - - - - - - - -
-
-
- -

In this article

- - -
- -
-

- Did this doc help you? -

-

- - - - -

- - - - - -

- - -

- - -
- -
-
-
-
- -

Reaction types

-

When creating a reaction, the allowed values for the content parameter are as follows (with the corresponding emoji for reference):

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
contentemoji
+1👍
-1👎
laugh😄
confused😕
heart❤️
hooray🎉
rocket🚀
eyes👀
-
-
-

- List reactions for a team discussion comment -

-

List the reactions to a team discussion comment. OAuth access tokens require the read:discussion scope.

-

Note: You can also specify a team by org_id and team_id using the route GET /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number/reactions.

-
-
get /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
orgstringpath - - -
team_slugstringpath - - -
discussion_numberintegerpath - - -
comment_numberintegerpath - - -
contentstringquery -

Returns a single reaction type. Omit this parameter to list all reactions to a team discussion comment.

- -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/orgs/ORG/teams/TEAM_SLUG/discussions/42/comments/42/reactions
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions', {
-  org: 'org',
-  team_slug: 'team_slug',
-  discussion_number: 42,
-  comment_number: 42,
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default response

-
Status: 200 OK
-
[
-  {
-    "id": 1,
-    "node_id": "MDg6UmVhY3Rpb24x",
-    "user": {
-      "login": "octocat",
-      "id": 1,
-      "node_id": "MDQ6VXNlcjE=",
-      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-      "gravatar_id": "",
-      "url": "https://api.github.com/users/octocat",
-      "html_url": "https://github.com/octocat",
-      "followers_url": "https://api.github.com/users/octocat/followers",
-      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-      "organizations_url": "https://api.github.com/users/octocat/orgs",
-      "repos_url": "https://api.github.com/users/octocat/repos",
-      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-      "received_events_url": "https://api.github.com/users/octocat/received_events",
-      "type": "User",
-      "site_admin": false
-    },
-    "content": "heart",
-    "created_at": "2016-05-20T20:09:31Z"
-  }
-]
-
- - -

Notes

- - - -

- - Preview notice - -

- -
-

An additional reactions object in the issue comment payload is currently available for developers to preview. During -the preview period, the APIs may change without advance notice. Please see the blog -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- Create reaction for a team discussion comment -

-

Create a reaction to a team discussion comment. OAuth access tokens require the write:discussion scope. A response with a Status: 200 OK means that you already added the reaction type to this team discussion comment.

-

Note: You can also specify a team by org_id and team_id using the route POST /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number/reactions.

-
-
post /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
orgstringpath - - -
team_slugstringpath - - -
discussion_numberintegerpath - - -
comment_numberintegerpath - - -
contentstringbody -

Required. The reaction type to add to the team discussion comment.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X POST \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/orgs/ORG/teams/TEAM_SLUG/discussions/42/comments/42/reactions \
-  -d '{"content":"content"}'
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions', {
-  org: 'org',
-  team_slug: 'team_slug',
-  discussion_number: 42,
-  comment_number: 42,
-  content: 'content',
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default response

-
Status: 201 Created
-
{
-  "id": 1,
-  "node_id": "MDg6UmVhY3Rpb24x",
-  "user": {
-    "login": "octocat",
-    "id": 1,
-    "node_id": "MDQ6VXNlcjE=",
-    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-    "gravatar_id": "",
-    "url": "https://api.github.com/users/octocat",
-    "html_url": "https://github.com/octocat",
-    "followers_url": "https://api.github.com/users/octocat/followers",
-    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-    "organizations_url": "https://api.github.com/users/octocat/orgs",
-    "repos_url": "https://api.github.com/users/octocat/repos",
-    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-    "received_events_url": "https://api.github.com/users/octocat/received_events",
-    "type": "User",
-    "site_admin": false
-  },
-  "content": "heart",
-  "created_at": "2016-05-20T20:09:31Z"
-}
-
- - -

Notes

- - - -

- - Preview notice - -

- -
-

An additional reactions object in the issue comment payload is currently available for developers to preview. During -the preview period, the APIs may change without advance notice. Please see the blog -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- Delete team discussion comment reaction -

-

Note: You can also specify a team or organization with team_id and org_id using the route DELETE /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number/reactions/:reaction_id.

-

Delete a reaction to a team discussion comment. OAuth access tokens require the write:discussion scope.

-
-
delete /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions/{reaction_id}
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
orgstringpath - - -
team_slugstringpath - - -
discussion_numberintegerpath - - -
comment_numberintegerpath - - -
reaction_idintegerpath - - -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X DELETE \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/orgs/ORG/teams/TEAM_SLUG/discussions/42/comments/42/reactions/42
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions/{reaction_id}', {
-  org: 'org',
-  team_slug: 'team_slug',
-  discussion_number: 42,
-  comment_number: 42,
-  reaction_id: 42,
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default Response

-
Status: 204 No Content
-
- - -

Notes

- - - -

- - Preview notice - -

- -
-

An additional reactions object in the issue comment payload is currently available for developers to preview. During -the preview period, the APIs may change without advance notice. Please see the blog -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- List reactions for a team discussion -

-

List the reactions to a team discussion. OAuth access tokens require the read:discussion scope.

-

Note: You can also specify a team by org_id and team_id using the route GET /organizations/:org_id/team/:team_id/discussions/:discussion_number/reactions.

-
-
get /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
orgstringpath - - -
team_slugstringpath - - -
discussion_numberintegerpath - - -
contentstringquery -

Returns a single reaction type. Omit this parameter to list all reactions to a team discussion.

- -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/orgs/ORG/teams/TEAM_SLUG/discussions/42/reactions
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions', {
-  org: 'org',
-  team_slug: 'team_slug',
-  discussion_number: 42,
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default response

-
Status: 200 OK
-
[
-  {
-    "id": 1,
-    "node_id": "MDg6UmVhY3Rpb24x",
-    "user": {
-      "login": "octocat",
-      "id": 1,
-      "node_id": "MDQ6VXNlcjE=",
-      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-      "gravatar_id": "",
-      "url": "https://api.github.com/users/octocat",
-      "html_url": "https://github.com/octocat",
-      "followers_url": "https://api.github.com/users/octocat/followers",
-      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-      "organizations_url": "https://api.github.com/users/octocat/orgs",
-      "repos_url": "https://api.github.com/users/octocat/repos",
-      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-      "received_events_url": "https://api.github.com/users/octocat/received_events",
-      "type": "User",
-      "site_admin": false
-    },
-    "content": "heart",
-    "created_at": "2016-05-20T20:09:31Z"
-  }
-]
-
- - -

Notes

- - - -

- - Preview notice - -

- -
-

An additional reactions object in the issue comment payload is currently available for developers to preview. During -the preview period, the APIs may change without advance notice. Please see the blog -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- Create reaction for a team discussion -

-

Create a reaction to a team discussion. OAuth access tokens require the write:discussion scope. A response with a Status: 200 OK means that you already added the reaction type to this team discussion.

-

Note: You can also specify a team by org_id and team_id using the route POST /organizations/:org_id/team/:team_id/discussions/:discussion_number/reactions.

-
-
post /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
orgstringpath - - -
team_slugstringpath - - -
discussion_numberintegerpath - - -
contentstringbody -

Required. The reaction type to add to the team discussion.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X POST \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/orgs/ORG/teams/TEAM_SLUG/discussions/42/reactions \
-  -d '{"content":"content"}'
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions', {
-  org: 'org',
-  team_slug: 'team_slug',
-  discussion_number: 42,
-  content: 'content',
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default response

-
Status: 201 Created
-
{
-  "id": 1,
-  "node_id": "MDg6UmVhY3Rpb24x",
-  "user": {
-    "login": "octocat",
-    "id": 1,
-    "node_id": "MDQ6VXNlcjE=",
-    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-    "gravatar_id": "",
-    "url": "https://api.github.com/users/octocat",
-    "html_url": "https://github.com/octocat",
-    "followers_url": "https://api.github.com/users/octocat/followers",
-    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-    "organizations_url": "https://api.github.com/users/octocat/orgs",
-    "repos_url": "https://api.github.com/users/octocat/repos",
-    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-    "received_events_url": "https://api.github.com/users/octocat/received_events",
-    "type": "User",
-    "site_admin": false
-  },
-  "content": "heart",
-  "created_at": "2016-05-20T20:09:31Z"
-}
-
- - - -

- - Preview notice - -

- -
-

An additional reactions object in the issue comment payload is currently available for developers to preview. During -the preview period, the APIs may change without advance notice. Please see the blog -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- Delete team discussion reaction -

-

Note: You can also specify a team or organization with team_id and org_id using the route DELETE /organizations/:org_id/team/:team_id/discussions/:discussion_number/reactions/:reaction_id.

-

Delete a reaction to a team discussion. OAuth access tokens require the write:discussion scope.

-
-
delete /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions/{reaction_id}
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
orgstringpath - - -
team_slugstringpath - - -
discussion_numberintegerpath - - -
reaction_idintegerpath - - -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X DELETE \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/orgs/ORG/teams/TEAM_SLUG/discussions/42/reactions/42
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions/{reaction_id}', {
-  org: 'org',
-  team_slug: 'team_slug',
-  discussion_number: 42,
-  reaction_id: 42,
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default Response

-
Status: 204 No Content
-
- - -

Notes

- - - -

- - Preview notice - -

- -
-

An additional reactions object in the issue comment payload is currently available for developers to preview. During -the preview period, the APIs may change without advance notice. Please see the blog -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- Delete a reaction (Legacy) -

-

Deprecation Notice: This endpoint route is deprecated and will be removed from the Reactions API. We recommend migrating your existing code to use the new delete reactions endpoints. For more information, see this blog post.

-

OAuth access tokens require the write:discussion scope, when deleting a team discussion or team discussion comment.

-
-
delete /reactions/{reaction_id}
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
reaction_idintegerpath - - -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X DELETE \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/reactions/42
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('DELETE /reactions/{reaction_id}', {
-  reaction_id: 42,
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default Response

-
Status: 204 No Content
-
- - -

Notes

- - - -

- - Preview notice - -

- -
-

An additional reactions object in the issue comment payload is currently available for developers to preview. During -the preview period, the APIs may change without advance notice. Please see the blog -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- List reactions for a commit comment -

-

List the reactions to a commit comment.

-
-
get /repos/{owner}/{repo}/comments/{comment_id}/reactions
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
ownerstringpath - - -
repostringpath - - -
comment_idintegerpath - - -
contentstringquery -

Returns a single reaction type. Omit this parameter to list all reactions to a commit comment.

- -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/repos/octocat/hello-world/comments/42/reactions
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /repos/{owner}/{repo}/comments/{comment_id}/reactions', {
-  owner: 'octocat',
-  repo: 'hello-world',
-  comment_id: 42,
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default response

-
Status: 200 OK
-
[
-  {
-    "id": 1,
-    "node_id": "MDg6UmVhY3Rpb24x",
-    "user": {
-      "login": "octocat",
-      "id": 1,
-      "node_id": "MDQ6VXNlcjE=",
-      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-      "gravatar_id": "",
-      "url": "https://api.github.com/users/octocat",
-      "html_url": "https://github.com/octocat",
-      "followers_url": "https://api.github.com/users/octocat/followers",
-      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-      "organizations_url": "https://api.github.com/users/octocat/orgs",
-      "repos_url": "https://api.github.com/users/octocat/repos",
-      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-      "received_events_url": "https://api.github.com/users/octocat/received_events",
-      "type": "User",
-      "site_admin": false
-    },
-    "content": "heart",
-    "created_at": "2016-05-20T20:09:31Z"
-  }
-]
-
- - -

Notes

- - - -

- - Preview notice - -

- -
-

An additional reactions object in the issue comment payload is currently available for developers to preview. During -the preview period, the APIs may change without advance notice. Please see the blog -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- Create reaction for a commit comment -

-

Create a reaction to a commit comment. A response with a Status: 200 OK means that you already added the reaction type to this commit comment.

-
-
post /repos/{owner}/{repo}/comments/{comment_id}/reactions
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
ownerstringpath - - -
repostringpath - - -
comment_idintegerpath - - -
contentstringbody -

Required. The reaction type to add to the commit comment.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X POST \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/repos/octocat/hello-world/comments/42/reactions \
-  -d '{"content":"content"}'
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('POST /repos/{owner}/{repo}/comments/{comment_id}/reactions', {
-  owner: 'octocat',
-  repo: 'hello-world',
-  comment_id: 42,
-  content: 'content',
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default response

-
Status: 201 Created
-
{
-  "id": 1,
-  "node_id": "MDg6UmVhY3Rpb24x",
-  "user": {
-    "login": "octocat",
-    "id": 1,
-    "node_id": "MDQ6VXNlcjE=",
-    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-    "gravatar_id": "",
-    "url": "https://api.github.com/users/octocat",
-    "html_url": "https://github.com/octocat",
-    "followers_url": "https://api.github.com/users/octocat/followers",
-    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-    "organizations_url": "https://api.github.com/users/octocat/orgs",
-    "repos_url": "https://api.github.com/users/octocat/repos",
-    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-    "received_events_url": "https://api.github.com/users/octocat/received_events",
-    "type": "User",
-    "site_admin": false
-  },
-  "content": "heart",
-  "created_at": "2016-05-20T20:09:31Z"
-}
-
- - -

Notes

- - - -

- - Preview notice - -

- -
-

An additional reactions object in the issue comment payload is currently available for developers to preview. During -the preview period, the APIs may change without advance notice. Please see the blog -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- Delete a commit comment reaction -

-

Note: You can also specify a repository by repository_id using the route DELETE /repositories/:repository_id/comments/:comment_id/reactions/:reaction_id.

-

Delete a reaction to a commit comment.

-
-
delete /repos/{owner}/{repo}/comments/{comment_id}/reactions/{reaction_id}
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
ownerstringpath - - -
repostringpath - - -
comment_idintegerpath - - -
reaction_idintegerpath - - -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X DELETE \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/repos/octocat/hello-world/comments/42/reactions/42
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('DELETE /repos/{owner}/{repo}/comments/{comment_id}/reactions/{reaction_id}', {
-  owner: 'octocat',
-  repo: 'hello-world',
-  comment_id: 42,
-  reaction_id: 42,
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default Response

-
Status: 204 No Content
-
- - -

Notes

- - - -

- - Preview notice - -

- -
-

An additional reactions object in the issue comment payload is currently available for developers to preview. During -the preview period, the APIs may change without advance notice. Please see the blog -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- List reactions for an issue comment -

-

List the reactions to an issue comment.

-
-
get /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
ownerstringpath - - -
repostringpath - - -
comment_idintegerpath - - -
contentstringquery -

Returns a single reaction type. Omit this parameter to list all reactions to an issue comment.

- -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/repos/octocat/hello-world/issues/comments/42/reactions
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions', {
-  owner: 'octocat',
-  repo: 'hello-world',
-  comment_id: 42,
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default response

-
Status: 200 OK
-
[
-  {
-    "id": 1,
-    "node_id": "MDg6UmVhY3Rpb24x",
-    "user": {
-      "login": "octocat",
-      "id": 1,
-      "node_id": "MDQ6VXNlcjE=",
-      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-      "gravatar_id": "",
-      "url": "https://api.github.com/users/octocat",
-      "html_url": "https://github.com/octocat",
-      "followers_url": "https://api.github.com/users/octocat/followers",
-      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-      "organizations_url": "https://api.github.com/users/octocat/orgs",
-      "repos_url": "https://api.github.com/users/octocat/repos",
-      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-      "received_events_url": "https://api.github.com/users/octocat/received_events",
-      "type": "User",
-      "site_admin": false
-    },
-    "content": "heart",
-    "created_at": "2016-05-20T20:09:31Z"
-  }
-]
-
- - -

Notes

- - - -

- - Preview notice - -

- -
-

An additional reactions object in the issue comment payload is currently available for developers to preview. During -the preview period, the APIs may change without advance notice. Please see the blog -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- Create reaction for an issue comment -

-

Create a reaction to an issue comment. A response with a Status: 200 OK means that you already added the reaction type to this issue comment.

-
-
post /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
ownerstringpath - - -
repostringpath - - -
comment_idintegerpath - - -
contentstringbody -

Required. The reaction type to add to the issue comment.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X POST \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/repos/octocat/hello-world/issues/comments/42/reactions \
-  -d '{"content":"content"}'
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('POST /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions', {
-  owner: 'octocat',
-  repo: 'hello-world',
-  comment_id: 42,
-  content: 'content',
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default response

-
Status: 201 Created
-
{
-  "id": 1,
-  "node_id": "MDg6UmVhY3Rpb24x",
-  "user": {
-    "login": "octocat",
-    "id": 1,
-    "node_id": "MDQ6VXNlcjE=",
-    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-    "gravatar_id": "",
-    "url": "https://api.github.com/users/octocat",
-    "html_url": "https://github.com/octocat",
-    "followers_url": "https://api.github.com/users/octocat/followers",
-    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-    "organizations_url": "https://api.github.com/users/octocat/orgs",
-    "repos_url": "https://api.github.com/users/octocat/repos",
-    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-    "received_events_url": "https://api.github.com/users/octocat/received_events",
-    "type": "User",
-    "site_admin": false
-  },
-  "content": "heart",
-  "created_at": "2016-05-20T20:09:31Z"
-}
-
- - -

Notes

- - - -

- - Preview notice - -

- -
-

An additional reactions object in the issue comment payload is currently available for developers to preview. During -the preview period, the APIs may change without advance notice. Please see the blog -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- Delete an issue comment reaction -

-

Note: You can also specify a repository by repository_id using the route DELETE delete /repositories/:repository_id/issues/comments/:comment_id/reactions/:reaction_id.

-

Delete a reaction to an issue comment.

-
-
delete /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions/{reaction_id}
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
ownerstringpath - - -
repostringpath - - -
comment_idintegerpath - - -
reaction_idintegerpath - - -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X DELETE \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/repos/octocat/hello-world/issues/comments/42/reactions/42
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('DELETE /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions/{reaction_id}', {
-  owner: 'octocat',
-  repo: 'hello-world',
-  comment_id: 42,
-  reaction_id: 42,
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default Response

-
Status: 204 No Content
-
- - -

Notes

- - - -

- - Preview notice - -

- -
-

An additional reactions object in the issue comment payload is currently available for developers to preview. During -the preview period, the APIs may change without advance notice. Please see the blog -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- List reactions for an issue -

-

List the reactions to an issue.

-
-
get /repos/{owner}/{repo}/issues/{issue_number}/reactions
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
ownerstringpath - - -
repostringpath - - -
issue_numberintegerpath - - -
contentstringquery -

Returns a single reaction type. Omit this parameter to list all reactions to an issue.

- -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/repos/octocat/hello-world/issues/42/reactions
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /repos/{owner}/{repo}/issues/{issue_number}/reactions', {
-  owner: 'octocat',
-  repo: 'hello-world',
-  issue_number: 42,
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default response

-
Status: 200 OK
-
[
-  {
-    "id": 1,
-    "node_id": "MDg6UmVhY3Rpb24x",
-    "user": {
-      "login": "octocat",
-      "id": 1,
-      "node_id": "MDQ6VXNlcjE=",
-      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-      "gravatar_id": "",
-      "url": "https://api.github.com/users/octocat",
-      "html_url": "https://github.com/octocat",
-      "followers_url": "https://api.github.com/users/octocat/followers",
-      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-      "organizations_url": "https://api.github.com/users/octocat/orgs",
-      "repos_url": "https://api.github.com/users/octocat/repos",
-      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-      "received_events_url": "https://api.github.com/users/octocat/received_events",
-      "type": "User",
-      "site_admin": false
-    },
-    "content": "heart",
-    "created_at": "2016-05-20T20:09:31Z"
-  }
-]
-
- - -

Notes

- - - -

- - Preview notice - -

- -
-

An additional reactions object in the issue comment payload is currently available for developers to preview. During -the preview period, the APIs may change without advance notice. Please see the blog -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- Create reaction for an issue -

-

Create a reaction to an issue. A response with a Status: 200 OK means that you already added the reaction type to this issue.

-
-
post /repos/{owner}/{repo}/issues/{issue_number}/reactions
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
ownerstringpath - - -
repostringpath - - -
issue_numberintegerpath - - -
contentstringbody -

Required. The reaction type to add to the issue.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X POST \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/repos/octocat/hello-world/issues/42/reactions \
-  -d '{"content":"content"}'
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('POST /repos/{owner}/{repo}/issues/{issue_number}/reactions', {
-  owner: 'octocat',
-  repo: 'hello-world',
-  issue_number: 42,
-  content: 'content',
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default response

-
Status: 201 Created
-
{
-  "id": 1,
-  "node_id": "MDg6UmVhY3Rpb24x",
-  "user": {
-    "login": "octocat",
-    "id": 1,
-    "node_id": "MDQ6VXNlcjE=",
-    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-    "gravatar_id": "",
-    "url": "https://api.github.com/users/octocat",
-    "html_url": "https://github.com/octocat",
-    "followers_url": "https://api.github.com/users/octocat/followers",
-    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-    "organizations_url": "https://api.github.com/users/octocat/orgs",
-    "repos_url": "https://api.github.com/users/octocat/repos",
-    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-    "received_events_url": "https://api.github.com/users/octocat/received_events",
-    "type": "User",
-    "site_admin": false
-  },
-  "content": "heart",
-  "created_at": "2016-05-20T20:09:31Z"
-}
-
- - - -

- - Preview notice - -

- -
-

An additional reactions object in the issue comment payload is currently available for developers to preview. During -the preview period, the APIs may change without advance notice. Please see the blog -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- Delete an issue reaction -

-

Note: You can also specify a repository by repository_id using the route DELETE /repositories/:repository_id/issues/:issue_number/reactions/:reaction_id.

-

Delete a reaction to an issue.

-
-
delete /repos/{owner}/{repo}/issues/{issue_number}/reactions/{reaction_id}
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
ownerstringpath - - -
repostringpath - - -
issue_numberintegerpath - - -
reaction_idintegerpath - - -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X DELETE \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/repos/octocat/hello-world/issues/42/reactions/42
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('DELETE /repos/{owner}/{repo}/issues/{issue_number}/reactions/{reaction_id}', {
-  owner: 'octocat',
-  repo: 'hello-world',
-  issue_number: 42,
-  reaction_id: 42,
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default Response

-
Status: 204 No Content
-
- - -

Notes

- - - -

- - Preview notice - -

- -
-

An additional reactions object in the issue comment payload is currently available for developers to preview. During -the preview period, the APIs may change without advance notice. Please see the blog -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
- -
get /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
ownerstringpath - - -
repostringpath - - -
comment_idintegerpath - - -
contentstringquery -

Returns a single reaction type. Omit this parameter to list all reactions to a pull request review comment.

- -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/repos/octocat/hello-world/pulls/comments/42/reactions
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions', {
-  owner: 'octocat',
-  repo: 'hello-world',
-  comment_id: 42,
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default response

-
Status: 200 OK
-
[
-  {
-    "id": 1,
-    "node_id": "MDg6UmVhY3Rpb24x",
-    "user": {
-      "login": "octocat",
-      "id": 1,
-      "node_id": "MDQ6VXNlcjE=",
-      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-      "gravatar_id": "",
-      "url": "https://api.github.com/users/octocat",
-      "html_url": "https://github.com/octocat",
-      "followers_url": "https://api.github.com/users/octocat/followers",
-      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-      "organizations_url": "https://api.github.com/users/octocat/orgs",
-      "repos_url": "https://api.github.com/users/octocat/repos",
-      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-      "received_events_url": "https://api.github.com/users/octocat/received_events",
-      "type": "User",
-      "site_admin": false
-    },
-    "content": "heart",
-    "created_at": "2016-05-20T20:09:31Z"
-  }
-]
-
- - -

Notes

- - - -

- - Preview notice - -

- -
-

An additional reactions object in the issue comment payload is currently available for developers to preview. During -the preview period, the APIs may change without advance notice. Please see the blog -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- Create reaction for a pull request review comment -

-

Create a reaction to a pull request review comment. A response with a Status: 200 OK means that you already added the reaction type to this pull request review comment.

-
-
post /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
ownerstringpath - - -
repostringpath - - -
comment_idintegerpath - - -
contentstringbody -

Required. The reaction type to add to the pull request review comment.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X POST \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/repos/octocat/hello-world/pulls/comments/42/reactions \
-  -d '{"content":"content"}'
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('POST /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions', {
-  owner: 'octocat',
-  repo: 'hello-world',
-  comment_id: 42,
-  content: 'content',
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default response

-
Status: 201 Created
-
{
-  "id": 1,
-  "node_id": "MDg6UmVhY3Rpb24x",
-  "user": {
-    "login": "octocat",
-    "id": 1,
-    "node_id": "MDQ6VXNlcjE=",
-    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-    "gravatar_id": "",
-    "url": "https://api.github.com/users/octocat",
-    "html_url": "https://github.com/octocat",
-    "followers_url": "https://api.github.com/users/octocat/followers",
-    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-    "organizations_url": "https://api.github.com/users/octocat/orgs",
-    "repos_url": "https://api.github.com/users/octocat/repos",
-    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-    "received_events_url": "https://api.github.com/users/octocat/received_events",
-    "type": "User",
-    "site_admin": false
-  },
-  "content": "heart",
-  "created_at": "2016-05-20T20:09:31Z"
-}
-
- - -

Notes

- - - -

- - Preview notice - -

- -
-

An additional reactions object in the issue comment payload is currently available for developers to preview. During -the preview period, the APIs may change without advance notice. Please see the blog -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- Delete a pull request comment reaction -

-

Note: You can also specify a repository by repository_id using the route DELETE /repositories/:repository_id/pulls/comments/:comment_id/reactions/:reaction_id.

-

Delete a reaction to a pull request review comment.

-
-
delete /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions/{reaction_id}
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
ownerstringpath - - -
repostringpath - - -
comment_idintegerpath - - -
reaction_idintegerpath - - -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X DELETE \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/repos/octocat/hello-world/pulls/comments/42/reactions/42
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions/{reaction_id}', {
-  owner: 'octocat',
-  repo: 'hello-world',
-  comment_id: 42,
-  reaction_id: 42,
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default Response

-
Status: 204 No Content
-
- - -

Notes

- - - -

- - Preview notice - -

- -
-

An additional reactions object in the issue comment payload is currently available for developers to preview. During -the preview period, the APIs may change without advance notice. Please see the blog -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- List reactions for a team discussion comment (Legacy) -

-

Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new List reactions for a team discussion comment endpoint.

-

List the reactions to a team discussion comment. OAuth access tokens require the read:discussion scope.

-
-
get /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
team_idintegerpath - - -
discussion_numberintegerpath - - -
comment_numberintegerpath - - -
contentstringquery -

Returns a single reaction type. Omit this parameter to list all reactions to a team discussion comment.

- -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/teams/42/discussions/42/comments/42/reactions
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions', {
-  team_id: 42,
-  discussion_number: 42,
-  comment_number: 42,
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default response

-
Status: 200 OK
-
[
-  {
-    "id": 1,
-    "node_id": "MDg6UmVhY3Rpb24x",
-    "user": {
-      "login": "octocat",
-      "id": 1,
-      "node_id": "MDQ6VXNlcjE=",
-      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-      "gravatar_id": "",
-      "url": "https://api.github.com/users/octocat",
-      "html_url": "https://github.com/octocat",
-      "followers_url": "https://api.github.com/users/octocat/followers",
-      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-      "organizations_url": "https://api.github.com/users/octocat/orgs",
-      "repos_url": "https://api.github.com/users/octocat/repos",
-      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-      "received_events_url": "https://api.github.com/users/octocat/received_events",
-      "type": "User",
-      "site_admin": false
-    },
-    "content": "heart",
-    "created_at": "2016-05-20T20:09:31Z"
-  }
-]
-
- - -

Notes

- - - -

- - Preview notice - -

- -
-

An additional reactions object in the issue comment payload is currently available for developers to preview. During -the preview period, the APIs may change without advance notice. Please see the blog -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- Create reaction for a team discussion comment (Legacy) -

-

Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Create reaction for a team discussion comment endpoint.

-

Create a reaction to a team discussion comment. OAuth access tokens require the write:discussion scope. A response with a Status: 200 OK means that you already added the reaction type to this team discussion comment.

-
-
post /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
team_idintegerpath - - -
discussion_numberintegerpath - - -
comment_numberintegerpath - - -
contentstringbody -

Required. The reaction type to add to the team discussion comment.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X POST \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/teams/42/discussions/42/comments/42/reactions \
-  -d '{"content":"content"}'
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('POST /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions', {
-  team_id: 42,
-  discussion_number: 42,
-  comment_number: 42,
-  content: 'content',
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default response

-
Status: 201 Created
-
{
-  "id": 1,
-  "node_id": "MDg6UmVhY3Rpb24x",
-  "user": {
-    "login": "octocat",
-    "id": 1,
-    "node_id": "MDQ6VXNlcjE=",
-    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-    "gravatar_id": "",
-    "url": "https://api.github.com/users/octocat",
-    "html_url": "https://github.com/octocat",
-    "followers_url": "https://api.github.com/users/octocat/followers",
-    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-    "organizations_url": "https://api.github.com/users/octocat/orgs",
-    "repos_url": "https://api.github.com/users/octocat/repos",
-    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-    "received_events_url": "https://api.github.com/users/octocat/received_events",
-    "type": "User",
-    "site_admin": false
-  },
-  "content": "heart",
-  "created_at": "2016-05-20T20:09:31Z"
-}
-
- - -

Notes

- - - -

- - Preview notice - -

- -
-

An additional reactions object in the issue comment payload is currently available for developers to preview. During -the preview period, the APIs may change without advance notice. Please see the blog -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- List reactions for a team discussion (Legacy) -

-

Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new List reactions for a team discussion endpoint.

-

List the reactions to a team discussion. OAuth access tokens require the read:discussion scope.

-
-
get /teams/{team_id}/discussions/{discussion_number}/reactions
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
team_idintegerpath - - -
discussion_numberintegerpath - - -
contentstringquery -

Returns a single reaction type. Omit this parameter to list all reactions to a team discussion.

- -
per_pageintegerquery -

Results per page (max 100)

- -
pageintegerquery -

Page number of the results to fetch.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/teams/42/discussions/42/reactions
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('GET /teams/{team_id}/discussions/{discussion_number}/reactions', {
-  team_id: 42,
-  discussion_number: 42,
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default response

-
Status: 200 OK
-
[
-  {
-    "id": 1,
-    "node_id": "MDg6UmVhY3Rpb24x",
-    "user": {
-      "login": "octocat",
-      "id": 1,
-      "node_id": "MDQ6VXNlcjE=",
-      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-      "gravatar_id": "",
-      "url": "https://api.github.com/users/octocat",
-      "html_url": "https://github.com/octocat",
-      "followers_url": "https://api.github.com/users/octocat/followers",
-      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-      "organizations_url": "https://api.github.com/users/octocat/orgs",
-      "repos_url": "https://api.github.com/users/octocat/repos",
-      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-      "received_events_url": "https://api.github.com/users/octocat/received_events",
-      "type": "User",
-      "site_admin": false
-    },
-    "content": "heart",
-    "created_at": "2016-05-20T20:09:31Z"
-  }
-]
-
- - -

Notes

- - - -

- - Preview notice - -

- -
-

An additional reactions object in the issue comment payload is currently available for developers to preview. During -the preview period, the APIs may change without advance notice. Please see the blog -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-

- Create reaction for a team discussion (Legacy) -

-

Deprecation Notice: This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new Create reaction for a team discussion endpoint.

-

Create a reaction to a team discussion. OAuth access tokens require the write:discussion scope. A response with a Status: 200 OK means that you already added the reaction type to this team discussion.

-
-
post /teams/{team_id}/discussions/{discussion_number}/reactions
-
- -

- Parameters -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeInDescription
acceptstringheader -

This API is under preview and subject to change.

- - - - See preview notice. - - -
team_idintegerpath - - -
discussion_numberintegerpath - - -
contentstringbody -

Required. The reaction type to add to the team discussion.

- -
- - -

- Code samples -

- - -
- - Shell - -
-
curl \
-  -X POST \
-  -H "Accept: application/vnd.github.squirrel-girl-preview+json" \
-  https://api.github.com/teams/42/discussions/42/reactions \
-  -d '{"content":"content"}'
-
- - - -
- - JavaScript (@octokit/core.js) - -
-
await octokit.request('POST /teams/{team_id}/discussions/{discussion_number}/reactions', {
-  team_id: 42,
-  discussion_number: 42,
-  content: 'content',
-  mediaType: {
-    previews: [
-      'squirrel-girl'
-    ]
-  }
-})
-
- - - - -

Default response

-
Status: 201 Created
-
{
-  "id": 1,
-  "node_id": "MDg6UmVhY3Rpb24x",
-  "user": {
-    "login": "octocat",
-    "id": 1,
-    "node_id": "MDQ6VXNlcjE=",
-    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
-    "gravatar_id": "",
-    "url": "https://api.github.com/users/octocat",
-    "html_url": "https://github.com/octocat",
-    "followers_url": "https://api.github.com/users/octocat/followers",
-    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
-    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
-    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
-    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
-    "organizations_url": "https://api.github.com/users/octocat/orgs",
-    "repos_url": "https://api.github.com/users/octocat/repos",
-    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
-    "received_events_url": "https://api.github.com/users/octocat/received_events",
-    "type": "User",
-    "site_admin": false
-  },
-  "content": "heart",
-  "created_at": "2016-05-20T20:09:31Z"
-}
-
- - - -

- - Preview notice - -

- -
-

An additional reactions object in the issue comment payload is currently available for developers to preview. During -the preview period, the APIs may change without advance notice. Please see the blog -post for full details.

-

To access the API you must provide a custom media type in the Accept header:

-
application/vnd.github.squirrel-girl-preview
-
-

The reactions key will have the following payload where url can be used to construct the API location for listing -and creating reactions.

-
{
-  "total_count": 5,
-  "+1": 3,
-  "-1": 1,
-  "laugh": 0,
-  "confused": 0,
-  "heart": 1,
-  "hooray": 0,
-  "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/reactions"
-}
-
- ☝️ This header is required. -
- - -
-
-
-
-
-
-
- -
-

- Did this doc help you? -

-

- - - - -

- - - - - -

- - -

- - -
- -
-
- - - -
-
-
-
-

Ask a human

-

Can't find what you're looking for?

- Contact us -
-
- -
-
-
-
- - - - - -
- - From f643c0f3fab9235ece313e9b935ae9136d2bb5ab Mon Sep 17 00:00:00 2001 From: Hasnae Rehioui Date: Sat, 4 Nov 2023 02:07:43 +1100 Subject: [PATCH 052/145] Fix branch protection request fields (#2977) Fixes: #2976. --- github/repos.go | 2 +- github/repos_test.go | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/github/repos.go b/github/repos.go index e158562e69d..b16cd3b8159 100644 --- a/github/repos.go +++ b/github/repos.go @@ -1097,7 +1097,7 @@ type RequiredStatusChecks struct { Contexts []string `json:"contexts,omitempty"` // The list of status checks to require in order to merge into this // branch. - Checks []*RequiredStatusCheck `json:"checks"` + Checks []*RequiredStatusCheck `json:"checks,omitempty"` ContextsURL *string `json:"contexts_url,omitempty"` URL *string `json:"url,omitempty"` } diff --git a/github/repos_test.go b/github/repos_test.go index 7486e488fe6..2bdc1b4289d 100644 --- a/github/repos_test.go +++ b/github/repos_test.go @@ -1766,7 +1766,6 @@ func TestRepositoriesService_UpdateBranchProtection_StrictNoChecks(t *testing.T) input := &ProtectionRequest{ RequiredStatusChecks: &RequiredStatusChecks{ Strict: true, - Checks: []*RequiredStatusCheck{}, }, RequiredPullRequestReviews: &PullRequestReviewsEnforcementRequest{ DismissStaleReviews: true, @@ -1802,8 +1801,7 @@ func TestRepositoriesService_UpdateBranchProtection_StrictNoChecks(t *testing.T) fmt.Fprintf(w, `{ "required_status_checks":{ "strict":true, - "contexts":[], - "checks": [] + "contexts":[] }, "required_pull_request_reviews":{ "dismissal_restrictions":{ @@ -1847,7 +1845,6 @@ func TestRepositoriesService_UpdateBranchProtection_StrictNoChecks(t *testing.T) RequiredStatusChecks: &RequiredStatusChecks{ Strict: true, Contexts: []string{}, - Checks: []*RequiredStatusCheck{}, }, RequiredPullRequestReviews: &PullRequestReviewsEnforcement{ DismissStaleReviews: true, From a5b1cea2fe8d05dc2a9e0190abd6f17d519b2696 Mon Sep 17 00:00:00 2001 From: Mark Collao <106274486+mcollao-hc@users.noreply.github.com> Date: Fri, 3 Nov 2023 15:54:59 -0500 Subject: [PATCH 053/145] Add dependabot alert update endpoint (#2981) Fixes: #2922. --- github/dependabot_alerts.go | 32 ++++++++++++++++++++++ github/dependabot_alerts_test.go | 46 ++++++++++++++++++++++++++++++++ github/github-accessors.go | 16 +++++++++++ github/github-accessors_test.go | 20 ++++++++++++++ 4 files changed, 114 insertions(+) diff --git a/github/dependabot_alerts.go b/github/dependabot_alerts.go index 94be610c53d..f1ed126c217 100644 --- a/github/dependabot_alerts.go +++ b/github/dependabot_alerts.go @@ -67,6 +67,17 @@ type DependabotAlert struct { Repository *Repository `json:"repository,omitempty"` } +// DependabotAlertState represents the state of a Dependabot alert to update. +type DependabotAlertState struct { + // The state of the Dependabot alert. A dismissed_reason must be provided when setting the state to dismissed. + State string `json:"state"` + // Required when state is dismissed. A reason for dismissing the alert. + // Can be one of: fix_started, inaccurate, no_bandwidth, not_used, tolerable_risk + DismissedReason *string `json:"dismissed_reason,omitempty"` + // An optional comment associated with dismissing the alert. + DismissedComment *string `json:"dismissed_comment,omitempty"` +} + // ListAlertsOptions specifies the optional parameters to the DependabotService.ListRepoAlerts // and DependabotService.ListOrgAlerts methods. type ListAlertsOptions struct { @@ -142,3 +153,24 @@ func (s *DependabotService) GetRepoAlert(ctx context.Context, owner, repo string return alert, resp, nil } + +// UpdateAlert updates a Dependabot alert. +// +// GitHub API docs: https://docs.github.com/rest/dependabot/alerts#update-a-dependabot-alert +// +//meta:operation PATCH /repos/{owner}/{repo}/dependabot/alerts/{alert_number} +func (s *DependabotService) UpdateAlert(ctx context.Context, owner, repo string, number int, stateInfo *DependabotAlertState) (*DependabotAlert, *Response, error) { + url := fmt.Sprintf("repos/%v/%v/dependabot/alerts/%v", owner, repo, number) + req, err := s.client.NewRequest("PATCH", url, stateInfo) + if err != nil { + return nil, nil, err + } + + alert := new(DependabotAlert) + resp, err := s.client.Do(ctx, req, alert) + if err != nil { + return nil, resp, err + } + + return alert, resp, nil +} diff --git a/github/dependabot_alerts_test.go b/github/dependabot_alerts_test.go index a7c3b14788b..45fd11ee41c 100644 --- a/github/dependabot_alerts_test.go +++ b/github/dependabot_alerts_test.go @@ -131,3 +131,49 @@ func TestDependabotService_ListOrgAlerts(t *testing.T) { return resp, err }) } + +func TestDependabotService_UpdateAlert(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + state := String("dismissed") + dismissedReason := String("no_bandwidth") + dismissedComment := String("no time to fix this") + + alertState := &DependabotAlertState{State: *state, DismissedReason: dismissedReason, DismissedComment: dismissedComment} + + mux.HandleFunc("/repos/o/r/dependabot/alerts/42", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "PATCH") + fmt.Fprint(w, `{"number":42,"state":"dismissed","dismissed_reason":"no_bandwidth","dismissed_comment":"no time to fix this"}`) + }) + + ctx := context.Background() + alert, _, err := client.Dependabot.UpdateAlert(ctx, "o", "r", 42, alertState) + if err != nil { + t.Errorf("Dependabot.UpdateAlert returned error: %v", err) + } + + want := &DependabotAlert{ + Number: Int(42), + State: String("dismissed"), + DismissedReason: String("no_bandwidth"), + DismissedComment: String("no time to fix this"), + } + if !cmp.Equal(alert, want) { + t.Errorf("Dependabot.UpdateAlert returned %+v, want %+v", alert, want) + } + + const methodName = "UpdateAlert" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Dependabot.UpdateAlert(ctx, "\n", "\n", 0, alertState) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Dependabot.UpdateAlert(ctx, "o", "r", 42, alertState) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} diff --git a/github/github-accessors.go b/github/github-accessors.go index fc79d01d7c8..a489d66cd43 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -5302,6 +5302,22 @@ func (d *DependabotAlertEvent) GetSender() *User { return d.Sender } +// GetDismissedComment returns the DismissedComment field if it's non-nil, zero value otherwise. +func (d *DependabotAlertState) GetDismissedComment() string { + if d == nil || d.DismissedComment == nil { + return "" + } + return *d.DismissedComment +} + +// GetDismissedReason returns the DismissedReason field if it's non-nil, zero value otherwise. +func (d *DependabotAlertState) GetDismissedReason() string { + if d == nil || d.DismissedReason == nil { + return "" + } + return *d.DismissedReason +} + // GetCVEID returns the CVEID field if it's non-nil, zero value otherwise. func (d *DependabotSecurityAdvisory) GetCVEID() string { if d == nil || d.CVEID == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index ff4a49d7fb7..2c26fb6ba79 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -6244,6 +6244,26 @@ func TestDependabotAlertEvent_GetSender(tt *testing.T) { d.GetSender() } +func TestDependabotAlertState_GetDismissedComment(tt *testing.T) { + var zeroValue string + d := &DependabotAlertState{DismissedComment: &zeroValue} + d.GetDismissedComment() + d = &DependabotAlertState{} + d.GetDismissedComment() + d = nil + d.GetDismissedComment() +} + +func TestDependabotAlertState_GetDismissedReason(tt *testing.T) { + var zeroValue string + d := &DependabotAlertState{DismissedReason: &zeroValue} + d.GetDismissedReason() + d = &DependabotAlertState{} + d.GetDismissedReason() + d = nil + d.GetDismissedReason() +} + func TestDependabotSecurityAdvisory_GetCVEID(tt *testing.T) { var zeroValue string d := &DependabotSecurityAdvisory{CVEID: &zeroValue} From 887612f2a3ba6de69891efc7c08bd89d453670fd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Nov 2023 15:37:33 -0500 Subject: [PATCH 054/145] Bump golang.org/x/sync from 0.4.0 to 0.5.0 in /tools (#2990) --- tools/go.mod | 2 +- tools/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/go.mod b/tools/go.mod index 8085d1a1ce9..40c58020a6c 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -7,7 +7,7 @@ require ( github.com/getkin/kin-openapi v0.120.0 github.com/google/go-cmp v0.6.0 github.com/google/go-github/v56 v56.0.0 - golang.org/x/sync v0.4.0 + golang.org/x/sync v0.5.0 gopkg.in/yaml.v3 v3.0.1 ) diff --git a/tools/go.sum b/tools/go.sum index 46bc40af389..7e8be0f06e5 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -49,8 +49,8 @@ github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= -golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= -golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= +golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= From 630bfdb865475b476c8abcb2c2ba0ea53736997b Mon Sep 17 00:00:00 2001 From: WillAbides <233500+WillAbides@users.noreply.github.com> Date: Tue, 7 Nov 2023 08:32:04 -0600 Subject: [PATCH 055/145] Deprecate RepositoriesService.List (#2988) --- github/examples_test.go | 6 +- github/repos.go | 148 ++++++++++++++++++++++++++------- github/repos_test.go | 66 +++++++-------- test/integration/repos_test.go | 20 +++-- 4 files changed, 166 insertions(+), 74 deletions(-) diff --git a/github/examples_test.go b/github/examples_test.go index ab319151786..9338e0b6170 100644 --- a/github/examples_test.go +++ b/github/examples_test.go @@ -49,14 +49,14 @@ func ExampleRepositoriesService_GetReadme() { fmt.Printf("google/go-github README:\n%v\n", content) } -func ExampleRepositoriesService_List() { +func ExampleRepositoriesService_ListByUser() { client := github.NewClient(nil) user := "willnorris" - opt := &github.RepositoryListOptions{Type: "owner", Sort: "updated", Direction: "desc"} + opt := &github.RepositoryListByUserOptions{Type: "owner", Sort: "updated", Direction: "desc"} ctx := context.Background() - repos, _, err := client.Repositories.List(ctx, user, opt) + repos, _, err := client.Repositories.ListByUser(ctx, user, opt) if err != nil { fmt.Println(err) } diff --git a/github/repos.go b/github/repos.go index b16cd3b8159..5fcf219b3cf 100644 --- a/github/repos.go +++ b/github/repos.go @@ -173,33 +173,19 @@ type BranchListOptions struct { // RepositoryListOptions specifies the optional parameters to the // RepositoriesService.List method. type RepositoryListOptions struct { - // Visibility of repositories to list. Can be one of all, public, or private. - // Default: all + // See RepositoryListByAuthenticatedUserOptions.Visibility Visibility string `url:"visibility,omitempty"` - // List repos of given affiliation[s]. - // Comma-separated list of values. Can include: - // * owner: Repositories that are owned by the authenticated user. - // * collaborator: Repositories that the user has been added to as a - // collaborator. - // * organization_member: Repositories that the user has access to through - // being a member of an organization. This includes every repository on - // every team that the user is on. - // Default: owner,collaborator,organization_member + // See RepositoryListByAuthenticatedUserOptions.Affiliation Affiliation string `url:"affiliation,omitempty"` - // Type of repositories to list. - // Can be one of all, owner, public, private, member. Default: all - // Will cause a 422 error if used in the same request as visibility or - // affiliation. + // See RepositoryListByUserOptions.Type or RepositoryListByAuthenticatedUserOptions.Type Type string `url:"type,omitempty"` - // How to sort the repository list. Can be one of created, updated, pushed, - // full_name. Default: full_name + // See RepositoryListByUserOptions.Sort or RepositoryListByAuthenticatedUserOptions.Sort Sort string `url:"sort,omitempty"` - // Direction in which to sort repositories. Can be one of asc or desc. - // Default: when using full_name: asc; otherwise desc + // See RepositoryListByUserOptions.Direction or RepositoryListByAuthenticatedUserOptions.Direction Direction string `url:"direction,omitempty"` ListOptions @@ -262,8 +248,10 @@ func (d DependabotSecurityUpdates) String() string { return Stringify(d) } -// List the repositories for a user. Passing the empty string will list -// repositories for the authenticated user. +// List calls either RepositoriesService.ListByUser or RepositoriesService.ListByAuthenticatedUser +// depending on whether user is empty. +// +// Deprecated: Use RepositoriesService.ListByUser or RepositoriesService.ListByAuthenticatedUser instead. // // GitHub API docs: https://docs.github.com/rest/repos/repos#list-repositories-for-a-user // GitHub API docs: https://docs.github.com/rest/repos/repos#list-repositories-for-the-authenticated-user @@ -271,12 +259,55 @@ func (d DependabotSecurityUpdates) String() string { //meta:operation GET /user/repos //meta:operation GET /users/{username}/repos func (s *RepositoriesService) List(ctx context.Context, user string, opts *RepositoryListOptions) ([]*Repository, *Response, error) { - var u string - if user != "" { - u = fmt.Sprintf("users/%v/repos", user) - } else { - u = "user/repos" + if opts == nil { + opts = &RepositoryListOptions{} } + if user != "" { + return s.ListByUser(ctx, user, &RepositoryListByUserOptions{ + Type: opts.Type, + Sort: opts.Sort, + Direction: opts.Direction, + ListOptions: opts.ListOptions, + }) + } + return s.ListByAuthenticatedUser(ctx, &RepositoryListByAuthenticatedUserOptions{ + Visibility: opts.Visibility, + Affiliation: opts.Affiliation, + Type: opts.Type, + Sort: opts.Sort, + Direction: opts.Direction, + ListOptions: opts.ListOptions, + }) +} + +// RepositoryListByUserOptions specifies the optional parameters to the +// RepositoriesService.ListByUser method. +type RepositoryListByUserOptions struct { + // Limit results to repositories of the specified type. + // Default: owner + // Can be one of: all, owner, member + Type string `url:"type,omitempty"` + + // The property to sort the results by. + // Default: full_name + // Can be one of: created, updated, pushed, full_name + Sort string `url:"sort,omitempty"` + + // The order to sort by. + // Default: asc when using full_name, otherwise desc. + // Can be one of: asc, desc + Direction string `url:"direction,omitempty"` + + ListOptions +} + +// ListByUser lists public repositories for the specified user. +// +// GitHub API docs: https://docs.github.com/rest/repos/repos#list-repositories-for-a-user +// +//meta:operation GET /users/{username}/repos +func (s *RepositoriesService) ListByUser(ctx context.Context, user string, opts *RepositoryListByUserOptions) ([]*Repository, *Response, error) { + u := fmt.Sprintf("users/%v/repos", user) u, err := addOptions(u, opts) if err != nil { return nil, nil, err @@ -287,9 +318,68 @@ func (s *RepositoriesService) List(ctx context.Context, user string, opts *Repos return nil, nil, err } - // TODO: remove custom Accept headers when APIs fully launch. - acceptHeaders := []string{mediaTypeTopicsPreview, mediaTypeRepositoryVisibilityPreview} - req.Header.Set("Accept", strings.Join(acceptHeaders, ", ")) + var repos []*Repository + resp, err := s.client.Do(ctx, req, &repos) + if err != nil { + return nil, resp, err + } + + return repos, resp, nil +} + +// RepositoryListByAuthenticatedUserOptions specifies the optional parameters to the +// RepositoriesService.ListByAuthenticatedUser method. +type RepositoryListByAuthenticatedUserOptions struct { + // Limit results to repositories with the specified visibility. + // Default: all + // Can be one of: all, public, private + Visibility string `url:"visibility,omitempty"` + + // List repos of given affiliation[s]. + // Comma-separated list of values. Can include: + // * owner: Repositories that are owned by the authenticated user. + // * collaborator: Repositories that the user has been added to as a + // collaborator. + // * organization_member: Repositories that the user has access to through + // being a member of an organization. This includes every repository on + // every team that the user is on. + // Default: owner,collaborator,organization_member + Affiliation string `url:"affiliation,omitempty"` + + // Limit results to repositories of the specified type. Will cause a 422 error if + // used in the same request as visibility or affiliation. + // Default: all + // Can be one of: all, owner, public, private, member + Type string `url:"type,omitempty"` + + // The property to sort the results by. + // Default: full_name + // Can be one of: created, updated, pushed, full_name + Sort string `url:"sort,omitempty"` + + // Direction in which to sort repositories. Can be one of asc or desc. + // Default: when using full_name: asc; otherwise desc + Direction string `url:"direction,omitempty"` + + ListOptions +} + +// ListByAuthenticatedUser lists repositories for the authenticated user. +// +// GitHub API docs: https://docs.github.com/rest/repos/repos#list-repositories-for-the-authenticated-user +// +//meta:operation GET /user/repos +func (s *RepositoriesService) ListByAuthenticatedUser(ctx context.Context, opts *RepositoryListByAuthenticatedUserOptions) ([]*Repository, *Response, error) { + u := "user/repos" + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } var repos []*Repository resp, err := s.client.Do(ctx, req, &repos) diff --git a/github/repos_test.go b/github/repos_test.go index 2bdc1b4289d..fa49ddd4f5c 100644 --- a/github/repos_test.go +++ b/github/repos_test.go @@ -18,36 +18,30 @@ import ( "github.com/google/go-cmp/cmp" ) -func TestRepositoriesService_List_authenticatedUser(t *testing.T) { +func TestRepositoriesService_ListByAuthenticatedUser(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - wantAcceptHeaders := []string{mediaTypeTopicsPreview, mediaTypeRepositoryVisibilityPreview} mux.HandleFunc("/user/repos", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) fmt.Fprint(w, `[{"id":1},{"id":2}]`) }) ctx := context.Background() - got, _, err := client.Repositories.List(ctx, "", nil) + got, _, err := client.Repositories.ListByAuthenticatedUser(ctx, nil) if err != nil { t.Errorf("Repositories.List returned error: %v", err) } want := []*Repository{{ID: Int64(1)}, {ID: Int64(2)}} if !cmp.Equal(got, want) { - t.Errorf("Repositories.List returned %+v, want %+v", got, want) + t.Errorf("Repositories.ListByAuthenticatedUser returned %+v, want %+v", got, want) } - const methodName = "List" - testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Repositories.List(ctx, "\n", &RepositoryListOptions{}) - return err - }) + const methodName = "ListByAuthenticatedUser" testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Repositories.List(ctx, "", nil) + got, resp, err := client.Repositories.ListByAuthenticatedUser(ctx, nil) if got != nil { t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) } @@ -55,78 +49,84 @@ func TestRepositoriesService_List_authenticatedUser(t *testing.T) { }) } -func TestRepositoriesService_List_specifiedUser(t *testing.T) { +func TestRepositoriesService_ListByUser(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - wantAcceptHeaders := []string{mediaTypeTopicsPreview, mediaTypeRepositoryVisibilityPreview} mux.HandleFunc("/users/u/repos", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) testFormValues(t, r, values{ - "visibility": "public", - "affiliation": "owner,collaborator", - "sort": "created", - "direction": "asc", - "page": "2", + "sort": "created", + "direction": "asc", + "page": "2", }) fmt.Fprint(w, `[{"id":1}]`) }) - opt := &RepositoryListOptions{ - Visibility: "public", - Affiliation: "owner,collaborator", + opt := &RepositoryListByUserOptions{ Sort: "created", Direction: "asc", ListOptions: ListOptions{Page: 2}, } ctx := context.Background() - repos, _, err := client.Repositories.List(ctx, "u", opt) + repos, _, err := client.Repositories.ListByUser(ctx, "u", opt) if err != nil { t.Errorf("Repositories.List returned error: %v", err) } want := []*Repository{{ID: Int64(1)}} if !cmp.Equal(repos, want) { - t.Errorf("Repositories.List returned %+v, want %+v", repos, want) + t.Errorf("Repositories.ListByUser returned %+v, want %+v", repos, want) } + + const methodName = "ListByUser" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Repositories.ListByUser(ctx, "\n", &RepositoryListByUserOptions{}) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Repositories.ListByUser(ctx, "u", nil) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) } -func TestRepositoriesService_List_specifiedUser_type(t *testing.T) { +func TestRepositoriesService_ListByUser_type(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - wantAcceptHeaders := []string{mediaTypeTopicsPreview, mediaTypeRepositoryVisibilityPreview} mux.HandleFunc("/users/u/repos", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) testFormValues(t, r, values{ "type": "owner", }) fmt.Fprint(w, `[{"id":1}]`) }) - opt := &RepositoryListOptions{ + opt := &RepositoryListByUserOptions{ Type: "owner", } ctx := context.Background() - repos, _, err := client.Repositories.List(ctx, "u", opt) + repos, _, err := client.Repositories.ListByUser(ctx, "u", opt) if err != nil { - t.Errorf("Repositories.List returned error: %v", err) + t.Errorf("Repositories.ListByUser returned error: %v", err) } want := []*Repository{{ID: Int64(1)}} if !cmp.Equal(repos, want) { - t.Errorf("Repositories.List returned %+v, want %+v", repos, want) + t.Errorf("Repositories.ListByUser returned %+v, want %+v", repos, want) } } -func TestRepositoriesService_List_invalidUser(t *testing.T) { +func TestRepositoriesService_ListByUser_invalidUser(t *testing.T) { client, _, _, teardown := setup() defer teardown() ctx := context.Background() - _, _, err := client.Repositories.List(ctx, "%", nil) + _, _, err := client.Repositories.ListByUser(ctx, "%", nil) testURLParseError(t, err) } diff --git a/test/integration/repos_test.go b/test/integration/repos_test.go index b0fa75cb8fc..39a99fef98f 100644 --- a/test/integration/repos_test.go +++ b/test/integration/repos_test.go @@ -157,29 +157,31 @@ func TestRepositories_EditBranches(t *testing.T) { } } -func TestRepositories_List(t *testing.T) { - if !checkAuth("TestRepositories_List") { +func TestRepositories_ListByAuthenticatedUser(t *testing.T) { + if !checkAuth("TestRepositories_ListByAuthenticatedUser") { return } - _, _, err := client.Repositories.List(context.Background(), "", nil) + _, _, err := client.Repositories.ListByAuthenticatedUser(context.Background(), nil) if err != nil { - t.Fatalf("Repositories.List('') returned error: %v", err) + t.Fatalf("Repositories.ListByAuthenticatedUser() returned error: %v", err) } +} - _, _, err = client.Repositories.List(context.Background(), "google", nil) +func TestRepositories_ListByUser(t *testing.T) { + _, _, err := client.Repositories.ListByUser(context.Background(), "google", nil) if err != nil { - t.Fatalf("Repositories.List('google') returned error: %v", err) + t.Fatalf("Repositories.ListByUser('google') returned error: %v", err) } - opt := github.RepositoryListOptions{Sort: "created"} - repos, _, err := client.Repositories.List(context.Background(), "google", &opt) + opt := github.RepositoryListByUserOptions{Sort: "created"} + repos, _, err := client.Repositories.ListByUser(context.Background(), "google", &opt) if err != nil { t.Fatalf("Repositories.List('google') with Sort opt returned error: %v", err) } for i, repo := range repos { if i > 0 && (*repos[i-1].CreatedAt).Time.Before((*repo.CreatedAt).Time) { - t.Fatalf("Repositories.List('google') with default descending Sort returned incorrect order") + t.Fatalf("Repositories.ListByUser('google') with default descending Sort returned incorrect order") } } } From 14dccc27fc2b03095c8e766bf364ec12c45a19a8 Mon Sep 17 00:00:00 2001 From: Claystation Date: Wed, 8 Nov 2023 17:37:41 +0100 Subject: [PATCH 056/145] Add support for Required Workflows (#2979) Fixes: #2978. --- github/github-accessors.go | 24 ++++++++++++++++++++++ github/github-accessors_test.go | 30 ++++++++++++++++++++++++++++ github/repos_rules.go | 35 +++++++++++++++++++++++++++++++++ github/repos_rules_test.go | 11 +++++++++++ 4 files changed, 100 insertions(+) diff --git a/github/github-accessors.go b/github/github-accessors.go index a489d66cd43..bcae7636d0a 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -20358,6 +20358,30 @@ func (r *RuleRequiredStatusChecks) GetIntegrationID() int64 { return *r.IntegrationID } +// GetRef returns the Ref field if it's non-nil, zero value otherwise. +func (r *RuleRequiredWorkflow) GetRef() string { + if r == nil || r.Ref == nil { + return "" + } + return *r.Ref +} + +// GetRepositoryID returns the RepositoryID field if it's non-nil, zero value otherwise. +func (r *RuleRequiredWorkflow) GetRepositoryID() int64 { + if r == nil || r.RepositoryID == nil { + return 0 + } + return *r.RepositoryID +} + +// GetSha returns the Sha field if it's non-nil, zero value otherwise. +func (r *RuleRequiredWorkflow) GetSha() string { + if r == nil || r.Sha == nil { + return "" + } + return *r.Sha +} + // GetConditions returns the Conditions field. func (r *Ruleset) GetConditions() *RulesetConditions { if r == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 2c26fb6ba79..36feed7fe8e 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -23678,6 +23678,36 @@ func TestRuleRequiredStatusChecks_GetIntegrationID(tt *testing.T) { r.GetIntegrationID() } +func TestRuleRequiredWorkflow_GetRef(tt *testing.T) { + var zeroValue string + r := &RuleRequiredWorkflow{Ref: &zeroValue} + r.GetRef() + r = &RuleRequiredWorkflow{} + r.GetRef() + r = nil + r.GetRef() +} + +func TestRuleRequiredWorkflow_GetRepositoryID(tt *testing.T) { + var zeroValue int64 + r := &RuleRequiredWorkflow{RepositoryID: &zeroValue} + r.GetRepositoryID() + r = &RuleRequiredWorkflow{} + r.GetRepositoryID() + r = nil + r.GetRepositoryID() +} + +func TestRuleRequiredWorkflow_GetSha(tt *testing.T) { + var zeroValue string + r := &RuleRequiredWorkflow{Sha: &zeroValue} + r.GetSha() + r = &RuleRequiredWorkflow{} + r.GetSha() + r = nil + r.GetSha() +} + func TestRuleset_GetConditions(tt *testing.T) { r := &Ruleset{} r.GetConditions() diff --git a/github/repos_rules.go b/github/repos_rules.go index b47b37038ed..479806c2ee9 100644 --- a/github/repos_rules.go +++ b/github/repos_rules.go @@ -97,6 +97,19 @@ type RequiredStatusChecksRuleParameters struct { StrictRequiredStatusChecksPolicy bool `json:"strict_required_status_checks_policy"` } +// RuleRequiredWorkflow represents the Workflow for the RequireWorkflowsRuleParameters object. +type RuleRequiredWorkflow struct { + Path string `json:"path"` + Ref *string `json:"ref,omitempty"` + RepositoryID *int64 `json:"repository_id,omitempty"` + Sha *string `json:"sha,omitempty"` +} + +// RequiredWorkflowsRuleParameters represents the workflows rule parameters. +type RequiredWorkflowsRuleParameters struct { + RequiredWorkflows []*RuleRequiredWorkflow `json:"workflows"` +} + // RepositoryRule represents a GitHub Rule. type RepositoryRule struct { Type string `json:"type"` @@ -171,6 +184,16 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error { bytes, _ := json.Marshal(params) rawParams := json.RawMessage(bytes) + r.Parameters = &rawParams + case "workflows": + params := RequiredWorkflowsRuleParameters{} + if err := json.Unmarshal(*RepositoryRule.Parameters, ¶ms); err != nil { + return err + } + + bytes, _ := json.Marshal(params) + rawParams := json.RawMessage(bytes) + r.Parameters = &rawParams default: r.Type = "" @@ -329,6 +352,18 @@ func NewTagNamePatternRule(params *RulePatternParameters) (rule *RepositoryRule) } } +// NewRequiredWorkflowsRule creates a rule to require which status checks must pass before branches can be merged into a branch rule. +func NewRequiredWorkflowsRule(params *RequiredWorkflowsRuleParameters) (rule *RepositoryRule) { + bytes, _ := json.Marshal(params) + + rawParams := json.RawMessage(bytes) + + return &RepositoryRule{ + Type: "workflows", + Parameters: &rawParams, + } +} + // Ruleset represents a GitHub ruleset object. type Ruleset struct { ID *int64 `json:"id,omitempty"` diff --git a/github/repos_rules_test.go b/github/repos_rules_test.go index a57137c688d..cd8e49c2e07 100644 --- a/github/repos_rules_test.go +++ b/github/repos_rules_test.go @@ -215,6 +215,17 @@ func TestRepositoryRule_UnmarshalJSON(t *testing.T) { }, wantErr: true, }, + "Required workflows params": { + data: `{"type":"workflows","parameters":{"workflows":[{"path": ".github/workflows/test.yml", "repository_id": 1}]}}`, + want: NewRequiredWorkflowsRule(&RequiredWorkflowsRuleParameters{ + RequiredWorkflows: []*RuleRequiredWorkflow{ + { + Path: ".github/workflows/test.yml", + RepositoryID: Int64(1), + }, + }, + }), + }, "Invalid type": { data: `{"type":"unknown"}`, want: &RepositoryRule{ From 3b96fb363f3e1c607f87f1a9e4051f2c4431055d Mon Sep 17 00:00:00 2001 From: Daniel Liao <10663736+liaodaniel@users.noreply.github.com> Date: Fri, 10 Nov 2023 14:36:15 +1100 Subject: [PATCH 057/145] Implement Custom Properties (#2986) Fixes: #2965. --- github/github-accessors.go | 40 ++++ github/github-accessors_test.go | 50 +++++ github/orgs_properties.go | 198 +++++++++++++++++ github/orgs_properties_test.go | 369 ++++++++++++++++++++++++++++++++ 4 files changed, 657 insertions(+) create mode 100644 github/orgs_properties.go create mode 100644 github/orgs_properties_test.go diff --git a/github/github-accessors.go b/github/github-accessors.go index bcae7636d0a..536ce5a8407 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -4990,6 +4990,46 @@ func (c *CredentialAuthorization) GetTokenLastEight() string { return *c.TokenLastEight } +// GetDefaultValue returns the DefaultValue field if it's non-nil, zero value otherwise. +func (c *CustomProperty) GetDefaultValue() string { + if c == nil || c.DefaultValue == nil { + return "" + } + return *c.DefaultValue +} + +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (c *CustomProperty) GetDescription() string { + if c == nil || c.Description == nil { + return "" + } + return *c.Description +} + +// GetPropertyName returns the PropertyName field if it's non-nil, zero value otherwise. +func (c *CustomProperty) GetPropertyName() string { + if c == nil || c.PropertyName == nil { + return "" + } + return *c.PropertyName +} + +// GetRequired returns the Required field if it's non-nil, zero value otherwise. +func (c *CustomProperty) GetRequired() bool { + if c == nil || c.Required == nil { + return false + } + return *c.Required +} + +// GetValue returns the Value field if it's non-nil, zero value otherwise. +func (c *CustomPropertyValue) GetValue() string { + if c == nil || c.Value == nil { + return "" + } + return *c.Value +} + // GetBaseRole returns the BaseRole field if it's non-nil, zero value otherwise. func (c *CustomRepoRoles) GetBaseRole() string { if c == nil || c.BaseRole == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 36feed7fe8e..abe96ecf98f 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -5899,6 +5899,56 @@ func TestCredentialAuthorization_GetTokenLastEight(tt *testing.T) { c.GetTokenLastEight() } +func TestCustomProperty_GetDefaultValue(tt *testing.T) { + var zeroValue string + c := &CustomProperty{DefaultValue: &zeroValue} + c.GetDefaultValue() + c = &CustomProperty{} + c.GetDefaultValue() + c = nil + c.GetDefaultValue() +} + +func TestCustomProperty_GetDescription(tt *testing.T) { + var zeroValue string + c := &CustomProperty{Description: &zeroValue} + c.GetDescription() + c = &CustomProperty{} + c.GetDescription() + c = nil + c.GetDescription() +} + +func TestCustomProperty_GetPropertyName(tt *testing.T) { + var zeroValue string + c := &CustomProperty{PropertyName: &zeroValue} + c.GetPropertyName() + c = &CustomProperty{} + c.GetPropertyName() + c = nil + c.GetPropertyName() +} + +func TestCustomProperty_GetRequired(tt *testing.T) { + var zeroValue bool + c := &CustomProperty{Required: &zeroValue} + c.GetRequired() + c = &CustomProperty{} + c.GetRequired() + c = nil + c.GetRequired() +} + +func TestCustomPropertyValue_GetValue(tt *testing.T) { + var zeroValue string + c := &CustomPropertyValue{Value: &zeroValue} + c.GetValue() + c = &CustomPropertyValue{} + c.GetValue() + c = nil + c.GetValue() +} + func TestCustomRepoRoles_GetBaseRole(tt *testing.T) { var zeroValue string c := &CustomRepoRoles{BaseRole: &zeroValue} diff --git a/github/orgs_properties.go b/github/orgs_properties.go new file mode 100644 index 00000000000..1daac811804 --- /dev/null +++ b/github/orgs_properties.go @@ -0,0 +1,198 @@ +// Copyright 2023 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// CustomProperty represents an organization custom property object. +type CustomProperty struct { + // PropertyName is required for most endpoints except when calling CreateOrUpdateCustomProperty; + // where this is sent in the path and thus can be omitted. + PropertyName *string `json:"property_name,omitempty"` + // Possible values for ValueType are: string, single_select + ValueType string `json:"value_type"` + Required *bool `json:"required,omitempty"` + DefaultValue *string `json:"default_value,omitempty"` + Description *string `json:"description,omitempty"` + AllowedValues []string `json:"allowed_values,omitempty"` +} + +// RepoCustomPropertyValue represents a repository custom property value. +type RepoCustomPropertyValue struct { + RepositoryID int64 `json:"repository_id"` + RepositoryName string `json:"repository_name"` + RepositoryFullName string `json:"repository_full_name"` + Properties []*CustomPropertyValue `json:"properties"` +} + +// CustomPropertyValue represents a custom property value. +type CustomPropertyValue struct { + PropertyName string `json:"property_name"` + Value *string `json:"value,omitempty"` +} + +// GetAllCustomProperties gets all custom properties that are defined for the specified organization. +// +// GitHub API docs: https://docs.github.com/rest/orgs/properties#get-all-custom-properties-for-an-organization +// +//meta:operation GET /orgs/{org}/properties/schema +func (s *OrganizationsService) GetAllCustomProperties(ctx context.Context, org string) ([]*CustomProperty, *Response, error) { + u := fmt.Sprintf("orgs/%v/properties/schema", org) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var customProperties []*CustomProperty + resp, err := s.client.Do(ctx, req, &customProperties) + if err != nil { + return nil, resp, err + } + + return customProperties, resp, nil +} + +// CreateOrUpdateCustomProperties creates new or updates existing custom properties that are defined for the specified organization. +// +// GitHub API docs: https://docs.github.com/rest/orgs/properties#create-or-update-custom-properties-for-an-organization +// +//meta:operation PATCH /orgs/{org}/properties/schema +func (s *OrganizationsService) CreateOrUpdateCustomProperties(ctx context.Context, org string, properties []*CustomProperty) ([]*CustomProperty, *Response, error) { + u := fmt.Sprintf("orgs/%v/properties/schema", org) + + params := struct { + Properties []*CustomProperty `json:"properties"` + }{ + Properties: properties, + } + + req, err := s.client.NewRequest("PATCH", u, params) + if err != nil { + return nil, nil, err + } + + var customProperties []*CustomProperty + resp, err := s.client.Do(ctx, req, &customProperties) + if err != nil { + return nil, resp, err + } + + return customProperties, resp, nil +} + +// GetCustomProperty gets a custom property that is defined for the specified organization. +// +// GitHub API docs: https://docs.github.com/rest/orgs/properties#get-a-custom-property-for-an-organization +// +//meta:operation GET /orgs/{org}/properties/schema/{custom_property_name} +func (s *OrganizationsService) GetCustomProperty(ctx context.Context, org, name string) (*CustomProperty, *Response, error) { + u := fmt.Sprintf("orgs/%v/properties/schema/%v", org, name) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var customProperty *CustomProperty + resp, err := s.client.Do(ctx, req, &customProperty) + if err != nil { + return nil, resp, err + } + + return customProperty, resp, nil +} + +// CreateOrUpdateCustomProperty creates a new or updates an existing custom property that is defined for the specified organization. +// +// GitHub API docs: https://docs.github.com/rest/orgs/properties#create-or-update-a-custom-property-for-an-organization +// +//meta:operation PUT /orgs/{org}/properties/schema/{custom_property_name} +func (s *OrganizationsService) CreateOrUpdateCustomProperty(ctx context.Context, org, customPropertyName string, property *CustomProperty) (*CustomProperty, *Response, error) { + u := fmt.Sprintf("orgs/%v/properties/schema/%v", org, customPropertyName) + + req, err := s.client.NewRequest("PUT", u, property) + if err != nil { + return nil, nil, err + } + + var customProperty *CustomProperty + resp, err := s.client.Do(ctx, req, &customProperty) + if err != nil { + return nil, resp, err + } + + return customProperty, resp, nil +} + +// RemoveCustomProperty removes a custom property that is defined for the specified organization. +// +// GitHub API docs: https://docs.github.com/rest/orgs/properties#remove-a-custom-property-for-an-organization +// +//meta:operation DELETE /orgs/{org}/properties/schema/{custom_property_name} +func (s *OrganizationsService) RemoveCustomProperty(ctx context.Context, org, customPropertyName string) (*Response, error) { + u := fmt.Sprintf("orgs/%v/properties/schema/%v", org, customPropertyName) + + req, err := s.client.NewRequest("DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, req, nil) +} + +// ListCustomPropertyValues lists all custom property values for repositories in the specified organization. +// +// GitHub API docs: https://docs.github.com/rest/orgs/properties#list-custom-property-values-for-organization-repositories +// +//meta:operation GET /orgs/{org}/properties/values +func (s *OrganizationsService) ListCustomPropertyValues(ctx context.Context, org string, opts *ListOptions) ([]*RepoCustomPropertyValue, *Response, error) { + u := fmt.Sprintf("orgs/%v/properties/values", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var repoCustomPropertyValues []*RepoCustomPropertyValue + resp, err := s.client.Do(ctx, req, &repoCustomPropertyValues) + if err != nil { + return nil, resp, err + } + + return repoCustomPropertyValues, resp, nil +} + +// CreateOrUpdateRepoCustomPropertyValues creates new or updates existing custom property values across multiple repositories for the specified organization. +// +// GitHub API docs: https://docs.github.com/rest/orgs/properties#create-or-update-custom-property-values-for-organization-repositories +// +//meta:operation PATCH /orgs/{org}/properties/values +func (s *OrganizationsService) CreateOrUpdateRepoCustomPropertyValues(ctx context.Context, org string, repoNames []string, properties []*CustomProperty) (*Response, error) { + u := fmt.Sprintf("orgs/%v/properties/values", org) + + params := struct { + RepositoryNames []string `json:"repository_names"` + Properties []*CustomProperty `json:"properties"` + }{ + RepositoryNames: repoNames, + Properties: properties, + } + + req, err := s.client.NewRequest("PATCH", u, params) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, req, nil) +} diff --git a/github/orgs_properties_test.go b/github/orgs_properties_test.go new file mode 100644 index 00000000000..1a372306046 --- /dev/null +++ b/github/orgs_properties_test.go @@ -0,0 +1,369 @@ +// Copyright 2023 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" + "net/http" + "testing" + + "github.com/google/go-cmp/cmp" +) + +func TestOrganizationsService_GetAllCustomProperties(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/orgs/o/properties/schema", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + fmt.Fprint(w, `[ + { + "property_name": "name", + "value_type": "single_select", + "required": true, + "default_value": "production", + "description": "Prod or dev environment", + "allowed_values":[ + "production", + "development" + ] + }, + { + "property_name": "service", + "value_type": "string" + }, + { + "property_name": "team", + "value_type": "string", + "description": "Team owning the repository" + } + ]`) + }) + + ctx := context.Background() + properties, _, err := client.Organizations.GetAllCustomProperties(ctx, "o") + if err != nil { + t.Errorf("Organizations.GetAllCustomProperties returned error: %v", err) + } + + want := []*CustomProperty{ + { + PropertyName: String("name"), + ValueType: "single_select", + Required: Bool(true), + DefaultValue: String("production"), + Description: String("Prod or dev environment"), + AllowedValues: []string{"production", "development"}, + }, + { + PropertyName: String("service"), + ValueType: "string", + }, + { + PropertyName: String("team"), + ValueType: "string", + Description: String("Team owning the repository"), + }, + } + if !cmp.Equal(properties, want) { + t.Errorf("Organizations.GetAllCustomProperties returned %+v, want %+v", properties, want) + } + + const methodName = "GetAllCustomProperties" + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Organizations.GetAllCustomProperties(ctx, "o") + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestOrganizationsService_CreateOrUpdateCustomProperties(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/orgs/o/properties/schema", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "PATCH") + testBody(t, r, `{"properties":[{"property_name":"name","value_type":"single_select","required":true},{"property_name":"service","value_type":"string"}]}`+"\n") + fmt.Fprint(w, `[ + { + "property_name": "name", + "value_type": "single_select", + "required": true + }, + { + "property_name": "service", + "value_type": "string" + } + ]`) + }) + + ctx := context.Background() + properties, _, err := client.Organizations.CreateOrUpdateCustomProperties(ctx, "o", []*CustomProperty{ + { + PropertyName: String("name"), + ValueType: "single_select", + Required: Bool(true), + }, + { + PropertyName: String("service"), + ValueType: "string", + }, + }) + if err != nil { + t.Errorf("Organizations.CreateOrUpdateCustomProperties returned error: %v", err) + } + + want := []*CustomProperty{ + { + PropertyName: String("name"), + ValueType: "single_select", + Required: Bool(true), + }, + { + PropertyName: String("service"), + ValueType: "string", + }, + } + + if !cmp.Equal(properties, want) { + t.Errorf("Organizations.CreateOrUpdateCustomProperties returned %+v, want %+v", properties, want) + } + + const methodName = "CreateOrUpdateCustomProperties" + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Organizations.CreateOrUpdateCustomProperties(ctx, "o", nil) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestOrganizationsService_GetCustomProperty(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/orgs/o/properties/schema/name", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + fmt.Fprint(w, `{ + "property_name": "name", + "value_type": "single_select", + "required": true, + "default_value": "production", + "description": "Prod or dev environment", + "allowed_values":[ + "production", + "development" + ] + }`) + }) + + ctx := context.Background() + property, _, err := client.Organizations.GetCustomProperty(ctx, "o", "name") + if err != nil { + t.Errorf("Organizations.GetCustomProperty returned error: %v", err) + } + + want := &CustomProperty{ + PropertyName: String("name"), + ValueType: "single_select", + Required: Bool(true), + DefaultValue: String("production"), + Description: String("Prod or dev environment"), + AllowedValues: []string{"production", "development"}, + } + if !cmp.Equal(property, want) { + t.Errorf("Organizations.GetCustomProperty returned %+v, want %+v", property, want) + } + + const methodName = "GetCustomProperty" + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Organizations.GetCustomProperty(ctx, "o", "name") + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestOrganizationsService_CreateOrUpdateCustomProperty(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/orgs/o/properties/schema/name", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "PUT") + fmt.Fprint(w, `{ + "property_name": "name", + "value_type": "single_select", + "required": true, + "default_value": "production", + "description": "Prod or dev environment", + "allowed_values":[ + "production", + "development" + ] + }`) + }) + + ctx := context.Background() + property, _, err := client.Organizations.CreateOrUpdateCustomProperty(ctx, "o", "name", &CustomProperty{ + ValueType: "single_select", + Required: Bool(true), + DefaultValue: String("production"), + Description: String("Prod or dev environment"), + AllowedValues: []string{"production", "development"}, + }) + if err != nil { + t.Errorf("Organizations.CreateOrUpdateCustomProperty returned error: %v", err) + } + + want := &CustomProperty{ + PropertyName: String("name"), + ValueType: "single_select", + Required: Bool(true), + DefaultValue: String("production"), + Description: String("Prod or dev environment"), + AllowedValues: []string{"production", "development"}, + } + if !cmp.Equal(property, want) { + t.Errorf("Organizations.CreateOrUpdateCustomProperty returned %+v, want %+v", property, want) + } + + const methodName = "CreateOrUpdateCustomProperty" + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Organizations.CreateOrUpdateCustomProperty(ctx, "o", "name", nil) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestOrganizationsService_RemoveCustomProperty(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/orgs/o/properties/schema/name", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "DELETE") + }) + + ctx := context.Background() + _, err := client.Organizations.RemoveCustomProperty(ctx, "o", "name") + if err != nil { + t.Errorf("Organizations.RemoveCustomProperty returned error: %v", err) + } + + const methodName = "RemoveCustomProperty" + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + return client.Organizations.RemoveCustomProperty(ctx, "0", "name") + }) +} + +func TestOrganizationsService_ListCustomPropertyValues(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/orgs/o/properties/values", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + testFormValues(t, r, values{"page": "1", "per_page": "100"}) + fmt.Fprint(w, `[{ + "repository_id": 1296269, + "repository_name": "Hello-World", + "repository_full_name": "octocat/Hello-World", + "properties": [ + { + "property_name": "environment", + "value": "production" + }, + { + "property_name": "service", + "value": "web" + } + ] + }]`) + }) + + ctx := context.Background() + repoPropertyValues, _, err := client.Organizations.ListCustomPropertyValues(ctx, "o", &ListOptions{ + Page: 1, + PerPage: 100, + }) + if err != nil { + t.Errorf("Organizations.ListCustomPropertyValues returned error: %v", err) + } + + want := []*RepoCustomPropertyValue{ + { + RepositoryID: 1296269, + RepositoryName: "Hello-World", + RepositoryFullName: "octocat/Hello-World", + Properties: []*CustomPropertyValue{ + { + PropertyName: "environment", + Value: String("production"), + }, + { + PropertyName: "service", + Value: String("web"), + }, + }, + }, + } + + if !cmp.Equal(repoPropertyValues, want) { + t.Errorf("Organizations.ListCustomPropertyValues returned %+v, want %+v", repoPropertyValues, want) + } + + const methodName = "ListCustomPropertyValues" + + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Organizations.ListCustomPropertyValues(ctx, "\n", &ListOptions{}) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Organizations.ListCustomPropertyValues(ctx, "o", nil) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestOrganizationsService_CreateOrUpdateRepoCustomPropertyValues(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/orgs/o/properties/values", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "PATCH") + testBody(t, r, `{"repository_names":["repo"],"properties":[{"property_name":"service","value_type":"string"}]}`+"\n") + }) + + ctx := context.Background() + _, err := client.Organizations.CreateOrUpdateRepoCustomPropertyValues(ctx, "o", []string{"repo"}, []*CustomProperty{ + { + PropertyName: String("service"), + ValueType: "string", + }, + }) + if err != nil { + t.Errorf("Organizations.CreateOrUpdateCustomPropertyValuesForRepos returned error: %v", err) + } + + const methodName = "CreateOrUpdateCustomPropertyValuesForRepos" + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + return client.Organizations.CreateOrUpdateRepoCustomPropertyValues(ctx, "o", nil, nil) + }) +} From 78c6de0b72ac4f5205eaa31a19c57fb18a510400 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 Nov 2023 18:07:24 -0500 Subject: [PATCH 058/145] Bump golang.org/x/net from 0.17.0 to 0.18.0 in /scrape (#2991) --- scrape/go.mod | 2 +- scrape/go.sum | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/scrape/go.mod b/scrape/go.mod index 22bd9bf60ec..95c03591b22 100644 --- a/scrape/go.mod +++ b/scrape/go.mod @@ -7,5 +7,5 @@ require ( github.com/google/go-cmp v0.6.0 github.com/google/go-github/v56 v56.0.0 github.com/xlzd/gotp v0.1.0 - golang.org/x/net v0.17.0 + golang.org/x/net v0.18.0 ) diff --git a/scrape/go.sum b/scrape/go.sum index d7b761f318d..78483af2cbf 100644 --- a/scrape/go.sum +++ b/scrape/go.sum @@ -15,7 +15,7 @@ github.com/xlzd/gotp v0.1.0/go.mod h1:ndLJ3JKzi3xLmUProq4LLxCuECL93dG9WASNLpHz8q github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -25,8 +25,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg= +golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -38,19 +38,19 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= -golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= +golang.org/x/term v0.14.0/go.mod h1:TySc+nGkYR6qt8km8wUhuFRTVSMIX3XPR58y2lC8vww= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= From a5f292c3c1585781bf3236aa481cd6fef626d3e8 Mon Sep 17 00:00:00 2001 From: Casey Date: Wed, 22 Nov 2023 11:48:39 -0800 Subject: [PATCH 059/145] Add default branch to repository edit event (#2995) Fixes: #2994. --- github/event_types.go | 16 +++++++++++----- github/github-accessors.go | 16 ++++++++++++++++ github/github-accessors_test.go | 17 +++++++++++++++++ 3 files changed, 44 insertions(+), 5 deletions(-) diff --git a/github/event_types.go b/github/event_types.go index 6ff1eb84851..327fc561662 100644 --- a/github/event_types.go +++ b/github/event_types.go @@ -388,11 +388,12 @@ type GollumEvent struct { // EditChange represents the changes when an issue, pull request, comment, // or repository has been edited. type EditChange struct { - Title *EditTitle `json:"title,omitempty"` - Body *EditBody `json:"body,omitempty"` - Base *EditBase `json:"base,omitempty"` - Repo *EditRepo `json:"repository,omitempty"` - Owner *EditOwner `json:"owner,omitempty"` + Title *EditTitle `json:"title,omitempty"` + Body *EditBody `json:"body,omitempty"` + Base *EditBase `json:"base,omitempty"` + Repo *EditRepo `json:"repository,omitempty"` + Owner *EditOwner `json:"owner,omitempty"` + DefaultBranch *EditDefaultBranch `json:"default_branch,omitempty"` } // EditTitle represents a pull-request title change. @@ -442,6 +443,11 @@ type EditSHA struct { From *string `json:"from,omitempty"` } +// EditDefaultBranch represents a change of repository's default branch name. +type EditDefaultBranch struct { + From *string `json:"from,omitempty"` +} + // ProjectChange represents the changes when a project has been edited. type ProjectChange struct { Name *ProjectName `json:"name,omitempty"` diff --git a/github/github-accessors.go b/github/github-accessors.go index 536ce5a8407..541be64a8de 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -6678,6 +6678,14 @@ func (e *EditChange) GetBody() *EditBody { return e.Body } +// GetDefaultBranch returns the DefaultBranch field. +func (e *EditChange) GetDefaultBranch() *EditDefaultBranch { + if e == nil { + return nil + } + return e.DefaultBranch +} + // GetOwner returns the Owner field. func (e *EditChange) GetOwner() *EditOwner { if e == nil { @@ -6702,6 +6710,14 @@ func (e *EditChange) GetTitle() *EditTitle { return e.Title } +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (e *EditDefaultBranch) GetFrom() string { + if e == nil || e.From == nil { + return "" + } + return *e.From +} + // GetOwnerInfo returns the OwnerInfo field. func (e *EditOwner) GetOwnerInfo() *OwnerInfo { if e == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index abe96ecf98f..49ed8eee086 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -7826,6 +7826,13 @@ func TestEditChange_GetBody(tt *testing.T) { e.GetBody() } +func TestEditChange_GetDefaultBranch(tt *testing.T) { + e := &EditChange{} + e.GetDefaultBranch() + e = nil + e.GetDefaultBranch() +} + func TestEditChange_GetOwner(tt *testing.T) { e := &EditChange{} e.GetOwner() @@ -7847,6 +7854,16 @@ func TestEditChange_GetTitle(tt *testing.T) { e.GetTitle() } +func TestEditDefaultBranch_GetFrom(tt *testing.T) { + var zeroValue string + e := &EditDefaultBranch{From: &zeroValue} + e.GetFrom() + e = &EditDefaultBranch{} + e.GetFrom() + e = nil + e.GetFrom() +} + func TestEditOwner_GetOwnerInfo(tt *testing.T) { e := &EditOwner{} e.GetOwnerInfo() From 942692ee973fd8b917b182fe5cb0a0c5bf5290fe Mon Sep 17 00:00:00 2001 From: Casey Date: Wed, 22 Nov 2023 19:03:06 -0800 Subject: [PATCH 060/145] Add `Draft` to `Issue` type (#2997) Fixes: #2996. --- github/github-accessors.go | 8 ++++++++ github/github-accessors_test.go | 10 ++++++++++ github/github-stringify_test.go | 3 ++- github/issues.go | 1 + 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/github/github-accessors.go b/github/github-accessors.go index 541be64a8de..d5696279d43 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -9406,6 +9406,14 @@ func (i *Issue) GetCreatedAt() Timestamp { return *i.CreatedAt } +// GetDraft returns the Draft field if it's non-nil, zero value otherwise. +func (i *Issue) GetDraft() bool { + if i == nil || i.Draft == nil { + return false + } + return *i.Draft +} + // GetEventsURL returns the EventsURL field if it's non-nil, zero value otherwise. func (i *Issue) GetEventsURL() string { if i == nil || i.EventsURL == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 49ed8eee086..3ad4b6b2ecf 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -11041,6 +11041,16 @@ func TestIssue_GetCreatedAt(tt *testing.T) { i.GetCreatedAt() } +func TestIssue_GetDraft(tt *testing.T) { + var zeroValue bool + i := &Issue{Draft: &zeroValue} + i.GetDraft() + i = &Issue{} + i.GetDraft() + i = nil + i.GetDraft() +} + func TestIssue_GetEventsURL(tt *testing.T) { var zeroValue string i := &Issue{EventsURL: &zeroValue} diff --git a/github/github-stringify_test.go b/github/github-stringify_test.go index 1dfd878fd59..a9b719c516a 100644 --- a/github/github-stringify_test.go +++ b/github/github-stringify_test.go @@ -768,9 +768,10 @@ func TestIssue_String(t *testing.T) { Repository: &Repository{}, Reactions: &Reactions{}, NodeID: String(""), + Draft: Bool(false), ActiveLockReason: String(""), } - want := `github.Issue{ID:0, Number:0, State:"", StateReason:"", Locked:false, Title:"", Body:"", AuthorAssociation:"", User:github.User{}, Assignee:github.User{}, Comments:0, ClosedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, ClosedBy:github.User{}, URL:"", HTMLURL:"", CommentsURL:"", EventsURL:"", LabelsURL:"", RepositoryURL:"", Milestone:github.Milestone{}, PullRequestLinks:github.PullRequestLinks{}, Repository:github.Repository{}, Reactions:github.Reactions{}, NodeID:"", ActiveLockReason:""}` + want := `github.Issue{ID:0, Number:0, State:"", StateReason:"", Locked:false, Title:"", Body:"", AuthorAssociation:"", User:github.User{}, Assignee:github.User{}, Comments:0, ClosedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, ClosedBy:github.User{}, URL:"", HTMLURL:"", CommentsURL:"", EventsURL:"", LabelsURL:"", RepositoryURL:"", Milestone:github.Milestone{}, PullRequestLinks:github.PullRequestLinks{}, Repository:github.Repository{}, Reactions:github.Reactions{}, NodeID:"", Draft:false, ActiveLockReason:""}` if got := v.String(); got != want { t.Errorf("Issue.String = %v, want %v", got, want) } diff --git a/github/issues.go b/github/issues.go index 1db99328b51..1c07fef827b 100644 --- a/github/issues.go +++ b/github/issues.go @@ -54,6 +54,7 @@ type Issue struct { Reactions *Reactions `json:"reactions,omitempty"` Assignees []*User `json:"assignees,omitempty"` NodeID *string `json:"node_id,omitempty"` + Draft *bool `json:"draft,omitempty"` // TextMatches is only populated from search results that request text matches // See: search.go and https://docs.github.com/rest/search/#text-match-metadata From 182859f01734d19cfa11a09dccede8864820b344 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Sal=C3=A9?= Date: Mon, 27 Nov 2023 01:00:00 +0100 Subject: [PATCH 061/145] Fix secondary rate limits URL (#3001) --- github/github.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/github/github.go b/github/github.go index 9c1bf084d35..c2706b0f10a 100644 --- a/github/github.go +++ b/github/github.go @@ -1133,7 +1133,7 @@ func (ae *AcceptedError) Is(target error) bool { } // AbuseRateLimitError occurs when GitHub returns 403 Forbidden response with the -// "documentation_url" field value equal to "https://docs.github.com/rest/overview/resources-in-the-rest-api#secondary-rate-limits". +// "documentation_url" field value equal to "https://docs.github.com/rest/overview/rate-limits-for-the-rest-api#about-secondary-rate-limits". type AbuseRateLimitError struct { Response *http.Response // HTTP response that caused this error Message string `json:"message"` // error message @@ -1259,7 +1259,7 @@ func CheckResponse(r *http.Response) error { } case r.StatusCode == http.StatusForbidden && (strings.HasSuffix(errorResponse.DocumentationURL, "#abuse-rate-limits") || - strings.HasSuffix(errorResponse.DocumentationURL, "#secondary-rate-limits")): + strings.HasSuffix(errorResponse.DocumentationURL, "secondary-rate-limits")): abuseRateLimitError := &AbuseRateLimitError{ Response: errorResponse.Response, Message: errorResponse.Message, From 466e52f0cd17ddbed7a4ac88307fc8fdaf440605 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 Nov 2023 15:19:00 -0500 Subject: [PATCH 062/145] Bump golang.org/x/net from 0.18.0 to 0.19.0 in /scrape (#3003) --- scrape/go.mod | 2 +- scrape/go.sum | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scrape/go.mod b/scrape/go.mod index 95c03591b22..05f87b6b3a3 100644 --- a/scrape/go.mod +++ b/scrape/go.mod @@ -7,5 +7,5 @@ require ( github.com/google/go-cmp v0.6.0 github.com/google/go-github/v56 v56.0.0 github.com/xlzd/gotp v0.1.0 - golang.org/x/net v0.18.0 + golang.org/x/net v0.19.0 ) diff --git a/scrape/go.sum b/scrape/go.sum index 78483af2cbf..907678b1c1d 100644 --- a/scrape/go.sum +++ b/scrape/go.sum @@ -15,7 +15,7 @@ github.com/xlzd/gotp v0.1.0/go.mod h1:ndLJ3JKzi3xLmUProq4LLxCuECL93dG9WASNLpHz8q github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g= +golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -25,8 +25,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg= -golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ= +golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= +golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -38,12 +38,12 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= -golang.org/x/term v0.14.0/go.mod h1:TySc+nGkYR6qt8km8wUhuFRTVSMIX3XPR58y2lC8vww= +golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= From 9cf8c174d1af9aca1d2976ae6ddd1072ba77045b Mon Sep 17 00:00:00 2001 From: Carlos Tadeu Panato Junior Date: Wed, 29 Nov 2023 15:56:21 +0100 Subject: [PATCH 063/145] Implement global security advisories API (#2993) Fixes: #2851. --- github/github-accessors.go | 168 +++++++++++++ github/github-accessors_test.go | 204 ++++++++++++++++ github/security_advisories.go | 122 ++++++++++ github/security_advisories_test.go | 378 +++++++++++++++++++++++++++++ 4 files changed, 872 insertions(+) diff --git a/github/github-accessors.go b/github/github-accessors.go index d5696279d43..bccc3b4eb01 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -4990,6 +4990,22 @@ func (c *CredentialAuthorization) GetTokenLastEight() string { return *c.TokenLastEight } +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (c *Credit) GetType() string { + if c == nil || c.Type == nil { + return "" + } + return *c.Type +} + +// GetUser returns the User field. +func (c *Credit) GetUser() *User { + if c == nil { + return nil + } + return c.User +} + // GetDefaultValue returns the DefaultValue field if it's non-nil, zero value otherwise. func (c *CustomProperty) GetDefaultValue() string { if c == nil || c.DefaultValue == nil { @@ -7814,6 +7830,78 @@ func (g *GitObject) GetURL() string { return *g.URL } +// GetGithubReviewedAt returns the GithubReviewedAt field if it's non-nil, zero value otherwise. +func (g *GlobalSecurityAdvisory) GetGithubReviewedAt() Timestamp { + if g == nil || g.GithubReviewedAt == nil { + return Timestamp{} + } + return *g.GithubReviewedAt +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (g *GlobalSecurityAdvisory) GetID() int64 { + if g == nil || g.ID == nil { + return 0 + } + return *g.ID +} + +// GetNVDPublishedAt returns the NVDPublishedAt field if it's non-nil, zero value otherwise. +func (g *GlobalSecurityAdvisory) GetNVDPublishedAt() Timestamp { + if g == nil || g.NVDPublishedAt == nil { + return Timestamp{} + } + return *g.NVDPublishedAt +} + +// GetRepositoryAdvisoryURL returns the RepositoryAdvisoryURL field if it's non-nil, zero value otherwise. +func (g *GlobalSecurityAdvisory) GetRepositoryAdvisoryURL() string { + if g == nil || g.RepositoryAdvisoryURL == nil { + return "" + } + return *g.RepositoryAdvisoryURL +} + +// GetSourceCodeLocation returns the SourceCodeLocation field if it's non-nil, zero value otherwise. +func (g *GlobalSecurityAdvisory) GetSourceCodeLocation() string { + if g == nil || g.SourceCodeLocation == nil { + return "" + } + return *g.SourceCodeLocation +} + +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (g *GlobalSecurityAdvisory) GetType() string { + if g == nil || g.Type == nil { + return "" + } + return *g.Type +} + +// GetFirstPatchedVersion returns the FirstPatchedVersion field if it's non-nil, zero value otherwise. +func (g *GlobalSecurityVulnerability) GetFirstPatchedVersion() string { + if g == nil || g.FirstPatchedVersion == nil { + return "" + } + return *g.FirstPatchedVersion +} + +// GetPackage returns the Package field. +func (g *GlobalSecurityVulnerability) GetPackage() *VulnerabilityPackage { + if g == nil { + return nil + } + return g.Package +} + +// GetVulnerableVersionRange returns the VulnerableVersionRange field if it's non-nil, zero value otherwise. +func (g *GlobalSecurityVulnerability) GetVulnerableVersionRange() string { + if g == nil || g.VulnerableVersionRange == nil { + return "" + } + return *g.VulnerableVersionRange +} + // GetInstallation returns the Installation field. func (g *GollumEvent) GetInstallation() *Installation { if g == nil { @@ -10790,6 +10878,86 @@ func (l *ListExternalGroupsOptions) GetDisplayName() string { return *l.DisplayName } +// GetAffects returns the Affects field if it's non-nil, zero value otherwise. +func (l *ListGlobalSecurityAdvisoriesOptions) GetAffects() string { + if l == nil || l.Affects == nil { + return "" + } + return *l.Affects +} + +// GetCVEID returns the CVEID field if it's non-nil, zero value otherwise. +func (l *ListGlobalSecurityAdvisoriesOptions) GetCVEID() string { + if l == nil || l.CVEID == nil { + return "" + } + return *l.CVEID +} + +// GetEcosystem returns the Ecosystem field if it's non-nil, zero value otherwise. +func (l *ListGlobalSecurityAdvisoriesOptions) GetEcosystem() string { + if l == nil || l.Ecosystem == nil { + return "" + } + return *l.Ecosystem +} + +// GetGHSAID returns the GHSAID field if it's non-nil, zero value otherwise. +func (l *ListGlobalSecurityAdvisoriesOptions) GetGHSAID() string { + if l == nil || l.GHSAID == nil { + return "" + } + return *l.GHSAID +} + +// GetIsWithdrawn returns the IsWithdrawn field if it's non-nil, zero value otherwise. +func (l *ListGlobalSecurityAdvisoriesOptions) GetIsWithdrawn() bool { + if l == nil || l.IsWithdrawn == nil { + return false + } + return *l.IsWithdrawn +} + +// GetModified returns the Modified field if it's non-nil, zero value otherwise. +func (l *ListGlobalSecurityAdvisoriesOptions) GetModified() string { + if l == nil || l.Modified == nil { + return "" + } + return *l.Modified +} + +// GetPublished returns the Published field if it's non-nil, zero value otherwise. +func (l *ListGlobalSecurityAdvisoriesOptions) GetPublished() string { + if l == nil || l.Published == nil { + return "" + } + return *l.Published +} + +// GetSeverity returns the Severity field if it's non-nil, zero value otherwise. +func (l *ListGlobalSecurityAdvisoriesOptions) GetSeverity() string { + if l == nil || l.Severity == nil { + return "" + } + return *l.Severity +} + +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (l *ListGlobalSecurityAdvisoriesOptions) GetType() string { + if l == nil || l.Type == nil { + return "" + } + return *l.Type +} + +// GetUpdated returns the Updated field if it's non-nil, zero value otherwise. +func (l *ListGlobalSecurityAdvisoriesOptions) GetUpdated() string { + if l == nil || l.Updated == nil { + return "" + } + return *l.Updated +} + // GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. func (l *ListOrganizations) GetTotalCount() int { if l == nil || l.TotalCount == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 3ad4b6b2ecf..84d104f18cb 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -5899,6 +5899,23 @@ func TestCredentialAuthorization_GetTokenLastEight(tt *testing.T) { c.GetTokenLastEight() } +func TestCredit_GetType(tt *testing.T) { + var zeroValue string + c := &Credit{Type: &zeroValue} + c.GetType() + c = &Credit{} + c.GetType() + c = nil + c.GetType() +} + +func TestCredit_GetUser(tt *testing.T) { + c := &Credit{} + c.GetUser() + c = nil + c.GetUser() +} + func TestCustomProperty_GetDefaultValue(tt *testing.T) { var zeroValue string c := &CustomProperty{DefaultValue: &zeroValue} @@ -9159,6 +9176,93 @@ func TestGitObject_GetURL(tt *testing.T) { g.GetURL() } +func TestGlobalSecurityAdvisory_GetGithubReviewedAt(tt *testing.T) { + var zeroValue Timestamp + g := &GlobalSecurityAdvisory{GithubReviewedAt: &zeroValue} + g.GetGithubReviewedAt() + g = &GlobalSecurityAdvisory{} + g.GetGithubReviewedAt() + g = nil + g.GetGithubReviewedAt() +} + +func TestGlobalSecurityAdvisory_GetID(tt *testing.T) { + var zeroValue int64 + g := &GlobalSecurityAdvisory{ID: &zeroValue} + g.GetID() + g = &GlobalSecurityAdvisory{} + g.GetID() + g = nil + g.GetID() +} + +func TestGlobalSecurityAdvisory_GetNVDPublishedAt(tt *testing.T) { + var zeroValue Timestamp + g := &GlobalSecurityAdvisory{NVDPublishedAt: &zeroValue} + g.GetNVDPublishedAt() + g = &GlobalSecurityAdvisory{} + g.GetNVDPublishedAt() + g = nil + g.GetNVDPublishedAt() +} + +func TestGlobalSecurityAdvisory_GetRepositoryAdvisoryURL(tt *testing.T) { + var zeroValue string + g := &GlobalSecurityAdvisory{RepositoryAdvisoryURL: &zeroValue} + g.GetRepositoryAdvisoryURL() + g = &GlobalSecurityAdvisory{} + g.GetRepositoryAdvisoryURL() + g = nil + g.GetRepositoryAdvisoryURL() +} + +func TestGlobalSecurityAdvisory_GetSourceCodeLocation(tt *testing.T) { + var zeroValue string + g := &GlobalSecurityAdvisory{SourceCodeLocation: &zeroValue} + g.GetSourceCodeLocation() + g = &GlobalSecurityAdvisory{} + g.GetSourceCodeLocation() + g = nil + g.GetSourceCodeLocation() +} + +func TestGlobalSecurityAdvisory_GetType(tt *testing.T) { + var zeroValue string + g := &GlobalSecurityAdvisory{Type: &zeroValue} + g.GetType() + g = &GlobalSecurityAdvisory{} + g.GetType() + g = nil + g.GetType() +} + +func TestGlobalSecurityVulnerability_GetFirstPatchedVersion(tt *testing.T) { + var zeroValue string + g := &GlobalSecurityVulnerability{FirstPatchedVersion: &zeroValue} + g.GetFirstPatchedVersion() + g = &GlobalSecurityVulnerability{} + g.GetFirstPatchedVersion() + g = nil + g.GetFirstPatchedVersion() +} + +func TestGlobalSecurityVulnerability_GetPackage(tt *testing.T) { + g := &GlobalSecurityVulnerability{} + g.GetPackage() + g = nil + g.GetPackage() +} + +func TestGlobalSecurityVulnerability_GetVulnerableVersionRange(tt *testing.T) { + var zeroValue string + g := &GlobalSecurityVulnerability{VulnerableVersionRange: &zeroValue} + g.GetVulnerableVersionRange() + g = &GlobalSecurityVulnerability{} + g.GetVulnerableVersionRange() + g = nil + g.GetVulnerableVersionRange() +} + func TestGollumEvent_GetInstallation(tt *testing.T) { g := &GollumEvent{} g.GetInstallation() @@ -12639,6 +12743,106 @@ func TestListExternalGroupsOptions_GetDisplayName(tt *testing.T) { l.GetDisplayName() } +func TestListGlobalSecurityAdvisoriesOptions_GetAffects(tt *testing.T) { + var zeroValue string + l := &ListGlobalSecurityAdvisoriesOptions{Affects: &zeroValue} + l.GetAffects() + l = &ListGlobalSecurityAdvisoriesOptions{} + l.GetAffects() + l = nil + l.GetAffects() +} + +func TestListGlobalSecurityAdvisoriesOptions_GetCVEID(tt *testing.T) { + var zeroValue string + l := &ListGlobalSecurityAdvisoriesOptions{CVEID: &zeroValue} + l.GetCVEID() + l = &ListGlobalSecurityAdvisoriesOptions{} + l.GetCVEID() + l = nil + l.GetCVEID() +} + +func TestListGlobalSecurityAdvisoriesOptions_GetEcosystem(tt *testing.T) { + var zeroValue string + l := &ListGlobalSecurityAdvisoriesOptions{Ecosystem: &zeroValue} + l.GetEcosystem() + l = &ListGlobalSecurityAdvisoriesOptions{} + l.GetEcosystem() + l = nil + l.GetEcosystem() +} + +func TestListGlobalSecurityAdvisoriesOptions_GetGHSAID(tt *testing.T) { + var zeroValue string + l := &ListGlobalSecurityAdvisoriesOptions{GHSAID: &zeroValue} + l.GetGHSAID() + l = &ListGlobalSecurityAdvisoriesOptions{} + l.GetGHSAID() + l = nil + l.GetGHSAID() +} + +func TestListGlobalSecurityAdvisoriesOptions_GetIsWithdrawn(tt *testing.T) { + var zeroValue bool + l := &ListGlobalSecurityAdvisoriesOptions{IsWithdrawn: &zeroValue} + l.GetIsWithdrawn() + l = &ListGlobalSecurityAdvisoriesOptions{} + l.GetIsWithdrawn() + l = nil + l.GetIsWithdrawn() +} + +func TestListGlobalSecurityAdvisoriesOptions_GetModified(tt *testing.T) { + var zeroValue string + l := &ListGlobalSecurityAdvisoriesOptions{Modified: &zeroValue} + l.GetModified() + l = &ListGlobalSecurityAdvisoriesOptions{} + l.GetModified() + l = nil + l.GetModified() +} + +func TestListGlobalSecurityAdvisoriesOptions_GetPublished(tt *testing.T) { + var zeroValue string + l := &ListGlobalSecurityAdvisoriesOptions{Published: &zeroValue} + l.GetPublished() + l = &ListGlobalSecurityAdvisoriesOptions{} + l.GetPublished() + l = nil + l.GetPublished() +} + +func TestListGlobalSecurityAdvisoriesOptions_GetSeverity(tt *testing.T) { + var zeroValue string + l := &ListGlobalSecurityAdvisoriesOptions{Severity: &zeroValue} + l.GetSeverity() + l = &ListGlobalSecurityAdvisoriesOptions{} + l.GetSeverity() + l = nil + l.GetSeverity() +} + +func TestListGlobalSecurityAdvisoriesOptions_GetType(tt *testing.T) { + var zeroValue string + l := &ListGlobalSecurityAdvisoriesOptions{Type: &zeroValue} + l.GetType() + l = &ListGlobalSecurityAdvisoriesOptions{} + l.GetType() + l = nil + l.GetType() +} + +func TestListGlobalSecurityAdvisoriesOptions_GetUpdated(tt *testing.T) { + var zeroValue string + l := &ListGlobalSecurityAdvisoriesOptions{Updated: &zeroValue} + l.GetUpdated() + l = &ListGlobalSecurityAdvisoriesOptions{} + l.GetUpdated() + l = nil + l.GetUpdated() +} + func TestListOrganizations_GetTotalCount(tt *testing.T) { var zeroValue int l := &ListOrganizations{TotalCount: &zeroValue} diff --git a/github/security_advisories.go b/github/security_advisories.go index 66e7dba15ac..635263748d4 100644 --- a/github/security_advisories.go +++ b/github/security_advisories.go @@ -47,6 +47,81 @@ type ListRepositorySecurityAdvisoriesOptions struct { State string `url:"state,omitempty"` } +// ListGlobalSecurityAdvisoriesOptions specifies the optional parameters to list the global security advisories. +type ListGlobalSecurityAdvisoriesOptions struct { + ListCursorOptions + + // If specified, only advisories with this GHSA (GitHub Security Advisory) identifier will be returned. + GHSAID *string `url:"ghsa_id,omitempty"` + + // If specified, only advisories of this type will be returned. + // By default, a request with no other parameters defined will only return reviewed advisories that are not malware. + // Default: reviewed + // Can be one of: reviewed, malware, unreviewed + Type *string `url:"type,omitempty"` + + // If specified, only advisories with this CVE (Common Vulnerabilities and Exposures) identifier will be returned. + CVEID *string `url:"cve_id,omitempty"` + + // If specified, only advisories for these ecosystems will be returned. + // Can be one of: actions, composer, erlang, go, maven, npm, nuget, other, pip, pub, rubygems, rust + Ecosystem *string `url:"ecosystem,omitempty"` + + // If specified, only advisories with these severities will be returned. + // Can be one of: unknown, low, medium, high, critical + Severity *string `url:"severity,omitempty"` + + // If specified, only advisories with these Common Weakness Enumerations (CWEs) will be returned. + // Example: cwes=79,284,22 or cwes[]=79&cwes[]=284&cwes[]=22 + CWEs []string `url:"cwes,omitempty"` + + // Whether to only return advisories that have been withdrawn. + IsWithdrawn *bool `url:"is_withdrawn,omitempty"` + + // If specified, only return advisories that affect any of package or package@version. + // A maximum of 1000 packages can be specified. If the query parameter causes + // the URL to exceed the maximum URL length supported by your client, you must specify fewer packages. + // Example: affects=package1,package2@1.0.0,package3@^2.0.0 or affects[]=package1&affects[]=package2@1.0.0 + Affects *string `url:"affects,omitempty"` + + // If specified, only return advisories that were published on a date or date range. + Published *string `url:"published,omitempty"` + + // If specified, only return advisories that were updated on a date or date range. + Updated *string `url:"updated,omitempty"` + + // If specified, only show advisories that were updated or published on a date or date range. + Modified *string `url:"modified,omitempty"` +} + +// GlobalSecurityAdvisory represents the global security advisory object response. +type GlobalSecurityAdvisory struct { + SecurityAdvisory + ID *int64 `json:"id,omitempty"` + RepositoryAdvisoryURL *string `json:"repository_advisory_url,omitempty"` + Type *string `json:"type,omitempty"` + SourceCodeLocation *string `json:"source_code_location,omitempty"` + References []string `json:"references,omitempty"` + Vulnerabilities []*GlobalSecurityVulnerability `json:"vulnerabilities,omitempty"` + GithubReviewedAt *Timestamp `json:"github_reviewed_at,omitempty"` + NVDPublishedAt *Timestamp `json:"nvd_published_at,omitempty"` + Credits []*Credit `json:"credits,omitempty"` +} + +// GlobalSecurityVulnerability represents a vulnerability for a global security advisory. +type GlobalSecurityVulnerability struct { + Package *VulnerabilityPackage `json:"package,omitempty"` + FirstPatchedVersion *string `json:"first_patched_version,omitempty"` + VulnerableVersionRange *string `json:"vulnerable_version_range,omitempty"` + VulnerableFunctions []string `json:"vulnerable_functions,omitempty"` +} + +// Credit represents the credit object for a global security advisory. +type Credit struct { + User *User `json:"user,omitempty"` + Type *string `json:"type,omitempty"` +} + // RequestCVE requests a Common Vulnerabilities and Exposures (CVE) for a repository security advisory. // The ghsaID is the GitHub Security Advisory identifier of the advisory. // @@ -124,3 +199,50 @@ func (s *SecurityAdvisoriesService) ListRepositorySecurityAdvisories(ctx context return advisories, resp, nil } + +// ListGlobalSecurityAdvisories lists all global security advisories. +// +// GitHub API docs: https://docs.github.com/rest/security-advisories/global-advisories#list-global-security-advisories +// +//meta:operation GET /advisories +func (s *SecurityAdvisoriesService) ListGlobalSecurityAdvisories(ctx context.Context, opts *ListGlobalSecurityAdvisoriesOptions) ([]*GlobalSecurityAdvisory, *Response, error) { + url := "advisories" + url, err := addOptions(url, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", url, nil) + if err != nil { + return nil, nil, err + } + + var advisories []*GlobalSecurityAdvisory + resp, err := s.client.Do(ctx, req, &advisories) + if err != nil { + return nil, resp, err + } + + return advisories, resp, nil +} + +// GetGlobalSecurityAdvisories gets a global security advisory using its GitHub Security Advisory (GHSA) identifier. +// +// GitHub API docs: https://docs.github.com/rest/security-advisories/global-advisories#get-a-global-security-advisory +// +//meta:operation GET /advisories/{ghsa_id} +func (s *SecurityAdvisoriesService) GetGlobalSecurityAdvisories(ctx context.Context, ghsaID string) (*GlobalSecurityAdvisory, *Response, error) { + url := fmt.Sprintf("advisories/%s", ghsaID) + req, err := s.client.NewRequest("GET", url, nil) + if err != nil { + return nil, nil, err + } + + var advisory *GlobalSecurityAdvisory + resp, err := s.client.Do(ctx, req, &advisory) + if err != nil { + return nil, resp, err + } + + return advisory, resp, nil +} diff --git a/github/security_advisories_test.go b/github/security_advisories_test.go index 5476ef6138f..918e3e05002 100644 --- a/github/security_advisories_test.go +++ b/github/security_advisories_test.go @@ -7,9 +7,11 @@ package github import ( "context" + "fmt" "net/http" "strings" "testing" + "time" "github.com/google/go-cmp/cmp" ) @@ -315,3 +317,379 @@ func TestSecurityAdvisoriesService_ListRepositorySecurityAdvisories(t *testing.T return resp, err }) } + +func TestListGlobalSecurityAdvisories(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/advisories", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + testFormValues(t, r, values{"cve_id": "CVE-xoxo-1234"}) + + fmt.Fprint(w, `[{ + "id": 1, + "ghsa_id": "GHSA-xoxo-1234-xoxo", + "cve_id": "CVE-xoxo-1234", + "url": "https://api.github.com/advisories/GHSA-xoxo-1234-xoxo", + "html_url": "https://github.com/advisories/GHSA-xoxo-1234-xoxo", + "repository_advisory_url": "https://api.github.com/repos/project/a-package/security-advisories/GHSA-xoxo-1234-xoxo", + "summary": "Heartbleed security advisory", + "description": "This bug allows an attacker to read portions of the affected server’s memory, potentially disclosing sensitive information.", + "type": "reviewed", + "severity": "high", + "source_code_location": "https://github.com/project/a-package", + "identifiers": [ + { + "type": "GHSA", + "value": "GHSA-xoxo-1234-xoxo" + }, + { + "type": "CVE", + "value": "CVE-xoxo-1234" + } + ], + "references": ["https://nvd.nist.gov/vuln/detail/CVE-xoxo-1234"], + "published_at": "1996-06-20T00:00:00Z", + "updated_at": "1996-06-20T00:00:00Z", + "github_reviewed_at": "1996-06-20T00:00:00Z", + "nvd_published_at": "1996-06-20T00:00:00Z", + "withdrawn_at": null, + "vulnerabilities": [ + { + "package": { + "ecosystem": "npm", + "name": "a-package" + }, + "first_patched_version": "1.0.3", + "vulnerable_version_range": "<=1.0.2", + "vulnerable_functions": ["a_function"] + } + ], + "cvss": { + "vector_string": "CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:C/C:H/I:H/A:H", + "score": 7.6 + }, + "cwes": [ + { + "cwe_id": "CWE-400", + "name": "Uncontrolled Resource Consumption" + } + ], + "credits": [ + { + "user": { + "login": "user", + "id": 1, + "node_id": "12=", + "avatar_url": "a", + "gravatar_id": "", + "url": "a", + "html_url": "b", + "followers_url": "b", + "following_url": "c", + "gists_url": "d", + "starred_url": "e", + "subscriptions_url": "f", + "organizations_url": "g", + "repos_url": "h", + "events_url": "i", + "received_events_url": "j", + "type": "User", + "site_admin": false + }, + "type": "analyst" + } + ] + } + ]`) + }) + + ctx := context.Background() + opts := &ListGlobalSecurityAdvisoriesOptions{CVEID: String("CVE-xoxo-1234")} + + advisories, _, err := client.SecurityAdvisories.ListGlobalSecurityAdvisories(ctx, opts) + if err != nil { + t.Errorf("SecurityAdvisories.ListGlobalSecurityAdvisories returned error: %v", err) + } + + date := Timestamp{time.Date(1996, time.June, 20, 00, 00, 00, 0, time.UTC)} + want := []*GlobalSecurityAdvisory{ + { + ID: Int64(1), + SecurityAdvisory: SecurityAdvisory{ + GHSAID: String("GHSA-xoxo-1234-xoxo"), + CVEID: String("CVE-xoxo-1234"), + URL: String("https://api.github.com/advisories/GHSA-xoxo-1234-xoxo"), + HTMLURL: String("https://github.com/advisories/GHSA-xoxo-1234-xoxo"), + Severity: String("high"), + Summary: String("Heartbleed security advisory"), + Description: String("This bug allows an attacker to read portions of the affected server’s memory, potentially disclosing sensitive information."), + Identifiers: []*AdvisoryIdentifier{ + { + Type: String("GHSA"), + Value: String("GHSA-xoxo-1234-xoxo"), + }, + { + Type: String("CVE"), + Value: String("CVE-xoxo-1234"), + }, + }, + PublishedAt: &date, + UpdatedAt: &date, + WithdrawnAt: nil, + CVSS: &AdvisoryCVSS{ + VectorString: String("CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:C/C:H/I:H/A:H"), + Score: Float64(7.6), + }, + CWEs: []*AdvisoryCWEs{ + { + CWEID: String("CWE-400"), + Name: String("Uncontrolled Resource Consumption"), + }, + }, + }, + References: []string{"https://nvd.nist.gov/vuln/detail/CVE-xoxo-1234"}, + Vulnerabilities: []*GlobalSecurityVulnerability{ + { + Package: &VulnerabilityPackage{ + Ecosystem: String("npm"), + Name: String("a-package"), + }, + FirstPatchedVersion: String("1.0.3"), + VulnerableVersionRange: String("<=1.0.2"), + VulnerableFunctions: []string{"a_function"}, + }, + }, + RepositoryAdvisoryURL: String("https://api.github.com/repos/project/a-package/security-advisories/GHSA-xoxo-1234-xoxo"), + Type: String("reviewed"), + SourceCodeLocation: String("https://github.com/project/a-package"), + GithubReviewedAt: &date, + NVDPublishedAt: &date, + Credits: []*Credit{ + { + User: &User{ + Login: String("user"), + ID: Int64(1), + NodeID: String("12="), + AvatarURL: String("a"), + GravatarID: String(""), + URL: String("a"), + HTMLURL: String("b"), + FollowersURL: String("b"), + FollowingURL: String("c"), + GistsURL: String("d"), + StarredURL: String("e"), + SubscriptionsURL: String("f"), + OrganizationsURL: String("g"), + ReposURL: String("h"), + EventsURL: String("i"), + ReceivedEventsURL: String("j"), + Type: String("User"), + SiteAdmin: Bool(false), + }, + Type: String("analyst"), + }, + }, + }, + } + + if !cmp.Equal(advisories, want) { + t.Errorf("SecurityAdvisories.ListGlobalSecurityAdvisories %+v, want %+v", advisories, want) + } + + const methodName = "ListGlobalSecurityAdvisories" + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + _, resp, err := client.SecurityAdvisories.ListGlobalSecurityAdvisories(ctx, nil) + return resp, err + }) +} + +func TestGetGlobalSecurityAdvisories(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/advisories/GHSA-xoxo-1234-xoxo", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + + fmt.Fprint(w, `{ + "id": 1, + "ghsa_id": "GHSA-xoxo-1234-xoxo", + "cve_id": "CVE-xoxo-1234", + "url": "https://api.github.com/advisories/GHSA-xoxo-1234-xoxo", + "html_url": "https://github.com/advisories/GHSA-xoxo-1234-xoxo", + "repository_advisory_url": "https://api.github.com/repos/project/a-package/security-advisories/GHSA-xoxo-1234-xoxo", + "summary": "Heartbleed security advisory", + "description": "This bug allows an attacker to read portions of the affected server’s memory, potentially disclosing sensitive information.", + "type": "reviewed", + "severity": "high", + "source_code_location": "https://github.com/project/a-package", + "identifiers": [ + { + "type": "GHSA", + "value": "GHSA-xoxo-1234-xoxo" + }, + { + "type": "CVE", + "value": "CVE-xoxo-1234" + } + ], + "references": ["https://nvd.nist.gov/vuln/detail/CVE-xoxo-1234"], + "published_at": "1996-06-20T00:00:00Z", + "updated_at": "1996-06-20T00:00:00Z", + "github_reviewed_at": "1996-06-20T00:00:00Z", + "nvd_published_at": "1996-06-20T00:00:00Z", + "withdrawn_at": null, + "vulnerabilities": [ + { + "package": { + "ecosystem": "npm", + "name": "a-package" + }, + "first_patched_version": "1.0.3", + "vulnerable_version_range": "<=1.0.2", + "vulnerable_functions": ["a_function"] + } + ], + "cvss": { + "vector_string": "CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:C/C:H/I:H/A:H", + "score": 7.6 + }, + "cwes": [ + { + "cwe_id": "CWE-400", + "name": "Uncontrolled Resource Consumption" + } + ], + "credits": [ + { + "user": { + "login": "user", + "id": 1, + "node_id": "12=", + "avatar_url": "a", + "gravatar_id": "", + "url": "a", + "html_url": "b", + "followers_url": "b", + "following_url": "c", + "gists_url": "d", + "starred_url": "e", + "subscriptions_url": "f", + "organizations_url": "g", + "repos_url": "h", + "events_url": "i", + "received_events_url": "j", + "type": "User", + "site_admin": false + }, + "type": "analyst" + } + ] + }`) + }) + + ctx := context.Background() + advisory, _, err := client.SecurityAdvisories.GetGlobalSecurityAdvisories(ctx, "GHSA-xoxo-1234-xoxo") + if err != nil { + t.Errorf("SecurityAdvisories.GetGlobalSecurityAdvisories returned error: %v", err) + } + + date := Timestamp{time.Date(1996, time.June, 20, 00, 00, 00, 0, time.UTC)} + want := &GlobalSecurityAdvisory{ + ID: Int64(1), + SecurityAdvisory: SecurityAdvisory{ + GHSAID: String("GHSA-xoxo-1234-xoxo"), + CVEID: String("CVE-xoxo-1234"), + URL: String("https://api.github.com/advisories/GHSA-xoxo-1234-xoxo"), + HTMLURL: String("https://github.com/advisories/GHSA-xoxo-1234-xoxo"), + Severity: String("high"), + Summary: String("Heartbleed security advisory"), + Description: String("This bug allows an attacker to read portions of the affected server’s memory, potentially disclosing sensitive information."), + Identifiers: []*AdvisoryIdentifier{ + { + Type: String("GHSA"), + Value: String("GHSA-xoxo-1234-xoxo"), + }, + { + Type: String("CVE"), + Value: String("CVE-xoxo-1234"), + }, + }, + PublishedAt: &date, + UpdatedAt: &date, + WithdrawnAt: nil, + CVSS: &AdvisoryCVSS{ + VectorString: String("CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:C/C:H/I:H/A:H"), + Score: Float64(7.6), + }, + CWEs: []*AdvisoryCWEs{ + { + CWEID: String("CWE-400"), + Name: String("Uncontrolled Resource Consumption"), + }, + }, + }, + RepositoryAdvisoryURL: String("https://api.github.com/repos/project/a-package/security-advisories/GHSA-xoxo-1234-xoxo"), + Type: String("reviewed"), + SourceCodeLocation: String("https://github.com/project/a-package"), + References: []string{"https://nvd.nist.gov/vuln/detail/CVE-xoxo-1234"}, + GithubReviewedAt: &date, + NVDPublishedAt: &date, + + Vulnerabilities: []*GlobalSecurityVulnerability{ + { + Package: &VulnerabilityPackage{ + Ecosystem: String("npm"), + Name: String("a-package"), + }, + FirstPatchedVersion: String("1.0.3"), + VulnerableVersionRange: String("<=1.0.2"), + VulnerableFunctions: []string{"a_function"}, + }, + }, + Credits: []*Credit{ + { + User: &User{ + Login: String("user"), + ID: Int64(1), + NodeID: String("12="), + AvatarURL: String("a"), + GravatarID: String(""), + URL: String("a"), + HTMLURL: String("b"), + FollowersURL: String("b"), + FollowingURL: String("c"), + GistsURL: String("d"), + StarredURL: String("e"), + SubscriptionsURL: String("f"), + OrganizationsURL: String("g"), + ReposURL: String("h"), + EventsURL: String("i"), + ReceivedEventsURL: String("j"), + Type: String("User"), + SiteAdmin: Bool(false), + }, + Type: String("analyst"), + }, + }, + } + + if !cmp.Equal(advisory, want) { + t.Errorf("SecurityAdvisories.GetGlobalSecurityAdvisories %+v, want %+v", advisory, want) + } + + const methodName = "GetGlobalSecurityAdvisories" + + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.SecurityAdvisories.GetGlobalSecurityAdvisories(ctx, "CVE-\n-1234") + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.SecurityAdvisories.GetGlobalSecurityAdvisories(ctx, "e") + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} From 50d4db259d28af40a3ee60af632f43f429842f91 Mon Sep 17 00:00:00 2001 From: Casey Date: Thu, 30 Nov 2023 03:45:17 -0800 Subject: [PATCH 064/145] Change `PushEvent.Pusher` type to `CommitAuthor` (#2999) Fixes: #2998. --- github/event_types.go | 2 +- github/event_types_test.go | 24 +++++++++--------------- github/github-accessors.go | 2 +- github/github-stringify_test.go | 4 ++-- github/repos_hooks_test.go | 6 ++---- 5 files changed, 15 insertions(+), 23 deletions(-) diff --git a/github/event_types.go b/github/event_types.go index 327fc561662..badd29b2a01 100644 --- a/github/event_types.go +++ b/github/event_types.go @@ -1282,7 +1282,7 @@ type PushEvent struct { Compare *string `json:"compare,omitempty"` Repo *PushEventRepository `json:"repository,omitempty"` HeadCommit *HeadCommit `json:"head_commit,omitempty"` - Pusher *User `json:"pusher,omitempty"` + Pusher *CommitAuthor `json:"pusher,omitempty"` Sender *User `json:"sender,omitempty"` Installation *Installation `json:"installation,omitempty"` diff --git a/github/event_types_test.go b/github/event_types_test.go index 91ac291205f..80eca61d0fc 100644 --- a/github/event_types_test.go +++ b/github/event_types_test.go @@ -3777,14 +3777,11 @@ func TestPushEvent_Marshal(t *testing.T) { Compare: String("a"), Repo: &PushEventRepository{ID: Int64(1)}, HeadCommit: &HeadCommit{ID: String("id")}, - Pusher: &User{ - Login: String("l"), - ID: Int64(1), - NodeID: String("n"), - URL: String("u"), - ReposURL: String("r"), - EventsURL: String("e"), - AvatarURL: String("a"), + Pusher: &CommitAuthor{ + Login: String("l"), + Date: &Timestamp{referenceTime}, + Name: String("n"), + Email: String("e"), }, Sender: &User{ Login: String("l"), @@ -3937,13 +3934,10 @@ func TestPushEvent_Marshal(t *testing.T) { "id": "id" }, "pusher": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" + "date": ` + referenceTimeStr + `, + "name": "n", + "email": "e", + "username": "l" }, "sender": { "login": "l", diff --git a/github/github-accessors.go b/github/github-accessors.go index bccc3b4eb01..e15eb10204b 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -17399,7 +17399,7 @@ func (p *PushEvent) GetOrganization() *Organization { } // GetPusher returns the Pusher field. -func (p *PushEvent) GetPusher() *User { +func (p *PushEvent) GetPusher() *CommitAuthor { if p == nil { return nil } diff --git a/github/github-stringify_test.go b/github/github-stringify_test.go index a9b719c516a..7472edfd59a 100644 --- a/github/github-stringify_test.go +++ b/github/github-stringify_test.go @@ -1426,12 +1426,12 @@ func TestPushEvent_String(t *testing.T) { Compare: String(""), Repo: &PushEventRepository{}, HeadCommit: &HeadCommit{}, - Pusher: &User{}, + Pusher: &CommitAuthor{}, Sender: &User{}, Installation: &Installation{}, Organization: &Organization{}, } - want := `github.PushEvent{PushID:0, Head:"", Ref:"", Size:0, Before:"", DistinctSize:0, Action:"", After:"", Created:false, Deleted:false, Forced:false, BaseRef:"", Compare:"", Repo:github.PushEventRepository{}, HeadCommit:github.HeadCommit{}, Pusher:github.User{}, Sender:github.User{}, Installation:github.Installation{}, Organization:github.Organization{}}` + want := `github.PushEvent{PushID:0, Head:"", Ref:"", Size:0, Before:"", DistinctSize:0, Action:"", After:"", Created:false, Deleted:false, Forced:false, BaseRef:"", Compare:"", Repo:github.PushEventRepository{}, HeadCommit:github.HeadCommit{}, Pusher:github.CommitAuthor{}, Sender:github.User{}, Installation:github.Installation{}, Organization:github.Organization{}}` if got := v.String(); got != want { t.Errorf("PushEvent.String = %v, want %v", got, want) } diff --git a/github/repos_hooks_test.go b/github/repos_hooks_test.go index 84c9f5ee6fa..fa44440ade0 100644 --- a/github/repos_hooks_test.go +++ b/github/repos_hooks_test.go @@ -357,9 +357,8 @@ func TestBranchWebHookPayload_Marshal(t *testing.T) { Organization: &Organization{ ID: Int64(22), }, - Pusher: &User{ + Pusher: &CommitAuthor{ Login: String("rd@yahoo.com"), - ID: Int64(112), }, Repo: &PushEventRepository{ ID: Int64(321), @@ -421,8 +420,7 @@ func TestBranchWebHookPayload_Marshal(t *testing.T) { "id" : 22 }, "pusher":{ - "login": "rd@yahoo.com", - "id": 112 + "username": "rd@yahoo.com" }, "repository":{ "id": 321, From 4046b93ef02fd787085a2a25b7b0be3e01d6fd01 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Fri, 1 Dec 2023 12:46:26 -0500 Subject: [PATCH 065/145] Bump version of go-github to v57.0.0 (#3009) --- README.md | 15 ++++++++------- example/actionpermissions/main.go | 2 +- example/appengine/app.go | 2 +- example/basicauth/main.go | 2 +- .../codespaces/newreposecretwithxcrypto/main.go | 2 +- .../codespaces/newusersecretwithxcrypto/main.go | 2 +- example/commitpr/main.go | 2 +- example/go.mod | 6 +++--- example/listenvironments/main.go | 2 +- example/migrations/main.go | 2 +- example/newfilewithappauth/main.go | 2 +- example/newrepo/main.go | 2 +- example/newreposecretwithlibsodium/go.mod | 4 ++-- example/newreposecretwithlibsodium/main.go | 2 +- example/newreposecretwithxcrypto/main.go | 2 +- example/ratelimit/main.go | 2 +- example/simple/main.go | 2 +- example/tagprotection/main.go | 2 +- example/tokenauth/main.go | 2 +- example/topics/main.go | 2 +- github/doc.go | 2 +- github/examples_test.go | 2 +- github/github.go | 2 +- go.mod | 2 +- test/fields/fields.go | 2 +- test/integration/activity_test.go | 2 +- test/integration/authorizations_test.go | 2 +- test/integration/github_test.go | 2 +- test/integration/repos_test.go | 2 +- test/integration/users_test.go | 2 +- tools/go.mod | 5 ++++- tools/go.sum | 2 -- tools/metadata/main.go | 2 +- tools/metadata/main_test.go | 2 +- tools/metadata/metadata.go | 2 +- tools/metadata/openapi.go | 2 +- 36 files changed, 48 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index daf57fe0275..f10c43df8c4 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # go-github # [![go-github release (latest SemVer)](https://img.shields.io/github/v/release/google/go-github?sort=semver)](https://github.com/google/go-github/releases) -[![GoDoc](https://img.shields.io/static/v1?label=godoc&message=reference&color=blue)](https://pkg.go.dev/github.com/google/go-github/v56/github) +[![GoDoc](https://img.shields.io/static/v1?label=godoc&message=reference&color=blue)](https://pkg.go.dev/github.com/google/go-github/v57/github) [![Test Status](https://github.com/google/go-github/workflows/tests/badge.svg)](https://github.com/google/go-github/actions?query=workflow%3Atests) [![Test Coverage](https://codecov.io/gh/google/go-github/branch/master/graph/badge.svg)](https://codecov.io/gh/google/go-github) [![Discuss at go-github@googlegroups.com](https://img.shields.io/badge/discuss-go--github%40googlegroups.com-blue.svg)](https://groups.google.com/group/go-github) @@ -24,7 +24,7 @@ If you're interested in using the [GraphQL API v4][], the recommended library is go-github is compatible with modern Go releases in module mode, with Go installed: ```bash -go get github.com/google/go-github/v56 +go get github.com/google/go-github/v57 ``` will resolve and add the package to the current development module, along with its dependencies. @@ -32,7 +32,7 @@ will resolve and add the package to the current development module, along with i Alternatively the same can be achieved if you use import in a package: ```go -import "github.com/google/go-github/v56/github" +import "github.com/google/go-github/v57/github" ``` and run `go get` without parameters. @@ -40,13 +40,13 @@ and run `go get` without parameters. Finally, to use the top-of-trunk version of this repo, use the following command: ```bash -go get github.com/google/go-github/v56@master +go get github.com/google/go-github/v57@master ``` ## Usage ## ```go -import "github.com/google/go-github/v56/github" // with go modules enabled (GO111MODULE=on or outside GOPATH) +import "github.com/google/go-github/v57/github" // with go modules enabled (GO111MODULE=on or outside GOPATH) import "github.com/google/go-github/github" // with go modules disabled ``` @@ -117,7 +117,7 @@ import ( "net/http" "github.com/bradleyfalzon/ghinstallation/v2" - "github.com/google/go-github/v56/github" + "github.com/google/go-github/v57/github" ) func main() { @@ -296,7 +296,7 @@ For complete usage of go-github, see the full [package docs][]. [GitHub API v3]: https://docs.github.com/en/rest [personal access token]: https://github.com/blog/1509-personal-api-tokens -[package docs]: https://pkg.go.dev/github.com/google/go-github/v56/github +[package docs]: https://pkg.go.dev/github.com/google/go-github/v57/github [GraphQL API v4]: https://developer.github.com/v4/ [shurcooL/githubv4]: https://github.com/shurcooL/githubv4 [GitHub webhook events]: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads @@ -369,6 +369,7 @@ Versions prior to 48.2.0 are not listed. | go-github Version | GitHub v3 API Version | | ----------------- | --------------------- | +| 57.0.0 | 2022-11-28 | | 56.0.0 | 2022-11-28 | | 55.0.0 | 2022-11-28 | | 54.0.0 | 2022-11-28 | diff --git a/example/actionpermissions/main.go b/example/actionpermissions/main.go index 711906a1227..a37c0043209 100644 --- a/example/actionpermissions/main.go +++ b/example/actionpermissions/main.go @@ -14,7 +14,7 @@ import ( "log" "os" - "github.com/google/go-github/v56/github" + "github.com/google/go-github/v57/github" ) var ( diff --git a/example/appengine/app.go b/example/appengine/app.go index fff9807f7fa..496bca402b3 100644 --- a/example/appengine/app.go +++ b/example/appengine/app.go @@ -12,7 +12,7 @@ import ( "net/http" "os" - "github.com/google/go-github/v56/github" + "github.com/google/go-github/v57/github" "google.golang.org/appengine" "google.golang.org/appengine/log" ) diff --git a/example/basicauth/main.go b/example/basicauth/main.go index e9027efcbce..48f9170b5bc 100644 --- a/example/basicauth/main.go +++ b/example/basicauth/main.go @@ -21,7 +21,7 @@ import ( "os" "strings" - "github.com/google/go-github/v56/github" + "github.com/google/go-github/v57/github" "golang.org/x/term" ) diff --git a/example/codespaces/newreposecretwithxcrypto/main.go b/example/codespaces/newreposecretwithxcrypto/main.go index 68b67696cfb..da1dabab76d 100644 --- a/example/codespaces/newreposecretwithxcrypto/main.go +++ b/example/codespaces/newreposecretwithxcrypto/main.go @@ -36,7 +36,7 @@ import ( "log" "os" - "github.com/google/go-github/v56/github" + "github.com/google/go-github/v57/github" "golang.org/x/crypto/nacl/box" ) diff --git a/example/codespaces/newusersecretwithxcrypto/main.go b/example/codespaces/newusersecretwithxcrypto/main.go index 9264aabad74..860c5161b77 100644 --- a/example/codespaces/newusersecretwithxcrypto/main.go +++ b/example/codespaces/newusersecretwithxcrypto/main.go @@ -37,7 +37,7 @@ import ( "log" "os" - "github.com/google/go-github/v56/github" + "github.com/google/go-github/v57/github" "golang.org/x/crypto/nacl/box" ) diff --git a/example/commitpr/main.go b/example/commitpr/main.go index 15919277f91..9e4098c916b 100644 --- a/example/commitpr/main.go +++ b/example/commitpr/main.go @@ -33,7 +33,7 @@ import ( "time" "github.com/ProtonMail/go-crypto/openpgp" - "github.com/google/go-github/v56/github" + "github.com/google/go-github/v57/github" ) var ( diff --git a/example/go.mod b/example/go.mod index 6900dbaafa6..a2bfe50f63d 100644 --- a/example/go.mod +++ b/example/go.mod @@ -1,4 +1,4 @@ -module github.com/google/go-github/v56/example +module github.com/google/go-github/v57/example go 1.17 @@ -6,7 +6,7 @@ require ( github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 github.com/bradleyfalzon/ghinstallation/v2 v2.0.4 github.com/gofri/go-github-ratelimit v1.0.3 - github.com/google/go-github/v56 v56.0.0 + github.com/google/go-github/v57 v57.0.0 golang.org/x/crypto v0.14.0 golang.org/x/term v0.13.0 google.golang.org/appengine v1.6.7 @@ -24,4 +24,4 @@ require ( ) // Use version at HEAD, not the latest published. -replace github.com/google/go-github/v56 => ../ +replace github.com/google/go-github/v57 => ../ diff --git a/example/listenvironments/main.go b/example/listenvironments/main.go index ec3e9878ffc..936f5470cf2 100644 --- a/example/listenvironments/main.go +++ b/example/listenvironments/main.go @@ -18,7 +18,7 @@ import ( "log" "os" - "github.com/google/go-github/v56/github" + "github.com/google/go-github/v57/github" ) func main() { diff --git a/example/migrations/main.go b/example/migrations/main.go index 8304b75e962..81872e062f2 100644 --- a/example/migrations/main.go +++ b/example/migrations/main.go @@ -12,7 +12,7 @@ import ( "context" "fmt" - "github.com/google/go-github/v56/github" + "github.com/google/go-github/v57/github" ) func fetchAllUserMigrations() ([]*github.UserMigration, error) { diff --git a/example/newfilewithappauth/main.go b/example/newfilewithappauth/main.go index 36f56fca5f9..670021a99dd 100644 --- a/example/newfilewithappauth/main.go +++ b/example/newfilewithappauth/main.go @@ -16,7 +16,7 @@ import ( "time" "github.com/bradleyfalzon/ghinstallation/v2" - "github.com/google/go-github/v56/github" + "github.com/google/go-github/v57/github" ) func main() { diff --git a/example/newrepo/main.go b/example/newrepo/main.go index b2d0879c801..21cb7f52a9d 100644 --- a/example/newrepo/main.go +++ b/example/newrepo/main.go @@ -16,7 +16,7 @@ import ( "log" "os" - "github.com/google/go-github/v56/github" + "github.com/google/go-github/v57/github" ) var ( diff --git a/example/newreposecretwithlibsodium/go.mod b/example/newreposecretwithlibsodium/go.mod index 6f71c4f9ce0..81a013ee37a 100644 --- a/example/newreposecretwithlibsodium/go.mod +++ b/example/newreposecretwithlibsodium/go.mod @@ -4,8 +4,8 @@ go 1.15 require ( github.com/GoKillers/libsodium-go v0.0.0-20171022220152-dd733721c3cb - github.com/google/go-github/v56 v56.0.0 + github.com/google/go-github/v57 v57.0.0 ) // Use version at HEAD, not the latest published. -replace github.com/google/go-github/v56 => ../.. +replace github.com/google/go-github/v57 => ../.. diff --git a/example/newreposecretwithlibsodium/main.go b/example/newreposecretwithlibsodium/main.go index aa9ea38a834..c022562d353 100644 --- a/example/newreposecretwithlibsodium/main.go +++ b/example/newreposecretwithlibsodium/main.go @@ -36,7 +36,7 @@ import ( "os" sodium "github.com/GoKillers/libsodium-go/cryptobox" - "github.com/google/go-github/v56/github" + "github.com/google/go-github/v57/github" ) var ( diff --git a/example/newreposecretwithxcrypto/main.go b/example/newreposecretwithxcrypto/main.go index 686b12e7a3c..b7366908e1c 100644 --- a/example/newreposecretwithxcrypto/main.go +++ b/example/newreposecretwithxcrypto/main.go @@ -36,7 +36,7 @@ import ( "log" "os" - "github.com/google/go-github/v56/github" + "github.com/google/go-github/v57/github" "golang.org/x/crypto/nacl/box" ) diff --git a/example/ratelimit/main.go b/example/ratelimit/main.go index 9c07cf301b8..67a8b0de483 100644 --- a/example/ratelimit/main.go +++ b/example/ratelimit/main.go @@ -13,7 +13,7 @@ import ( "fmt" "github.com/gofri/go-github-ratelimit/github_ratelimit" - "github.com/google/go-github/v56/github" + "github.com/google/go-github/v57/github" ) func main() { diff --git a/example/simple/main.go b/example/simple/main.go index fcaddd6ae91..70206e7f00f 100644 --- a/example/simple/main.go +++ b/example/simple/main.go @@ -12,7 +12,7 @@ import ( "context" "fmt" - "github.com/google/go-github/v56/github" + "github.com/google/go-github/v57/github" ) // Fetch all the public organizations' membership of a user. diff --git a/example/tagprotection/main.go b/example/tagprotection/main.go index e0e494e7da8..40a00af2b0d 100644 --- a/example/tagprotection/main.go +++ b/example/tagprotection/main.go @@ -18,7 +18,7 @@ import ( "os" "strings" - "github.com/google/go-github/v56/github" + "github.com/google/go-github/v57/github" "golang.org/x/term" ) diff --git a/example/tokenauth/main.go b/example/tokenauth/main.go index 9d30ad79663..e27b72b1a0e 100644 --- a/example/tokenauth/main.go +++ b/example/tokenauth/main.go @@ -15,7 +15,7 @@ import ( "log" "os" - "github.com/google/go-github/v56/github" + "github.com/google/go-github/v57/github" "golang.org/x/term" ) diff --git a/example/topics/main.go b/example/topics/main.go index 80f5627672e..a23f1b3a0d7 100644 --- a/example/topics/main.go +++ b/example/topics/main.go @@ -12,7 +12,7 @@ import ( "context" "fmt" - "github.com/google/go-github/v56/github" + "github.com/google/go-github/v57/github" ) // Fetch and lists all the public topics associated with the specified GitHub topic diff --git a/github/doc.go b/github/doc.go index b10810d5338..ca00a4bd049 100644 --- a/github/doc.go +++ b/github/doc.go @@ -8,7 +8,7 @@ Package github provides a client for using the GitHub API. Usage: - import "github.com/google/go-github/v56/github" // with go modules enabled (GO111MODULE=on or outside GOPATH) + import "github.com/google/go-github/v57/github" // with go modules enabled (GO111MODULE=on or outside GOPATH) import "github.com/google/go-github/github" // with go modules disabled Construct a new GitHub client, then use the various services on the client to diff --git a/github/examples_test.go b/github/examples_test.go index 9338e0b6170..d1070be4663 100644 --- a/github/examples_test.go +++ b/github/examples_test.go @@ -12,7 +12,7 @@ import ( "fmt" "log" - "github.com/google/go-github/v56/github" + "github.com/google/go-github/v57/github" ) func ExampleMarkdownService_Render() { diff --git a/github/github.go b/github/github.go index c2706b0f10a..c248b256f6e 100644 --- a/github/github.go +++ b/github/github.go @@ -28,7 +28,7 @@ import ( ) const ( - Version = "v56.0.0" + Version = "v57.0.0" defaultAPIVersion = "2022-11-28" defaultBaseURL = "https://api.github.com/" diff --git a/go.mod b/go.mod index 718bedab9d4..51c7c0e3327 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/google/go-github/v56 +module github.com/google/go-github/v57 require ( github.com/google/go-cmp v0.6.0 diff --git a/test/fields/fields.go b/test/fields/fields.go index 3334569dd38..fc9f29672c5 100644 --- a/test/fields/fields.go +++ b/test/fields/fields.go @@ -25,7 +25,7 @@ import ( "reflect" "strings" - "github.com/google/go-github/v56/github" + "github.com/google/go-github/v57/github" ) var ( diff --git a/test/integration/activity_test.go b/test/integration/activity_test.go index 52c163c8a97..b32bb5a02f7 100644 --- a/test/integration/activity_test.go +++ b/test/integration/activity_test.go @@ -12,7 +12,7 @@ import ( "context" "testing" - "github.com/google/go-github/v56/github" + "github.com/google/go-github/v57/github" ) const ( diff --git a/test/integration/authorizations_test.go b/test/integration/authorizations_test.go index 66c7952a311..61ec0239feb 100644 --- a/test/integration/authorizations_test.go +++ b/test/integration/authorizations_test.go @@ -15,7 +15,7 @@ import ( "testing" "time" - "github.com/google/go-github/v56/github" + "github.com/google/go-github/v57/github" ) const msgEnvMissing = "Skipping test because the required environment variable (%v) is not present." diff --git a/test/integration/github_test.go b/test/integration/github_test.go index 2d297f0ede3..81753b6bbb8 100644 --- a/test/integration/github_test.go +++ b/test/integration/github_test.go @@ -15,7 +15,7 @@ import ( "net/http" "os" - "github.com/google/go-github/v56/github" + "github.com/google/go-github/v57/github" ) var ( diff --git a/test/integration/repos_test.go b/test/integration/repos_test.go index 39a99fef98f..a4ead783846 100644 --- a/test/integration/repos_test.go +++ b/test/integration/repos_test.go @@ -15,7 +15,7 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/google/go-github/v56/github" + "github.com/google/go-github/v57/github" ) func TestRepositories_CRUD(t *testing.T) { diff --git a/test/integration/users_test.go b/test/integration/users_test.go index d3a9abb0e80..448b5af7ffe 100644 --- a/test/integration/users_test.go +++ b/test/integration/users_test.go @@ -14,7 +14,7 @@ import ( "math/rand" "testing" - "github.com/google/go-github/v56/github" + "github.com/google/go-github/v57/github" ) func TestUsers_Get(t *testing.T) { diff --git a/tools/go.mod b/tools/go.mod index 40c58020a6c..25cef1fd110 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -6,7 +6,7 @@ require ( github.com/alecthomas/kong v0.8.1 github.com/getkin/kin-openapi v0.120.0 github.com/google/go-cmp v0.6.0 - github.com/google/go-github/v56 v56.0.0 + github.com/google/go-github/v57 v57.0.0 golang.org/x/sync v0.5.0 gopkg.in/yaml.v3 v3.0.1 ) @@ -22,3 +22,6 @@ require ( github.com/perimeterx/marshmallow v1.1.5 // indirect github.com/stretchr/testify v1.8.4 // indirect ) + +// Use version at HEAD, not the latest published. +replace github.com/google/go-github/v57 => ../ diff --git a/tools/go.sum b/tools/go.sum index 7e8be0f06e5..099ce0450dd 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -17,8 +17,6 @@ github.com/go-test/deep v1.0.8 h1:TDsG77qcSprGbC6vTN8OuXp5g+J+b5Pcguhf7Zt61VM= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-github/v56 v56.0.0 h1:TysL7dMa/r7wsQi44BjqlwaHvwlFlqkK8CtBWCX3gb4= -github.com/google/go-github/v56 v56.0.0/go.mod h1:D8cdcX98YWJvi7TLo7zM4/h8ZTx6u6fwGEkCdisopo0= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= diff --git a/tools/metadata/main.go b/tools/metadata/main.go index 0b0562948f0..1ab2b7d2d50 100644 --- a/tools/metadata/main.go +++ b/tools/metadata/main.go @@ -15,7 +15,7 @@ import ( "path/filepath" "github.com/alecthomas/kong" - "github.com/google/go-github/v56/github" + "github.com/google/go-github/v57/github" ) var helpVars = kong.Vars{ diff --git a/tools/metadata/main_test.go b/tools/metadata/main_test.go index 39fe5357d0f..17de07d79a0 100644 --- a/tools/metadata/main_test.go +++ b/tools/metadata/main_test.go @@ -23,7 +23,7 @@ import ( "github.com/alecthomas/kong" "github.com/getkin/kin-openapi/openapi3" "github.com/google/go-cmp/cmp" - "github.com/google/go-github/v56/github" + "github.com/google/go-github/v57/github" ) func TestUpdateGo(t *testing.T) { diff --git a/tools/metadata/metadata.go b/tools/metadata/metadata.go index c60a1cfe215..079ff5c698b 100644 --- a/tools/metadata/metadata.go +++ b/tools/metadata/metadata.go @@ -24,7 +24,7 @@ import ( "strings" "sync" - "github.com/google/go-github/v56/github" + "github.com/google/go-github/v57/github" "gopkg.in/yaml.v3" ) diff --git a/tools/metadata/openapi.go b/tools/metadata/openapi.go index 4b858481f5e..0804a47020b 100644 --- a/tools/metadata/openapi.go +++ b/tools/metadata/openapi.go @@ -14,7 +14,7 @@ import ( "strconv" "github.com/getkin/kin-openapi/openapi3" - "github.com/google/go-github/v56/github" + "github.com/google/go-github/v57/github" "golang.org/x/sync/errgroup" ) From 062b6119e47d73486fe40193262708332f1dc9be Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Fri, 1 Dec 2023 12:55:17 -0500 Subject: [PATCH 066/145] Bump go-github from v56 to v57 in /scrape (#3010) --- scrape/apps.go | 2 +- scrape/apps_test.go | 2 +- scrape/go.mod | 2 +- scrape/go.sum | 5 ++--- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/scrape/apps.go b/scrape/apps.go index 851c4e1d2fb..0f26fe8f2e5 100644 --- a/scrape/apps.go +++ b/scrape/apps.go @@ -17,7 +17,7 @@ import ( "strings" "github.com/PuerkitoBio/goquery" - "github.com/google/go-github/v56/github" + "github.com/google/go-github/v57/github" ) // AppRestrictionsEnabled returns whether the specified organization has diff --git a/scrape/apps_test.go b/scrape/apps_test.go index 155056876b3..9b486e6a535 100644 --- a/scrape/apps_test.go +++ b/scrape/apps_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/google/go-github/v56/github" + "github.com/google/go-github/v57/github" ) func Test_AppRestrictionsEnabled(t *testing.T) { diff --git a/scrape/go.mod b/scrape/go.mod index 05f87b6b3a3..08daf2365b9 100644 --- a/scrape/go.mod +++ b/scrape/go.mod @@ -5,7 +5,7 @@ go 1.13 require ( github.com/PuerkitoBio/goquery v1.8.1 github.com/google/go-cmp v0.6.0 - github.com/google/go-github/v56 v56.0.0 + github.com/google/go-github/v57 v57.0.0 github.com/xlzd/gotp v0.1.0 golang.org/x/net v0.19.0 ) diff --git a/scrape/go.sum b/scrape/go.sum index 907678b1c1d..44051859775 100644 --- a/scrape/go.sum +++ b/scrape/go.sum @@ -3,11 +3,10 @@ github.com/PuerkitoBio/goquery v1.8.1/go.mod h1:Q8ICL1kNUJ2sXGoAhPGUdYDJvgQgHzJs github.com/andybalholm/cascadia v1.3.1 h1:nhxRkql1kdYCc8Snf7D5/D3spOX+dBgjA6u8x004T2c= github.com/andybalholm/cascadia v1.3.1/go.mod h1:R4bJ1UQfqADjvDa4P6HZHLh/3OxWWEqc0Sk8XGwHqvA= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-github/v56 v56.0.0 h1:TysL7dMa/r7wsQi44BjqlwaHvwlFlqkK8CtBWCX3gb4= -github.com/google/go-github/v56 v56.0.0/go.mod h1:D8cdcX98YWJvi7TLo7zM4/h8ZTx6u6fwGEkCdisopo0= +github.com/google/go-github/v57 v57.0.0 h1:L+Y3UPTY8ALM8x+TV0lg+IEBI+upibemtBD8Q9u7zHs= +github.com/google/go-github/v57 v57.0.0/go.mod h1:s0omdnye0hvK/ecLvpsGfJMiRt85PimQh4oygmLIxHw= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/xlzd/gotp v0.1.0 h1:37blvlKCh38s+fkem+fFh7sMnceltoIEBYTVXyoa5Po= From 1e66201027e8c106a1915fdaf44a63513f317409 Mon Sep 17 00:00:00 2001 From: WillAbides <233500+WillAbides@users.noreply.github.com> Date: Sat, 2 Dec 2023 15:47:01 -0600 Subject: [PATCH 067/145] Update metadata (#3012) --- github/admin.go | 4 +- github/admin_orgs.go | 6 +- github/admin_stats.go | 2 +- github/admin_users.go | 8 +- github/authorizations.go | 4 +- github/orgs_properties.go | 14 +- github/repos_hooks.go | 14 +- github/repos_hooks_configuration.go | 4 +- github/repos_hooks_deliveries.go | 6 +- github/repos_prereceive_hooks.go | 8 +- github/users_administration.go | 8 +- openapi_operations.yaml | 2185 ++++++++++++++------------- 12 files changed, 1176 insertions(+), 1087 deletions(-) diff --git a/github/admin.go b/github/admin.go index 8eee9854c11..c1f7066c7ad 100644 --- a/github/admin.go +++ b/github/admin.go @@ -82,7 +82,7 @@ func (m Enterprise) String() string { // UpdateUserLDAPMapping updates the mapping between a GitHub user and an LDAP user. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-user +// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-user // //meta:operation PATCH /admin/ldap/users/{username}/mapping func (s *AdminService) UpdateUserLDAPMapping(ctx context.Context, user string, mapping *UserLDAPMapping) (*UserLDAPMapping, *Response, error) { @@ -103,7 +103,7 @@ func (s *AdminService) UpdateUserLDAPMapping(ctx context.Context, user string, m // UpdateTeamLDAPMapping updates the mapping between a GitHub team and an LDAP group. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-team +// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-team // //meta:operation PATCH /admin/ldap/teams/{team_id}/mapping func (s *AdminService) UpdateTeamLDAPMapping(ctx context.Context, team int64, mapping *TeamLDAPMapping) (*TeamLDAPMapping, *Response, error) { diff --git a/github/admin_orgs.go b/github/admin_orgs.go index c734d4de12f..e1b3641e003 100644 --- a/github/admin_orgs.go +++ b/github/admin_orgs.go @@ -22,7 +22,7 @@ type createOrgRequest struct { // Note that only a subset of the org fields are used and org must // not be nil. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/orgs#create-an-organization +// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/orgs#create-an-organization // //meta:operation POST /admin/organizations func (s *AdminService) CreateOrg(ctx context.Context, org *Organization, admin string) (*Organization, *Response, error) { @@ -61,7 +61,7 @@ type RenameOrgResponse struct { // RenameOrg renames an organization in GitHub Enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/orgs#update-an-organization-name +// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/orgs#update-an-organization-name // //meta:operation PATCH /admin/organizations/{org} func (s *AdminService) RenameOrg(ctx context.Context, org *Organization, newName string) (*RenameOrgResponse, *Response, error) { @@ -70,7 +70,7 @@ func (s *AdminService) RenameOrg(ctx context.Context, org *Organization, newName // RenameOrgByName renames an organization in GitHub Enterprise using its current name. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/orgs#update-an-organization-name +// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/orgs#update-an-organization-name // //meta:operation PATCH /admin/organizations/{org} func (s *AdminService) RenameOrgByName(ctx context.Context, org, newName string) (*RenameOrgResponse, *Response, error) { diff --git a/github/admin_stats.go b/github/admin_stats.go index aa23f5d1995..f26b393e02f 100644 --- a/github/admin_stats.go +++ b/github/admin_stats.go @@ -152,7 +152,7 @@ func (s RepoStats) String() string { // Please note that this is only available to site administrators, // otherwise it will error with a 404 not found (instead of 401 or 403). // -// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/admin-stats#get-all-statistics +// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/admin-stats#get-all-statistics // //meta:operation GET /enterprise/stats/all func (s *AdminService) GetAdminStats(ctx context.Context) (*AdminStats, *Response, error) { diff --git a/github/admin_users.go b/github/admin_users.go index 3916a470b04..0d3fe9fafc1 100644 --- a/github/admin_users.go +++ b/github/admin_users.go @@ -19,7 +19,7 @@ type createUserRequest struct { // CreateUser creates a new user in GitHub Enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#create-a-user +// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#create-a-user // //meta:operation POST /admin/users func (s *AdminService) CreateUser(ctx context.Context, login, email string) (*User, *Response, error) { @@ -46,7 +46,7 @@ func (s *AdminService) CreateUser(ctx context.Context, login, email string) (*Us // DeleteUser deletes a user in GitHub Enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#delete-a-user +// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#delete-a-user // //meta:operation DELETE /admin/users/{username} func (s *AdminService) DeleteUser(ctx context.Context, username string) (*Response, error) { @@ -99,7 +99,7 @@ type UserAuthorization struct { // CreateUserImpersonation creates an impersonation OAuth token. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#create-an-impersonation-oauth-token +// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#create-an-impersonation-oauth-token // //meta:operation POST /admin/users/{username}/authorizations func (s *AdminService) CreateUserImpersonation(ctx context.Context, username string, opts *ImpersonateUserOptions) (*UserAuthorization, *Response, error) { @@ -121,7 +121,7 @@ func (s *AdminService) CreateUserImpersonation(ctx context.Context, username str // DeleteUserImpersonation deletes an impersonation OAuth token. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#delete-an-impersonation-oauth-token +// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#delete-an-impersonation-oauth-token // //meta:operation DELETE /admin/users/{username}/authorizations func (s *AdminService) DeleteUserImpersonation(ctx context.Context, username string) (*Response, error) { diff --git a/github/authorizations.go b/github/authorizations.go index 7adc5323678..931b77299b0 100644 --- a/github/authorizations.go +++ b/github/authorizations.go @@ -257,7 +257,7 @@ func (s *AuthorizationsService) DeleteGrant(ctx context.Context, clientID, acces // you can e.g. create or delete a user's public SSH key. NOTE: creating a // new token automatically revokes an existing one. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#create-an-impersonation-oauth-token +// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#create-an-impersonation-oauth-token // //meta:operation POST /admin/users/{username}/authorizations func (s *AuthorizationsService) CreateImpersonation(ctx context.Context, username string, authReq *AuthorizationRequest) (*Authorization, *Response, error) { @@ -279,7 +279,7 @@ func (s *AuthorizationsService) CreateImpersonation(ctx context.Context, usernam // // NOTE: there can be only one at a time. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#delete-an-impersonation-oauth-token +// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#delete-an-impersonation-oauth-token // //meta:operation DELETE /admin/users/{username}/authorizations func (s *AuthorizationsService) DeleteImpersonation(ctx context.Context, username string) (*Response, error) { diff --git a/github/orgs_properties.go b/github/orgs_properties.go index 1daac811804..45e3f1f964d 100644 --- a/github/orgs_properties.go +++ b/github/orgs_properties.go @@ -39,7 +39,7 @@ type CustomPropertyValue struct { // GetAllCustomProperties gets all custom properties that are defined for the specified organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/properties#get-all-custom-properties-for-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties#get-all-custom-properties-for-an-organization // //meta:operation GET /orgs/{org}/properties/schema func (s *OrganizationsService) GetAllCustomProperties(ctx context.Context, org string) ([]*CustomProperty, *Response, error) { @@ -61,7 +61,7 @@ func (s *OrganizationsService) GetAllCustomProperties(ctx context.Context, org s // CreateOrUpdateCustomProperties creates new or updates existing custom properties that are defined for the specified organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/properties#create-or-update-custom-properties-for-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties#create-or-update-custom-properties-for-an-organization // //meta:operation PATCH /orgs/{org}/properties/schema func (s *OrganizationsService) CreateOrUpdateCustomProperties(ctx context.Context, org string, properties []*CustomProperty) ([]*CustomProperty, *Response, error) { @@ -89,7 +89,7 @@ func (s *OrganizationsService) CreateOrUpdateCustomProperties(ctx context.Contex // GetCustomProperty gets a custom property that is defined for the specified organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/properties#get-a-custom-property-for-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties#get-a-custom-property-for-an-organization // //meta:operation GET /orgs/{org}/properties/schema/{custom_property_name} func (s *OrganizationsService) GetCustomProperty(ctx context.Context, org, name string) (*CustomProperty, *Response, error) { @@ -111,7 +111,7 @@ func (s *OrganizationsService) GetCustomProperty(ctx context.Context, org, name // CreateOrUpdateCustomProperty creates a new or updates an existing custom property that is defined for the specified organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/properties#create-or-update-a-custom-property-for-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties#create-or-update-a-custom-property-for-an-organization // //meta:operation PUT /orgs/{org}/properties/schema/{custom_property_name} func (s *OrganizationsService) CreateOrUpdateCustomProperty(ctx context.Context, org, customPropertyName string, property *CustomProperty) (*CustomProperty, *Response, error) { @@ -133,7 +133,7 @@ func (s *OrganizationsService) CreateOrUpdateCustomProperty(ctx context.Context, // RemoveCustomProperty removes a custom property that is defined for the specified organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/properties#remove-a-custom-property-for-an-organization +// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties#remove-a-custom-property-for-an-organization // //meta:operation DELETE /orgs/{org}/properties/schema/{custom_property_name} func (s *OrganizationsService) RemoveCustomProperty(ctx context.Context, org, customPropertyName string) (*Response, error) { @@ -149,7 +149,7 @@ func (s *OrganizationsService) RemoveCustomProperty(ctx context.Context, org, cu // ListCustomPropertyValues lists all custom property values for repositories in the specified organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/properties#list-custom-property-values-for-organization-repositories +// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties#list-custom-property-values-for-organization-repositories // //meta:operation GET /orgs/{org}/properties/values func (s *OrganizationsService) ListCustomPropertyValues(ctx context.Context, org string, opts *ListOptions) ([]*RepoCustomPropertyValue, *Response, error) { @@ -175,7 +175,7 @@ func (s *OrganizationsService) ListCustomPropertyValues(ctx context.Context, org // CreateOrUpdateRepoCustomPropertyValues creates new or updates existing custom property values across multiple repositories for the specified organization. // -// GitHub API docs: https://docs.github.com/rest/orgs/properties#create-or-update-custom-property-values-for-organization-repositories +// GitHub API docs: https://docs.github.com/rest/orgs/custom-properties#create-or-update-custom-property-values-for-organization-repositories // //meta:operation PATCH /orgs/{org}/properties/values func (s *OrganizationsService) CreateOrUpdateRepoCustomPropertyValues(ctx context.Context, org string, repoNames []string, properties []*CustomProperty) (*Response, error) { diff --git a/github/repos_hooks.go b/github/repos_hooks.go index 8768d603d2b..3edf6475666 100644 --- a/github/repos_hooks.go +++ b/github/repos_hooks.go @@ -79,7 +79,7 @@ type createHookRequest struct { // Note that only a subset of the hook fields are used and hook must // not be nil. // -// GitHub API docs: https://docs.github.com/rest/webhooks/repos#create-a-repository-webhook +// GitHub API docs: https://docs.github.com/rest/repos/webhooks#create-a-repository-webhook // //meta:operation POST /repos/{owner}/{repo}/hooks func (s *RepositoriesService) CreateHook(ctx context.Context, owner, repo string, hook *Hook) (*Hook, *Response, error) { @@ -108,7 +108,7 @@ func (s *RepositoriesService) CreateHook(ctx context.Context, owner, repo string // ListHooks lists all Hooks for the specified repository. // -// GitHub API docs: https://docs.github.com/rest/webhooks/repos#list-repository-webhooks +// GitHub API docs: https://docs.github.com/rest/repos/webhooks#list-repository-webhooks // //meta:operation GET /repos/{owner}/{repo}/hooks func (s *RepositoriesService) ListHooks(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Hook, *Response, error) { @@ -134,7 +134,7 @@ func (s *RepositoriesService) ListHooks(ctx context.Context, owner, repo string, // GetHook returns a single specified Hook. // -// GitHub API docs: https://docs.github.com/rest/webhooks/repos#get-a-repository-webhook +// GitHub API docs: https://docs.github.com/rest/repos/webhooks#get-a-repository-webhook // //meta:operation GET /repos/{owner}/{repo}/hooks/{hook_id} func (s *RepositoriesService) GetHook(ctx context.Context, owner, repo string, id int64) (*Hook, *Response, error) { @@ -154,7 +154,7 @@ func (s *RepositoriesService) GetHook(ctx context.Context, owner, repo string, i // EditHook updates a specified Hook. // -// GitHub API docs: https://docs.github.com/rest/webhooks/repos#update-a-repository-webhook +// GitHub API docs: https://docs.github.com/rest/repos/webhooks#update-a-repository-webhook // //meta:operation PATCH /repos/{owner}/{repo}/hooks/{hook_id} func (s *RepositoriesService) EditHook(ctx context.Context, owner, repo string, id int64, hook *Hook) (*Hook, *Response, error) { @@ -174,7 +174,7 @@ func (s *RepositoriesService) EditHook(ctx context.Context, owner, repo string, // DeleteHook deletes a specified Hook. // -// GitHub API docs: https://docs.github.com/rest/webhooks/repos#delete-a-repository-webhook +// GitHub API docs: https://docs.github.com/rest/repos/webhooks#delete-a-repository-webhook // //meta:operation DELETE /repos/{owner}/{repo}/hooks/{hook_id} func (s *RepositoriesService) DeleteHook(ctx context.Context, owner, repo string, id int64) (*Response, error) { @@ -188,7 +188,7 @@ func (s *RepositoriesService) DeleteHook(ctx context.Context, owner, repo string // PingHook triggers a 'ping' event to be sent to the Hook. // -// GitHub API docs: https://docs.github.com/rest/webhooks/repos#ping-a-repository-webhook +// GitHub API docs: https://docs.github.com/rest/repos/webhooks#ping-a-repository-webhook // //meta:operation POST /repos/{owner}/{repo}/hooks/{hook_id}/pings func (s *RepositoriesService) PingHook(ctx context.Context, owner, repo string, id int64) (*Response, error) { @@ -202,7 +202,7 @@ func (s *RepositoriesService) PingHook(ctx context.Context, owner, repo string, // TestHook triggers a test Hook by github. // -// GitHub API docs: https://docs.github.com/rest/webhooks/repos#test-the-push-repository-webhook +// GitHub API docs: https://docs.github.com/rest/repos/webhooks#test-the-push-repository-webhook // //meta:operation POST /repos/{owner}/{repo}/hooks/{hook_id}/tests func (s *RepositoriesService) TestHook(ctx context.Context, owner, repo string, id int64) (*Response, error) { diff --git a/github/repos_hooks_configuration.go b/github/repos_hooks_configuration.go index 2203d7614f5..b58eb248e44 100644 --- a/github/repos_hooks_configuration.go +++ b/github/repos_hooks_configuration.go @@ -12,7 +12,7 @@ import ( // GetHookConfiguration returns the configuration for the specified repository webhook. // -// GitHub API docs: https://docs.github.com/rest/webhooks/repo-config#get-a-webhook-configuration-for-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/webhooks#get-a-webhook-configuration-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/hooks/{hook_id}/config func (s *RepositoriesService) GetHookConfiguration(ctx context.Context, owner, repo string, id int64) (*HookConfig, *Response, error) { @@ -33,7 +33,7 @@ func (s *RepositoriesService) GetHookConfiguration(ctx context.Context, owner, r // EditHookConfiguration updates the configuration for the specified repository webhook. // -// GitHub API docs: https://docs.github.com/rest/webhooks/repo-config#update-a-webhook-configuration-for-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/webhooks#update-a-webhook-configuration-for-a-repository // //meta:operation PATCH /repos/{owner}/{repo}/hooks/{hook_id}/config func (s *RepositoriesService) EditHookConfiguration(ctx context.Context, owner, repo string, id int64, config *HookConfig) (*HookConfig, *Response, error) { diff --git a/github/repos_hooks_deliveries.go b/github/repos_hooks_deliveries.go index 6e1fd86f99b..c8029f626b9 100644 --- a/github/repos_hooks_deliveries.go +++ b/github/repos_hooks_deliveries.go @@ -63,7 +63,7 @@ func (r HookResponse) String() string { // ListHookDeliveries lists webhook deliveries for a webhook configured in a repository. // -// GitHub API docs: https://docs.github.com/rest/webhooks/repo-deliveries#list-deliveries-for-a-repository-webhook +// GitHub API docs: https://docs.github.com/rest/repos/webhooks#list-deliveries-for-a-repository-webhook // //meta:operation GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries func (s *RepositoriesService) ListHookDeliveries(ctx context.Context, owner, repo string, id int64, opts *ListCursorOptions) ([]*HookDelivery, *Response, error) { @@ -89,7 +89,7 @@ func (s *RepositoriesService) ListHookDeliveries(ctx context.Context, owner, rep // GetHookDelivery returns a delivery for a webhook configured in a repository. // -// GitHub API docs: https://docs.github.com/rest/webhooks/repo-deliveries#get-a-delivery-for-a-repository-webhook +// GitHub API docs: https://docs.github.com/rest/repos/webhooks#get-a-delivery-for-a-repository-webhook // //meta:operation GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries/{delivery_id} func (s *RepositoriesService) GetHookDelivery(ctx context.Context, owner, repo string, hookID, deliveryID int64) (*HookDelivery, *Response, error) { @@ -110,7 +110,7 @@ func (s *RepositoriesService) GetHookDelivery(ctx context.Context, owner, repo s // RedeliverHookDelivery redelivers a delivery for a webhook configured in a repository. // -// GitHub API docs: https://docs.github.com/rest/webhooks/repo-deliveries#redeliver-a-delivery-for-a-repository-webhook +// GitHub API docs: https://docs.github.com/rest/repos/webhooks#redeliver-a-delivery-for-a-repository-webhook // //meta:operation POST /repos/{owner}/{repo}/hooks/{hook_id}/deliveries/{delivery_id}/attempts func (s *RepositoriesService) RedeliverHookDelivery(ctx context.Context, owner, repo string, hookID, deliveryID int64) (*HookDelivery, *Response, error) { diff --git a/github/repos_prereceive_hooks.go b/github/repos_prereceive_hooks.go index e8361383f57..b1d3f3c818d 100644 --- a/github/repos_prereceive_hooks.go +++ b/github/repos_prereceive_hooks.go @@ -24,7 +24,7 @@ func (p PreReceiveHook) String() string { // ListPreReceiveHooks lists all pre-receive hooks for the specified repository. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/repo-pre-receive-hooks#list-pre-receive-hooks-for-a-repository +// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/repo-pre-receive-hooks#list-pre-receive-hooks-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/pre-receive-hooks func (s *RepositoriesService) ListPreReceiveHooks(ctx context.Context, owner, repo string, opts *ListOptions) ([]*PreReceiveHook, *Response, error) { @@ -53,7 +53,7 @@ func (s *RepositoriesService) ListPreReceiveHooks(ctx context.Context, owner, re // GetPreReceiveHook returns a single specified pre-receive hook. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/repo-pre-receive-hooks#get-a-pre-receive-hook-for-a-repository +// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/repo-pre-receive-hooks#get-a-pre-receive-hook-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/pre-receive-hooks/{pre_receive_hook_id} func (s *RepositoriesService) GetPreReceiveHook(ctx context.Context, owner, repo string, id int64) (*PreReceiveHook, *Response, error) { @@ -77,7 +77,7 @@ func (s *RepositoriesService) GetPreReceiveHook(ctx context.Context, owner, repo // UpdatePreReceiveHook updates a specified pre-receive hook. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/repo-pre-receive-hooks#update-pre-receive-hook-enforcement-for-a-repository +// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/repo-pre-receive-hooks#update-pre-receive-hook-enforcement-for-a-repository // //meta:operation PATCH /repos/{owner}/{repo}/pre-receive-hooks/{pre_receive_hook_id} func (s *RepositoriesService) UpdatePreReceiveHook(ctx context.Context, owner, repo string, id int64, hook *PreReceiveHook) (*PreReceiveHook, *Response, error) { @@ -101,7 +101,7 @@ func (s *RepositoriesService) UpdatePreReceiveHook(ctx context.Context, owner, r // DeletePreReceiveHook deletes a specified pre-receive hook. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/repo-pre-receive-hooks#remove-pre-receive-hook-enforcement-for-a-repository +// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/repo-pre-receive-hooks#remove-pre-receive-hook-enforcement-for-a-repository // //meta:operation DELETE /repos/{owner}/{repo}/pre-receive-hooks/{pre_receive_hook_id} func (s *RepositoriesService) DeletePreReceiveHook(ctx context.Context, owner, repo string, id int64) (*Response, error) { diff --git a/github/users_administration.go b/github/users_administration.go index 02cb894bc3b..5b9e1de8c60 100644 --- a/github/users_administration.go +++ b/github/users_administration.go @@ -12,7 +12,7 @@ import ( // PromoteSiteAdmin promotes a user to a site administrator of a GitHub Enterprise instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#promote-a-user-to-be-a-site-administrator +// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#promote-a-user-to-be-a-site-administrator // //meta:operation PUT /users/{username}/site_admin func (s *UsersService) PromoteSiteAdmin(ctx context.Context, user string) (*Response, error) { @@ -28,7 +28,7 @@ func (s *UsersService) PromoteSiteAdmin(ctx context.Context, user string) (*Resp // DemoteSiteAdmin demotes a user from site administrator of a GitHub Enterprise instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#demote-a-site-administrator +// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#demote-a-site-administrator // //meta:operation DELETE /users/{username}/site_admin func (s *UsersService) DemoteSiteAdmin(ctx context.Context, user string) (*Response, error) { @@ -49,7 +49,7 @@ type UserSuspendOptions struct { // Suspend a user on a GitHub Enterprise instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#suspend-a-user +// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#suspend-a-user // //meta:operation PUT /users/{username}/suspended func (s *UsersService) Suspend(ctx context.Context, user string, opts *UserSuspendOptions) (*Response, error) { @@ -65,7 +65,7 @@ func (s *UsersService) Suspend(ctx context.Context, user string, opts *UserSuspe // Unsuspend a user on a GitHub Enterprise instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#unsuspend-a-user +// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#unsuspend-a-user // //meta:operation DELETE /users/{username}/suspended func (s *UsersService) Unsuspend(ctx context.Context, user string) (*Response, error) { diff --git a/openapi_operations.yaml b/openapi_operations.yaml index f2b1af28843..53fe8c5fe52 100644 --- a/openapi_operations.yaml +++ b/openapi_operations.yaml @@ -48,258 +48,260 @@ operation_overrides: documentation_url: https://docs.github.com/rest/pages/pages#request-a-github-pages-build - name: GET /repos/{owner}/{repo}/pages/builds/{build_id} documentation_url: https://docs.github.com/rest/pages/pages#get-github-pages-build -openapi_commit: c86f07e1ca0d543d0b8fc7591991b02767e02deb +openapi_commit: 6922a6cfe785e1069e93d6e501805cf6e1891076 openapi_operations: - name: GET / documentation_url: https://docs.github.com/rest/meta/meta#github-api-root openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /admin/hooks - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/global-webhooks#list-global-webhooks + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/global-webhooks#list-global-webhooks openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /admin/hooks - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/global-webhooks#create-a-global-webhook + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/global-webhooks#create-a-global-webhook openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /admin/hooks/{hook_id} - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/global-webhooks#delete-a-global-webhook + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/global-webhooks#delete-a-global-webhook openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /admin/hooks/{hook_id} - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/global-webhooks#get-a-global-webhook + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/global-webhooks#get-a-global-webhook openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /admin/hooks/{hook_id} - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/global-webhooks#update-a-global-webhook + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/global-webhooks#update-a-global-webhook openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /admin/hooks/{hook_id}/pings - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/global-webhooks#ping-a-global-webhook + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/global-webhooks#ping-a-global-webhook openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /admin/keys - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#list-public-keys + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#list-public-keys openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /admin/keys/{key_ids} - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#delete-a-public-key + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#delete-a-public-key openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /admin/ldap/teams/{team_id}/mapping - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-team + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-team openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /admin/ldap/teams/{team_id}/sync - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/ldap#sync-ldap-mapping-for-a-team + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/ldap#sync-ldap-mapping-for-a-team openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /admin/ldap/users/{username}/mapping - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-user + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-user openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /admin/ldap/users/{username}/sync - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/ldap#sync-ldap-mapping-for-a-user + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/ldap#sync-ldap-mapping-for-a-user openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /admin/organizations - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/orgs#create-an-organization + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/orgs#create-an-organization openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /admin/organizations/{org} - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/orgs#update-an-organization-name + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/orgs#update-an-organization-name openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /admin/pre-receive-environments - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/pre-receive-environments#list-pre-receive-environments + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/pre-receive-environments#list-pre-receive-environments openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /admin/pre-receive-environments - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/pre-receive-environments#create-a-pre-receive-environment + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/pre-receive-environments#create-a-pre-receive-environment openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /admin/pre-receive-environments/{pre_receive_environment_id} - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/pre-receive-environments#delete-a-pre-receive-environment + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/pre-receive-environments#delete-a-pre-receive-environment openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /admin/pre-receive-environments/{pre_receive_environment_id} - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/pre-receive-environments#get-a-pre-receive-environment + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/pre-receive-environments#get-a-pre-receive-environment openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /admin/pre-receive-environments/{pre_receive_environment_id} - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/pre-receive-environments#update-a-pre-receive-environment + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/pre-receive-environments#update-a-pre-receive-environment openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /admin/pre-receive-environments/{pre_receive_environment_id}/downloads - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/pre-receive-environments#start-a-pre-receive-environment-download + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/pre-receive-environments#start-a-pre-receive-environment-download openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /admin/pre-receive-environments/{pre_receive_environment_id}/downloads/latest - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/pre-receive-environments#get-the-download-status-for-a-pre-receive-environment + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/pre-receive-environments#get-the-download-status-for-a-pre-receive-environment openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /admin/pre-receive-hooks - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/pre-receive-hooks#list-pre-receive-hooks + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/pre-receive-hooks#list-pre-receive-hooks openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /admin/pre-receive-hooks - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/pre-receive-hooks#create-a-pre-receive-hook + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/pre-receive-hooks#create-a-pre-receive-hook openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /admin/pre-receive-hooks/{pre_receive_hook_id} - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/pre-receive-hooks#delete-a-pre-receive-hook + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/pre-receive-hooks#delete-a-pre-receive-hook openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /admin/pre-receive-hooks/{pre_receive_hook_id} - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/pre-receive-hooks#get-a-pre-receive-hook + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/pre-receive-hooks#get-a-pre-receive-hook openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /admin/pre-receive-hooks/{pre_receive_hook_id} - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/pre-receive-hooks#update-a-pre-receive-hook + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/pre-receive-hooks#update-a-pre-receive-hook openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /admin/tokens - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#list-personal-access-tokens + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#list-personal-access-tokens openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /admin/tokens/{token_id} - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#delete-a-personal-access-token + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#delete-a-personal-access-token openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /admin/users - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#create-a-user + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#create-a-user openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /admin/users/{username} - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#delete-a-user + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#delete-a-user openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /admin/users/{username} - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#update-the-username-for-a-user + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#update-the-username-for-a-user openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /admin/users/{username}/authorizations - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#delete-an-impersonation-oauth-token + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#delete-an-impersonation-oauth-token openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /admin/users/{username}/authorizations - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#create-an-impersonation-oauth-token + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#create-an-impersonation-oauth-token openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /advisories documentation_url: https://docs.github.com/rest/security-advisories/global-advisories#list-global-security-advisories openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /advisories/{ghsa_id} documentation_url: https://docs.github.com/rest/security-advisories/global-advisories#get-a-global-security-advisory openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /app documentation_url: https://docs.github.com/rest/apps/apps#get-the-authenticated-app openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /app-manifests/{code}/conversions documentation_url: https://docs.github.com/rest/apps/apps#create-a-github-app-from-a-manifest openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /app/hook/config documentation_url: https://docs.github.com/rest/apps/webhooks#get-a-webhook-configuration-for-an-app openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /app/hook/config documentation_url: https://docs.github.com/rest/apps/webhooks#update-a-webhook-configuration-for-an-app openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /app/hook/deliveries documentation_url: https://docs.github.com/rest/apps/webhooks#list-deliveries-for-an-app-webhook openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /app/hook/deliveries/{delivery_id} documentation_url: https://docs.github.com/rest/apps/webhooks#get-a-delivery-for-an-app-webhook openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /app/hook/deliveries/{delivery_id}/attempts documentation_url: https://docs.github.com/rest/apps/webhooks#redeliver-a-delivery-for-an-app-webhook openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /app/installation-requests documentation_url: https://docs.github.com/rest/apps/apps#list-installation-requests-for-the-authenticated-app openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /app/installations documentation_url: https://docs.github.com/rest/apps/apps#list-installations-for-the-authenticated-app openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /app/installations/{installation_id} documentation_url: https://docs.github.com/rest/apps/apps#delete-an-installation-for-the-authenticated-app openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /app/installations/{installation_id} documentation_url: https://docs.github.com/rest/apps/apps#get-an-installation-for-the-authenticated-app openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /app/installations/{installation_id}/access_tokens documentation_url: https://docs.github.com/rest/apps/apps#create-an-installation-access-token-for-an-app openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /app/installations/{installation_id}/suspended documentation_url: https://docs.github.com/rest/apps/apps#unsuspend-an-app-installation openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /app/installations/{installation_id}/suspended documentation_url: https://docs.github.com/rest/apps/apps#suspend-an-app-installation openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /applications/grants - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/oauth-authorizations/oauth-authorizations#list-your-grants + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/oauth-authorizations/oauth-authorizations#list-your-grants openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /applications/grants/{grant_id} - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/oauth-authorizations/oauth-authorizations#delete-a-grant + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/oauth-authorizations/oauth-authorizations#delete-a-grant openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /applications/grants/{grant_id} - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/oauth-authorizations/oauth-authorizations#get-a-single-grant + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/oauth-authorizations/oauth-authorizations#get-a-single-grant openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /applications/{client_id}/grant documentation_url: https://docs.github.com/rest/apps/oauth-applications#delete-an-app-authorization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /applications/{client_id}/grants/{access_token} documentation_url: https://docs.github.com/enterprise-server@3.3/rest/reference/apps#revoke-a-grant-for-an-application openapi_files: @@ -309,25 +311,25 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /applications/{client_id}/token documentation_url: https://docs.github.com/rest/apps/oauth-applications#reset-a-token openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /applications/{client_id}/token documentation_url: https://docs.github.com/rest/apps/oauth-applications#check-a-token openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /applications/{client_id}/token/scoped documentation_url: https://docs.github.com/rest/apps/apps#create-a-scoped-access-token openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /applications/{client_id}/tokens/{access_token} documentation_url: https://docs.github.com/enterprise-server@3.3/rest/reference/apps#revoke-an-authorization-for-an-application openapi_files: @@ -345,7 +347,7 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /assignments/{assignment_id} documentation_url: https://docs.github.com/rest/classroom/classroom#get-an-assignment openapi_files: @@ -362,33 +364,33 @@ openapi_operations: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - name: GET /authorizations - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/oauth-authorizations/oauth-authorizations#list-your-authorizations + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/oauth-authorizations/oauth-authorizations#list-your-authorizations openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /authorizations - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/oauth-authorizations/oauth-authorizations#create-a-new-authorization + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/oauth-authorizations/oauth-authorizations#create-a-new-authorization openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /authorizations/clients/{client_id} - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/oauth-authorizations/oauth-authorizations#get-or-create-an-authorization-for-a-specific-app + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/oauth-authorizations/oauth-authorizations#get-or-create-an-authorization-for-a-specific-app openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /authorizations/clients/{client_id}/{fingerprint} - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/oauth-authorizations/oauth-authorizations#get-or-create-an-authorization-for-a-specific-app-and-fingerprint + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/oauth-authorizations/oauth-authorizations#get-or-create-an-authorization-for-a-specific-app-and-fingerprint openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /authorizations/{authorization_id} - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/oauth-authorizations/oauth-authorizations#delete-an-authorization + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/oauth-authorizations/oauth-authorizations#delete-an-authorization openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /authorizations/{authorization_id} - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/oauth-authorizations/oauth-authorizations#get-a-single-authorization + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/oauth-authorizations/oauth-authorizations#get-a-single-authorization openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /authorizations/{authorization_id} - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/oauth-authorizations/oauth-authorizations#update-an-existing-authorization + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/oauth-authorizations/oauth-authorizations#update-an-existing-authorization openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /classrooms documentation_url: https://docs.github.com/rest/classroom/classroom#list-classrooms openapi_files: @@ -409,100 +411,100 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /codes_of_conduct/{key} documentation_url: https://docs.github.com/rest/codes-of-conduct/codes-of-conduct#get-a-code-of-conduct openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /emojis documentation_url: https://docs.github.com/rest/emojis/emojis#get-emojis openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /enterprise-installation/{enterprise_or_org}/server-statistics documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/admin-stats#get-github-enterprise-server-statistics openapi_files: - descriptions/ghec/ghec.json - name: DELETE /enterprise/announcement - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/announcement#remove-the-global-announcement-banner + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/announcement#remove-the-global-announcement-banner openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /enterprise/announcement - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/announcement#get-the-global-announcement-banner + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/announcement#get-the-global-announcement-banner openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /enterprise/announcement - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/announcement#set-the-global-announcement-banner + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/announcement#set-the-global-announcement-banner openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /enterprise/settings/license - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/license#get-license-information + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/license#get-license-information openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /enterprise/stats/all - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/admin-stats#get-all-statistics + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/admin-stats#get-all-statistics openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /enterprise/stats/comments - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/admin-stats#get-comment-statistics + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/admin-stats#get-comment-statistics openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /enterprise/stats/gists - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/admin-stats#get-gist-statistics + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/admin-stats#get-gist-statistics openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /enterprise/stats/hooks - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/admin-stats#get-hooks-statistics + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/admin-stats#get-hooks-statistics openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /enterprise/stats/issues - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/admin-stats#get-issue-statistics + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/admin-stats#get-issue-statistics openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /enterprise/stats/milestones - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/admin-stats#get-milestone-statistics + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/admin-stats#get-milestone-statistics openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /enterprise/stats/orgs - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/admin-stats#get-organization-statistics + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/admin-stats#get-organization-statistics openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /enterprise/stats/pages - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/admin-stats#get-pages-statistics + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/admin-stats#get-pages-statistics openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /enterprise/stats/pulls - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/admin-stats#get-pull-request-statistics + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/admin-stats#get-pull-request-statistics openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /enterprise/stats/repos - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/admin-stats#get-repository-statistics + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/admin-stats#get-repository-statistics openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /enterprise/stats/security-products - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/admin-stats#get-security-products-statistics + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/admin-stats#get-security-products-statistics openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /enterprise/stats/users - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/admin-stats#get-users-statistics + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/admin-stats#get-users-statistics openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /enterprises/{enterprise}/actions/cache/usage documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/cache#get-github-actions-cache-usage-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /enterprises/{enterprise}/actions/cache/usage-policy - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/actions/cache#get-github-actions-cache-usage-policy-for-an-enterprise + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/actions/cache#get-github-actions-cache-usage-policy-for-an-enterprise openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /enterprises/{enterprise}/actions/cache/usage-policy - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/actions/cache#set-github-actions-cache-usage-policy-for-an-enterprise + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/actions/cache#set-github-actions-cache-usage-policy-for-an-enterprise openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /enterprises/{enterprise}/actions/oidc/customization/issuer documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/oidc#set-the-github-actions-oidc-custom-issuer-policy-for-an-enterprise openapi_files: @@ -511,177 +513,177 @@ openapi_operations: documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/permissions#get-github-actions-permissions-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /enterprises/{enterprise}/actions/permissions documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/permissions#set-github-actions-permissions-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /enterprises/{enterprise}/actions/permissions/organizations documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/permissions#list-selected-organizations-enabled-for-github-actions-in-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /enterprises/{enterprise}/actions/permissions/organizations documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/permissions#set-selected-organizations-enabled-for-github-actions-in-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /enterprises/{enterprise}/actions/permissions/organizations/{org_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/permissions#disable-a-selected-organization-for-github-actions-in-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /enterprises/{enterprise}/actions/permissions/organizations/{org_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/permissions#enable-a-selected-organization-for-github-actions-in-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /enterprises/{enterprise}/actions/permissions/selected-actions documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /enterprises/{enterprise}/actions/permissions/selected-actions documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /enterprises/{enterprise}/actions/permissions/workflow documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/permissions#get-default-workflow-permissions-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /enterprises/{enterprise}/actions/permissions/workflow documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/permissions#set-default-workflow-permissions-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /enterprises/{enterprise}/actions/runner-groups documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#list-self-hosted-runner-groups-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /enterprises/{enterprise}/actions/runner-groups documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#create-a-self-hosted-runner-group-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /enterprises/{enterprise}/actions/runner-groups/{runner_group_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#delete-a-self-hosted-runner-group-from-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /enterprises/{enterprise}/actions/runner-groups/{runner_group_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#get-a-self-hosted-runner-group-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /enterprises/{enterprise}/actions/runner-groups/{runner_group_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#update-a-self-hosted-runner-group-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#list-organization-access-to-a-self-hosted-runner-group-in-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#set-organization-access-for-a-self-hosted-runner-group-in-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations/{org_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#remove-organization-access-to-a-self-hosted-runner-group-in-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations/{org_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#add-organization-access-to-a-self-hosted-runner-group-in-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#list-self-hosted-runners-in-a-group-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#set-self-hosted-runners-in-a-group-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners/{runner_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#remove-a-self-hosted-runner-from-a-group-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners/{runner_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#add-a-self-hosted-runner-to-a-group-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /enterprises/{enterprise}/actions/runners documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runners#list-self-hosted-runners-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /enterprises/{enterprise}/actions/runners/downloads documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runners#list-runner-applications-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /enterprises/{enterprise}/actions/runners/generate-jitconfig documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runners#create-configuration-for-a-just-in-time-runner-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /enterprises/{enterprise}/actions/runners/registration-token documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runners#create-a-registration-token-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /enterprises/{enterprise}/actions/runners/remove-token documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runners#create-a-remove-token-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /enterprises/{enterprise}/actions/runners/{runner_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runners#delete-a-self-hosted-runner-from-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /enterprises/{enterprise}/actions/runners/{runner_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runners#get-a-self-hosted-runner-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /enterprises/{enterprise}/actions/runners/{runner_id}/labels documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runners#remove-all-custom-labels-from-a-self-hosted-runner-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /enterprises/{enterprise}/actions/runners/{runner_id}/labels documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runners#list-labels-for-a-self-hosted-runner-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /enterprises/{enterprise}/actions/runners/{runner_id}/labels documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runners#add-custom-labels-to-a-self-hosted-runner-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /enterprises/{enterprise}/actions/runners/{runner_id}/labels documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runners#set-custom-labels-for-a-self-hosted-runner-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /enterprises/{enterprise}/actions/runners/{runner_id}/labels/{name} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runners#remove-a-custom-label-from-a-self-hosted-runner-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /enterprises/{enterprise}/announcement documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/announcement-banners/enterprises#remove-announcement-banner-from-enterprise openapi_files: @@ -698,22 +700,22 @@ openapi_operations: documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/audit-log#get-the-audit-log-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /enterprises/{enterprise}/code-scanning/alerts documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/code-scanning/code-scanning#list-code-scanning-alerts-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /enterprises/{enterprise}/code_security_and_analysis documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/code-security-and-analysis#get-code-security-and-analysis-features-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /enterprises/{enterprise}/code_security_and_analysis documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/code-security-and-analysis#update-code-security-and-analysis-features-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /enterprises/{enterprise}/consumed-licenses documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/license#list-enterprise-consumed-licenses openapi_files: @@ -723,7 +725,7 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /enterprises/{enterprise}/license-sync-status documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/license#get-a-license-sync-status openapi_files: @@ -733,7 +735,7 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /enterprises/{enterprise}/settings/billing/actions documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/billing#get-github-actions-billing-for-an-enterprise openapi_files: @@ -742,7 +744,7 @@ openapi_operations: documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/billing#get-github-advanced-security-active-committers-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /enterprises/{enterprise}/settings/billing/packages documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/billing#get-github-packages-billing-for-an-enterprise openapi_files: @@ -755,207 +757,207 @@ openapi_operations: documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/code-security-and-analysis#enable-or-disable-a-security-feature openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /events documentation_url: https://docs.github.com/rest/activity/events#list-public-events openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /feeds documentation_url: https://docs.github.com/rest/activity/feeds#get-feeds openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /gists documentation_url: https://docs.github.com/rest/gists/gists#list-gists-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /gists documentation_url: https://docs.github.com/rest/gists/gists#create-a-gist openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /gists/public documentation_url: https://docs.github.com/rest/gists/gists#list-public-gists openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /gists/starred documentation_url: https://docs.github.com/rest/gists/gists#list-starred-gists openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /gists/{gist_id} documentation_url: https://docs.github.com/rest/gists/gists#delete-a-gist openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /gists/{gist_id} documentation_url: https://docs.github.com/rest/gists/gists#get-a-gist openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /gists/{gist_id} documentation_url: https://docs.github.com/rest/gists/gists#update-a-gist openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /gists/{gist_id}/comments documentation_url: https://docs.github.com/rest/gists/comments#list-gist-comments openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /gists/{gist_id}/comments documentation_url: https://docs.github.com/rest/gists/comments#create-a-gist-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /gists/{gist_id}/comments/{comment_id} documentation_url: https://docs.github.com/rest/gists/comments#delete-a-gist-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /gists/{gist_id}/comments/{comment_id} documentation_url: https://docs.github.com/rest/gists/comments#get-a-gist-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /gists/{gist_id}/comments/{comment_id} documentation_url: https://docs.github.com/rest/gists/comments#update-a-gist-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /gists/{gist_id}/commits documentation_url: https://docs.github.com/rest/gists/gists#list-gist-commits openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /gists/{gist_id}/forks documentation_url: https://docs.github.com/rest/gists/gists#list-gist-forks openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /gists/{gist_id}/forks documentation_url: https://docs.github.com/rest/gists/gists#fork-a-gist openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /gists/{gist_id}/star documentation_url: https://docs.github.com/rest/gists/gists#unstar-a-gist openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /gists/{gist_id}/star documentation_url: https://docs.github.com/rest/gists/gists#check-if-a-gist-is-starred openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /gists/{gist_id}/star documentation_url: https://docs.github.com/rest/gists/gists#star-a-gist openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /gists/{gist_id}/{sha} documentation_url: https://docs.github.com/rest/gists/gists#get-a-gist-revision openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /gitignore/templates documentation_url: https://docs.github.com/rest/gitignore/gitignore#get-all-gitignore-templates openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /gitignore/templates/{name} documentation_url: https://docs.github.com/rest/gitignore/gitignore#get-a-gitignore-template openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /installation/repositories documentation_url: https://docs.github.com/rest/apps/installations#list-repositories-accessible-to-the-app-installation openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /installation/token documentation_url: https://docs.github.com/rest/apps/installations#revoke-an-installation-access-token openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /issues documentation_url: https://docs.github.com/rest/issues/issues#list-issues-assigned-to-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /licenses documentation_url: https://docs.github.com/rest/licenses/licenses#get-all-commonly-used-licenses openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /licenses/{license} documentation_url: https://docs.github.com/rest/licenses/licenses#get-a-license openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /manage/v1/config/nodes - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/manage-ghes#get-ghes-node-metadata-for-all-nodes + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/manage-ghes#get-ghes-node-metadata-for-all-nodes openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /manage/v1/maintenance - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/manage-ghes#get-the-status-of-maintenance-mode + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/manage-ghes#get-the-status-of-maintenance-mode openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /manage/v1/maintenance - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/manage-ghes#set-the-status-of-maintenance-mode + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/manage-ghes#set-the-status-of-maintenance-mode openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /manage/v1/replication/status - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/manage-ghes#get-the-status-of-services-running-on-all-replica-nodes + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/manage-ghes#get-the-status-of-services-running-on-all-replica-nodes openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /manage/v1/version - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/manage-ghes#get-all-ghes-release-versions-for-all-nodes + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/manage-ghes#get-all-ghes-release-versions-for-all-nodes openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /markdown documentation_url: https://docs.github.com/rest/markdown/markdown#render-a-markdown-document openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /markdown/raw documentation_url: https://docs.github.com/rest/markdown/markdown#render-a-markdown-document-in-raw-mode openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /marketplace_listing/accounts/{account_id} documentation_url: https://docs.github.com/rest/apps/marketplace#get-a-subscription-plan-for-an-account openapi_files: @@ -991,439 +993,439 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /networks/{owner}/{repo}/events documentation_url: https://docs.github.com/rest/activity/events#list-public-events-for-a-network-of-repositories openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /notifications documentation_url: https://docs.github.com/rest/activity/notifications#list-notifications-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /notifications documentation_url: https://docs.github.com/rest/activity/notifications#mark-notifications-as-read openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /notifications/threads/{thread_id} documentation_url: https://docs.github.com/rest/activity/notifications#get-a-thread openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /notifications/threads/{thread_id} documentation_url: https://docs.github.com/rest/activity/notifications#mark-a-thread-as-read openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /notifications/threads/{thread_id}/subscription documentation_url: https://docs.github.com/rest/activity/notifications#delete-a-thread-subscription openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /notifications/threads/{thread_id}/subscription documentation_url: https://docs.github.com/rest/activity/notifications#get-a-thread-subscription-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /notifications/threads/{thread_id}/subscription documentation_url: https://docs.github.com/rest/activity/notifications#set-a-thread-subscription openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /octocat documentation_url: https://docs.github.com/rest/meta/meta#get-octocat openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /organizations documentation_url: https://docs.github.com/rest/orgs/orgs#list-organizations openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /organizations/{organization_id}/custom_roles documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/orgs/custom-roles#deprecated---list-custom-repository-roles-in-an-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /orgs/{org} documentation_url: https://docs.github.com/rest/orgs/orgs#delete-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org} documentation_url: https://docs.github.com/rest/orgs/orgs#get-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /orgs/{org} documentation_url: https://docs.github.com/rest/orgs/orgs#update-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/actions/cache/usage documentation_url: https://docs.github.com/rest/actions/cache#get-github-actions-cache-usage-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/actions/cache/usage-by-repository documentation_url: https://docs.github.com/rest/actions/cache#list-repositories-with-github-actions-cache-usage-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/actions/oidc/customization/sub documentation_url: https://docs.github.com/rest/actions/oidc#get-the-customization-template-for-an-oidc-subject-claim-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /orgs/{org}/actions/oidc/customization/sub documentation_url: https://docs.github.com/rest/actions/oidc#set-the-customization-template-for-an-oidc-subject-claim-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/actions/permissions documentation_url: https://docs.github.com/rest/actions/permissions#get-github-actions-permissions-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /orgs/{org}/actions/permissions documentation_url: https://docs.github.com/rest/actions/permissions#set-github-actions-permissions-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/actions/permissions/repositories documentation_url: https://docs.github.com/rest/actions/permissions#list-selected-repositories-enabled-for-github-actions-in-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /orgs/{org}/actions/permissions/repositories documentation_url: https://docs.github.com/rest/actions/permissions#set-selected-repositories-enabled-for-github-actions-in-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /orgs/{org}/actions/permissions/repositories/{repository_id} documentation_url: https://docs.github.com/rest/actions/permissions#disable-a-selected-repository-for-github-actions-in-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /orgs/{org}/actions/permissions/repositories/{repository_id} documentation_url: https://docs.github.com/rest/actions/permissions#enable-a-selected-repository-for-github-actions-in-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/actions/permissions/selected-actions documentation_url: https://docs.github.com/rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /orgs/{org}/actions/permissions/selected-actions documentation_url: https://docs.github.com/rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/actions/permissions/workflow documentation_url: https://docs.github.com/rest/actions/permissions#get-default-workflow-permissions-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /orgs/{org}/actions/permissions/workflow documentation_url: https://docs.github.com/rest/actions/permissions#set-default-workflow-permissions-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/actions/runner-groups documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#list-self-hosted-runner-groups-for-an-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /orgs/{org}/actions/runner-groups documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#create-a-self-hosted-runner-group-for-an-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /orgs/{org}/actions/runner-groups/{runner_group_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#delete-a-self-hosted-runner-group-from-an-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/actions/runner-groups/{runner_group_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#get-a-self-hosted-runner-group-for-an-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /orgs/{org}/actions/runner-groups/{runner_group_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#update-a-self-hosted-runner-group-for-an-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#list-repository-access-to-a-self-hosted-runner-group-in-an-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#set-repository-access-for-a-self-hosted-runner-group-in-an-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories/{repository_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#remove-repository-access-to-a-self-hosted-runner-group-in-an-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories/{repository_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#add-repository-access-to-a-self-hosted-runner-group-in-an-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/actions/runner-groups/{runner_group_id}/runners documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#list-self-hosted-runners-in-a-group-for-an-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /orgs/{org}/actions/runner-groups/{runner_group_id}/runners documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#set-self-hosted-runners-in-a-group-for-an-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /orgs/{org}/actions/runner-groups/{runner_group_id}/runners/{runner_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#remove-a-self-hosted-runner-from-a-group-for-an-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /orgs/{org}/actions/runner-groups/{runner_group_id}/runners/{runner_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#add-a-self-hosted-runner-to-a-group-for-an-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/actions/runners documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#list-self-hosted-runners-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/actions/runners/downloads documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#list-runner-applications-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /orgs/{org}/actions/runners/generate-jitconfig documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#create-configuration-for-a-just-in-time-runner-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /orgs/{org}/actions/runners/registration-token documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#create-a-registration-token-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /orgs/{org}/actions/runners/remove-token documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#create-a-remove-token-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /orgs/{org}/actions/runners/{runner_id} documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#delete-a-self-hosted-runner-from-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/actions/runners/{runner_id} documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#get-a-self-hosted-runner-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /orgs/{org}/actions/runners/{runner_id}/labels documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#remove-all-custom-labels-from-a-self-hosted-runner-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/actions/runners/{runner_id}/labels documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#list-labels-for-a-self-hosted-runner-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /orgs/{org}/actions/runners/{runner_id}/labels documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#add-custom-labels-to-a-self-hosted-runner-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /orgs/{org}/actions/runners/{runner_id}/labels documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#set-custom-labels-for-a-self-hosted-runner-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /orgs/{org}/actions/runners/{runner_id}/labels/{name} documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#remove-a-custom-label-from-a-self-hosted-runner-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/actions/secrets documentation_url: https://docs.github.com/rest/actions/secrets#list-organization-secrets openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/actions/secrets/public-key documentation_url: https://docs.github.com/rest/actions/secrets#get-an-organization-public-key openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /orgs/{org}/actions/secrets/{secret_name} documentation_url: https://docs.github.com/rest/actions/secrets#delete-an-organization-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/actions/secrets/{secret_name} documentation_url: https://docs.github.com/rest/actions/secrets#get-an-organization-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /orgs/{org}/actions/secrets/{secret_name} documentation_url: https://docs.github.com/rest/actions/secrets#create-or-update-an-organization-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/actions/secrets/{secret_name}/repositories documentation_url: https://docs.github.com/rest/actions/secrets#list-selected-repositories-for-an-organization-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /orgs/{org}/actions/secrets/{secret_name}/repositories documentation_url: https://docs.github.com/rest/actions/secrets#set-selected-repositories-for-an-organization-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id} documentation_url: https://docs.github.com/rest/actions/secrets#remove-selected-repository-from-an-organization-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id} documentation_url: https://docs.github.com/rest/actions/secrets#add-selected-repository-to-an-organization-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/actions/variables documentation_url: https://docs.github.com/rest/actions/variables#list-organization-variables openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /orgs/{org}/actions/variables documentation_url: https://docs.github.com/rest/actions/variables#create-an-organization-variable openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /orgs/{org}/actions/variables/{name} documentation_url: https://docs.github.com/rest/actions/variables#delete-an-organization-variable openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/actions/variables/{name} documentation_url: https://docs.github.com/rest/actions/variables#get-an-organization-variable openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /orgs/{org}/actions/variables/{name} documentation_url: https://docs.github.com/rest/actions/variables#update-an-organization-variable openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/actions/variables/{name}/repositories documentation_url: https://docs.github.com/rest/actions/variables#list-selected-repositories-for-an-organization-variable openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /orgs/{org}/actions/variables/{name}/repositories documentation_url: https://docs.github.com/rest/actions/variables#set-selected-repositories-for-an-organization-variable openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /orgs/{org}/actions/variables/{name}/repositories/{repository_id} documentation_url: https://docs.github.com/rest/actions/variables#remove-selected-repository-from-an-organization-variable openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /orgs/{org}/actions/variables/{name}/repositories/{repository_id} documentation_url: https://docs.github.com/rest/actions/variables#add-selected-repository-to-an-organization-variable openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /orgs/{org}/announcement documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/announcement-banners/organizations#remove-announcement-banner-from-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/announcement documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/announcement-banners/organizations#get-announcement-banner-for-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /orgs/{org}/announcement documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/announcement-banners/organizations#set-announcement-banner-for-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/audit-log documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/orgs/orgs#get-the-audit-log-for-an-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/blocks documentation_url: https://docs.github.com/rest/orgs/blocking#list-users-blocked-by-an-organization openapi_files: @@ -1449,7 +1451,7 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/codespaces documentation_url: https://docs.github.com/rest/codespaces/organizations#list-codespaces-for-the-organization openapi_files: @@ -1516,32 +1518,32 @@ openapi_operations: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - name: GET /orgs/{org}/copilot/billing - documentation_url: https://docs.github.com/rest/copilot/copilot-for-business#get-copilot-for-business-seat-information-and-settings-for-an-organization + documentation_url: https://docs.github.com/rest/copilot/copilot-business#get-copilot-business-seat-information-and-settings-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - name: GET /orgs/{org}/copilot/billing/seats - documentation_url: https://docs.github.com/rest/copilot/copilot-for-business#list-all-copilot-for-business-seat-assignments-for-an-organization + documentation_url: https://docs.github.com/rest/copilot/copilot-business#list-all-copilot-business-seat-assignments-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - name: DELETE /orgs/{org}/copilot/billing/selected_teams - documentation_url: https://docs.github.com/rest/copilot/copilot-for-business#remove-teams-from-the-copilot-for-business-subscription-for-an-organization + documentation_url: https://docs.github.com/rest/copilot/copilot-business#remove-teams-from-the-copilot-business-subscription-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - name: POST /orgs/{org}/copilot/billing/selected_teams - documentation_url: https://docs.github.com/rest/copilot/copilot-for-business#add-teams-to-the-copilot-for-business-subscription-for-an-organization + documentation_url: https://docs.github.com/rest/copilot/copilot-business#add-teams-to-the-copilot-business-subscription-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - name: DELETE /orgs/{org}/copilot/billing/selected_users - documentation_url: https://docs.github.com/rest/copilot/copilot-for-business#remove-users-from-the-copilot-for-business-subscription-for-an-organization + documentation_url: https://docs.github.com/rest/copilot/copilot-business#remove-users-from-the-copilot-business-subscription-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - name: POST /orgs/{org}/copilot/billing/selected_users - documentation_url: https://docs.github.com/rest/copilot/copilot-for-business#add-users-to-the-copilot-for-business-subscription-for-an-organization + documentation_url: https://docs.github.com/rest/copilot/copilot-business#add-users-to-the-copilot-business-subscription-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json @@ -1557,27 +1559,27 @@ openapi_operations: documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/orgs/custom-roles#list-custom-repository-roles-in-an-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /orgs/{org}/custom-repository-roles documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/orgs/custom-roles#create-a-custom-repository-role openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /orgs/{org}/custom-repository-roles/{role_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/orgs/custom-roles#delete-a-custom-repository-role openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/custom-repository-roles/{role_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/orgs/custom-roles#get-a-custom-repository-role openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /orgs/{org}/custom-repository-roles/{role_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/orgs/custom-roles#update-a-custom-repository-role openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /orgs/{org}/custom_roles documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/orgs/custom-roles#deprecated---create-a-custom-role openapi_files: @@ -1599,83 +1601,83 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/dependabot/secrets documentation_url: https://docs.github.com/rest/dependabot/secrets#list-organization-secrets openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/dependabot/secrets/public-key documentation_url: https://docs.github.com/rest/dependabot/secrets#get-an-organization-public-key openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /orgs/{org}/dependabot/secrets/{secret_name} documentation_url: https://docs.github.com/rest/dependabot/secrets#delete-an-organization-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/dependabot/secrets/{secret_name} documentation_url: https://docs.github.com/rest/dependabot/secrets#get-an-organization-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /orgs/{org}/dependabot/secrets/{secret_name} documentation_url: https://docs.github.com/rest/dependabot/secrets#create-or-update-an-organization-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/dependabot/secrets/{secret_name}/repositories documentation_url: https://docs.github.com/rest/dependabot/secrets#list-selected-repositories-for-an-organization-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /orgs/{org}/dependabot/secrets/{secret_name}/repositories documentation_url: https://docs.github.com/rest/dependabot/secrets#set-selected-repositories-for-an-organization-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /orgs/{org}/dependabot/secrets/{secret_name}/repositories/{repository_id} documentation_url: https://docs.github.com/rest/dependabot/secrets#remove-selected-repository-from-an-organization-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /orgs/{org}/dependabot/secrets/{secret_name}/repositories/{repository_id} documentation_url: https://docs.github.com/rest/dependabot/secrets#add-selected-repository-to-an-organization-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/docker/conflicts documentation_url: https://docs.github.com/rest/packages/packages#get-list-of-conflicting-packages-during-docker-migration-for-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/events documentation_url: https://docs.github.com/rest/activity/events#list-public-organization-events openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/external-group/{group_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/teams/external-groups#get-an-external-group openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/external-groups documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/teams/external-groups#list-external-groups-in-an-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/failed_invitations documentation_url: https://docs.github.com/rest/orgs/members#list-failed-organization-invitations openapi_files: @@ -1690,79 +1692,79 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /orgs/{org}/hooks documentation_url: https://docs.github.com/rest/orgs/webhooks#create-an-organization-webhook openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /orgs/{org}/hooks/{hook_id} documentation_url: https://docs.github.com/rest/orgs/webhooks#delete-an-organization-webhook openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/hooks/{hook_id} documentation_url: https://docs.github.com/rest/orgs/webhooks#get-an-organization-webhook openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /orgs/{org}/hooks/{hook_id} documentation_url: https://docs.github.com/rest/orgs/webhooks#update-an-organization-webhook openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/hooks/{hook_id}/config documentation_url: https://docs.github.com/rest/orgs/webhooks#get-a-webhook-configuration-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /orgs/{org}/hooks/{hook_id}/config documentation_url: https://docs.github.com/rest/orgs/webhooks#update-a-webhook-configuration-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/hooks/{hook_id}/deliveries documentation_url: https://docs.github.com/rest/orgs/webhooks#list-deliveries-for-an-organization-webhook openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/hooks/{hook_id}/deliveries/{delivery_id} documentation_url: https://docs.github.com/rest/orgs/webhooks#get-a-webhook-delivery-for-an-organization-webhook openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /orgs/{org}/hooks/{hook_id}/deliveries/{delivery_id}/attempts documentation_url: https://docs.github.com/rest/orgs/webhooks#redeliver-a-delivery-for-an-organization-webhook openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /orgs/{org}/hooks/{hook_id}/pings documentation_url: https://docs.github.com/rest/orgs/webhooks#ping-an-organization-webhook openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/installation documentation_url: https://docs.github.com/rest/apps/apps#get-an-organization-installation-for-the-authenticated-app openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/installations documentation_url: https://docs.github.com/rest/orgs/orgs#list-app-installations-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /orgs/{org}/interaction-limits documentation_url: https://docs.github.com/rest/interactions/orgs#remove-interaction-restrictions-for-an-organization openapi_files: @@ -1803,25 +1805,25 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/members documentation_url: https://docs.github.com/rest/orgs/members#list-organization-members openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /orgs/{org}/members/{username} documentation_url: https://docs.github.com/rest/orgs/members#remove-an-organization-member openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/members/{username} documentation_url: https://docs.github.com/rest/orgs/members#check-organization-membership-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/members/{username}/codespaces documentation_url: https://docs.github.com/rest/codespaces/organizations#list-codespaces-for-a-user-in-organization openapi_files: @@ -1838,7 +1840,7 @@ openapi_operations: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - name: GET /orgs/{org}/members/{username}/copilot - documentation_url: https://docs.github.com/rest/copilot/copilot-for-business#get-copilot-for-business-seat-assignment-details-for-a-user + documentation_url: https://docs.github.com/rest/copilot/copilot-business#get-copilot-business-seat-assignment-details-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json @@ -1847,235 +1849,305 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/memberships/{username} documentation_url: https://docs.github.com/rest/orgs/members#get-organization-membership-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /orgs/{org}/memberships/{username} documentation_url: https://docs.github.com/rest/orgs/members#set-organization-membership-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/migrations documentation_url: https://docs.github.com/rest/migrations/orgs#list-organization-migrations openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /orgs/{org}/migrations documentation_url: https://docs.github.com/rest/migrations/orgs#start-an-organization-migration openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/migrations/{migration_id} documentation_url: https://docs.github.com/rest/migrations/orgs#get-an-organization-migration-status openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /orgs/{org}/migrations/{migration_id}/archive documentation_url: https://docs.github.com/rest/migrations/orgs#delete-an-organization-migration-archive openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/migrations/{migration_id}/archive documentation_url: https://docs.github.com/rest/migrations/orgs#download-an-organization-migration-archive openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /orgs/{org}/migrations/{migration_id}/repos/{repo_name}/lock documentation_url: https://docs.github.com/rest/migrations/orgs#unlock-an-organization-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/migrations/{migration_id}/repositories documentation_url: https://docs.github.com/rest/migrations/orgs#list-repositories-in-an-organization-migration openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json + - name: GET /orgs/{org}/organization-fine-grained-permissions + documentation_url: https://docs.github.com/rest/orgs/organization-roles#list-organization-fine-grained-permissions-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /orgs/{org}/organization-roles + documentation_url: https://docs.github.com/rest/orgs/organization-roles#get-all-organization-roles-for-an-organization + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: POST /orgs/{org}/organization-roles + documentation_url: https://docs.github.com/rest/orgs/organization-roles#create-a-custom-organization-role + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: DELETE /orgs/{org}/organization-roles/teams/{team_slug} + documentation_url: https://docs.github.com/rest/orgs/organization-roles#remove-all-organization-roles-for-a-team + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: DELETE /orgs/{org}/organization-roles/teams/{team_slug}/{role_id} + documentation_url: https://docs.github.com/rest/orgs/organization-roles#remove-an-organization-role-from-a-team + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: PUT /orgs/{org}/organization-roles/teams/{team_slug}/{role_id} + documentation_url: https://docs.github.com/rest/orgs/organization-roles#assign-an-organization-role-to-a-team + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: DELETE /orgs/{org}/organization-roles/users/{username} + documentation_url: https://docs.github.com/rest/orgs/organization-roles#remove-all-organization-roles-for-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: DELETE /orgs/{org}/organization-roles/users/{username}/{role_id} + documentation_url: https://docs.github.com/rest/orgs/organization-roles#remove-an-organization-role-from-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: PUT /orgs/{org}/organization-roles/users/{username}/{role_id} + documentation_url: https://docs.github.com/rest/orgs/organization-roles#assign-an-organization-role-to-a-user + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: DELETE /orgs/{org}/organization-roles/{role_id} + documentation_url: https://docs.github.com/rest/orgs/organization-roles#delete-a-custom-organization-role + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /orgs/{org}/organization-roles/{role_id} + documentation_url: https://docs.github.com/rest/orgs/organization-roles#get-an-organization-role + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: PATCH /orgs/{org}/organization-roles/{role_id} + documentation_url: https://docs.github.com/rest/orgs/organization-roles#update-a-custom-organization-role + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /orgs/{org}/organization-roles/{role_id}/teams + documentation_url: https://docs.github.com/rest/orgs/organization-roles#list-teams-that-are-assigned-to-an-organization-role + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: GET /orgs/{org}/organization-roles/{role_id}/users + documentation_url: https://docs.github.com/rest/orgs/organization-roles#list-users-that-are-assigned-to-an-organization-role + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json - name: GET /orgs/{org}/outside_collaborators documentation_url: https://docs.github.com/rest/orgs/outside-collaborators#list-outside-collaborators-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /orgs/{org}/outside_collaborators/{username} documentation_url: https://docs.github.com/rest/orgs/outside-collaborators#remove-outside-collaborator-from-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /orgs/{org}/outside_collaborators/{username} documentation_url: https://docs.github.com/rest/orgs/outside-collaborators#convert-an-organization-member-to-outside-collaborator openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/packages documentation_url: https://docs.github.com/rest/packages/packages#list-packages-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /orgs/{org}/packages/{package_type}/{package_name} documentation_url: https://docs.github.com/rest/packages/packages#delete-a-package-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/packages/{package_type}/{package_name} documentation_url: https://docs.github.com/rest/packages/packages#get-a-package-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /orgs/{org}/packages/{package_type}/{package_name}/restore documentation_url: https://docs.github.com/rest/packages/packages#restore-a-package-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/packages/{package_type}/{package_name}/versions documentation_url: https://docs.github.com/rest/packages/packages#list-package-versions-for-a-package-owned-by-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id} documentation_url: https://docs.github.com/rest/packages/packages#delete-package-version-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id} documentation_url: https://docs.github.com/rest/packages/packages#get-a-package-version-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}/restore documentation_url: https://docs.github.com/rest/packages/packages#restore-package-version-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/personal-access-token-requests documentation_url: https://docs.github.com/rest/orgs/personal-access-tokens#list-requests-to-access-organization-resources-with-fine-grained-personal-access-tokens openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /orgs/{org}/personal-access-token-requests documentation_url: https://docs.github.com/rest/orgs/personal-access-tokens#review-requests-to-access-organization-resources-with-fine-grained-personal-access-tokens openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /orgs/{org}/personal-access-token-requests/{pat_request_id} documentation_url: https://docs.github.com/rest/orgs/personal-access-tokens#review-a-request-to-access-organization-resources-with-a-fine-grained-personal-access-token openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/personal-access-token-requests/{pat_request_id}/repositories documentation_url: https://docs.github.com/rest/orgs/personal-access-tokens#list-repositories-requested-to-be-accessed-by-a-fine-grained-personal-access-token openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/personal-access-tokens documentation_url: https://docs.github.com/rest/orgs/personal-access-tokens#list-fine-grained-personal-access-tokens-with-access-to-organization-resources openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /orgs/{org}/personal-access-tokens documentation_url: https://docs.github.com/rest/orgs/personal-access-tokens#update-the-access-to-organization-resources-via-fine-grained-personal-access-tokens openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /orgs/{org}/personal-access-tokens/{pat_id} documentation_url: https://docs.github.com/rest/orgs/personal-access-tokens#update-the-access-a-fine-grained-personal-access-token-has-to-organization-resources openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/personal-access-tokens/{pat_id}/repositories documentation_url: https://docs.github.com/rest/orgs/personal-access-tokens#list-repositories-a-fine-grained-personal-access-token-has-access-to openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/pre-receive-hooks - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/org-pre-receive-hooks#list-pre-receive-hooks-for-an-organization + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/org-pre-receive-hooks#list-pre-receive-hooks-for-an-organization openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /orgs/{org}/pre-receive-hooks/{pre_receive_hook_id} - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/org-pre-receive-hooks#remove-pre-receive-hook-enforcement-for-an-organization + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/org-pre-receive-hooks#remove-pre-receive-hook-enforcement-for-an-organization openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/pre-receive-hooks/{pre_receive_hook_id} - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/org-pre-receive-hooks#get-a-pre-receive-hook-for-an-organization + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/org-pre-receive-hooks#get-a-pre-receive-hook-for-an-organization openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /orgs/{org}/pre-receive-hooks/{pre_receive_hook_id} - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/org-pre-receive-hooks#update-pre-receive-hook-enforcement-for-an-organization + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/org-pre-receive-hooks#update-pre-receive-hook-enforcement-for-an-organization openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/projects documentation_url: https://docs.github.com/rest/projects/projects#list-organization-projects openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /orgs/{org}/projects documentation_url: https://docs.github.com/rest/projects/projects#create-an-organization-project openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/properties/schema - documentation_url: https://docs.github.com/rest/orgs/properties#get-all-custom-properties-for-an-organization + documentation_url: https://docs.github.com/rest/orgs/custom-properties#get-all-custom-properties-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - name: PATCH /orgs/{org}/properties/schema - documentation_url: https://docs.github.com/rest/orgs/properties#create-or-update-custom-properties-for-an-organization + documentation_url: https://docs.github.com/rest/orgs/custom-properties#create-or-update-custom-properties-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - name: DELETE /orgs/{org}/properties/schema/{custom_property_name} - documentation_url: https://docs.github.com/rest/orgs/properties#remove-a-custom-property-for-an-organization + documentation_url: https://docs.github.com/rest/orgs/custom-properties#remove-a-custom-property-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - name: GET /orgs/{org}/properties/schema/{custom_property_name} - documentation_url: https://docs.github.com/rest/orgs/properties#get-a-custom-property-for-an-organization + documentation_url: https://docs.github.com/rest/orgs/custom-properties#get-a-custom-property-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - name: PUT /orgs/{org}/properties/schema/{custom_property_name} - documentation_url: https://docs.github.com/rest/orgs/properties#create-or-update-a-custom-property-for-an-organization + documentation_url: https://docs.github.com/rest/orgs/custom-properties#create-or-update-a-custom-property-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - name: GET /orgs/{org}/properties/values - documentation_url: https://docs.github.com/rest/orgs/properties#list-custom-property-values-for-organization-repositories + documentation_url: https://docs.github.com/rest/orgs/custom-properties#list-custom-property-values-for-organization-repositories openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - name: PATCH /orgs/{org}/properties/values - documentation_url: https://docs.github.com/rest/orgs/properties#create-or-update-custom-property-values-for-organization-repositories + documentation_url: https://docs.github.com/rest/orgs/custom-properties#create-or-update-custom-property-values-for-organization-repositories openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json @@ -2084,52 +2156,54 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /orgs/{org}/public_members/{username} documentation_url: https://docs.github.com/rest/orgs/members#remove-public-organization-membership-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/public_members/{username} documentation_url: https://docs.github.com/rest/orgs/members#check-public-organization-membership-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /orgs/{org}/public_members/{username} documentation_url: https://docs.github.com/rest/orgs/members#set-public-organization-membership-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/repos documentation_url: https://docs.github.com/rest/repos/repos#list-organization-repositories openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /orgs/{org}/repos documentation_url: https://docs.github.com/rest/repos/repos#create-an-organization-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/repository-fine-grained-permissions documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/orgs/custom-roles#list-repository-fine-grained-permissions-for-an-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/rulesets documentation_url: https://docs.github.com/rest/orgs/rules#get-all-organization-repository-rulesets openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /orgs/{org}/rulesets documentation_url: https://docs.github.com/rest/orgs/rules#create-an-organization-repository-ruleset openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/rulesets/rule-suites documentation_url: https://docs.github.com/rest/orgs/rule-suites#list-organization-rule-suites openapi_files: @@ -2145,22 +2219,25 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/rulesets/{ruleset_id} documentation_url: https://docs.github.com/rest/orgs/rules#get-an-organization-repository-ruleset openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /orgs/{org}/rulesets/{ruleset_id} documentation_url: https://docs.github.com/rest/orgs/rules#update-an-organization-repository-ruleset openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/secret-scanning/alerts documentation_url: https://docs.github.com/rest/secret-scanning/secret-scanning#list-secret-scanning-alerts-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/security-advisories documentation_url: https://docs.github.com/rest/security-advisories/repository-advisories#list-repository-security-advisories-for-an-organization openapi_files: @@ -2171,19 +2248,19 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /orgs/{org}/security-managers/teams/{team_slug} documentation_url: https://docs.github.com/rest/orgs/security-managers#remove-a-security-manager-team openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /orgs/{org}/security-managers/teams/{team_slug} documentation_url: https://docs.github.com/rest/orgs/security-managers#add-a-security-manager-team openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/settings/billing/actions documentation_url: https://docs.github.com/rest/billing/billing#get-github-actions-billing-for-an-organization openapi_files: @@ -2193,7 +2270,7 @@ openapi_operations: documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/billing/billing#get-github-advanced-security-active-committers-for-an-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/settings/billing/packages documentation_url: https://docs.github.com/rest/billing/billing#get-github-packages-billing-for-an-organization openapi_files: @@ -2213,142 +2290,142 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /orgs/{org}/teams documentation_url: https://docs.github.com/rest/teams/teams#create-a-team openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /orgs/{org}/teams/{team_slug} documentation_url: https://docs.github.com/rest/teams/teams#delete-a-team openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/teams/{team_slug} documentation_url: https://docs.github.com/rest/teams/teams#get-a-team-by-name openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /orgs/{org}/teams/{team_slug} documentation_url: https://docs.github.com/rest/teams/teams#update-a-team openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/teams/{team_slug}/discussions documentation_url: https://docs.github.com/rest/teams/discussions#list-discussions openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /orgs/{org}/teams/{team_slug}/discussions documentation_url: https://docs.github.com/rest/teams/discussions#create-a-discussion openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number} documentation_url: https://docs.github.com/rest/teams/discussions#delete-a-discussion openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number} documentation_url: https://docs.github.com/rest/teams/discussions#get-a-discussion openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /orgs/{org}/teams/{team_slug}/discussions/{discussion_number} documentation_url: https://docs.github.com/rest/teams/discussions#update-a-discussion openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments documentation_url: https://docs.github.com/rest/teams/discussion-comments#list-discussion-comments openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments documentation_url: https://docs.github.com/rest/teams/discussion-comments#create-a-discussion-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number} documentation_url: https://docs.github.com/rest/teams/discussion-comments#delete-a-discussion-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number} documentation_url: https://docs.github.com/rest/teams/discussion-comments#get-a-discussion-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number} documentation_url: https://docs.github.com/rest/teams/discussion-comments#update-a-discussion-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions documentation_url: https://docs.github.com/rest/reactions/reactions#list-reactions-for-a-team-discussion-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions documentation_url: https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-team-discussion-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions/{reaction_id} documentation_url: https://docs.github.com/rest/reactions/reactions#delete-team-discussion-comment-reaction openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions documentation_url: https://docs.github.com/rest/reactions/reactions#list-reactions-for-a-team-discussion openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions documentation_url: https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-team-discussion openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions/{reaction_id} documentation_url: https://docs.github.com/rest/reactions/reactions#delete-team-discussion-reaction openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /orgs/{org}/teams/{team_slug}/external-groups documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/teams/external-groups#remove-the-connection-between-an-external-group-and-a-team openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/teams/{team_slug}/external-groups documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/teams/external-groups#list-a-connection-between-an-external-group-and-a-team openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /orgs/{org}/teams/{team_slug}/external-groups documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/teams/external-groups#update-the-connection-between-an-external-group-and-a-team openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/teams/{team_slug}/invitations documentation_url: https://docs.github.com/rest/teams/members#list-pending-team-invitations openapi_files: @@ -2359,73 +2436,73 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /orgs/{org}/teams/{team_slug}/memberships/{username} documentation_url: https://docs.github.com/rest/teams/members#remove-team-membership-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/teams/{team_slug}/memberships/{username} documentation_url: https://docs.github.com/rest/teams/members#get-team-membership-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /orgs/{org}/teams/{team_slug}/memberships/{username} documentation_url: https://docs.github.com/rest/teams/members#add-or-update-team-membership-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/teams/{team_slug}/projects documentation_url: https://docs.github.com/rest/teams/teams#list-team-projects openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /orgs/{org}/teams/{team_slug}/projects/{project_id} documentation_url: https://docs.github.com/rest/teams/teams#remove-a-project-from-a-team openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/teams/{team_slug}/projects/{project_id} documentation_url: https://docs.github.com/rest/teams/teams#check-team-permissions-for-a-project openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /orgs/{org}/teams/{team_slug}/projects/{project_id} documentation_url: https://docs.github.com/rest/teams/teams#add-or-update-team-project-permissions openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/teams/{team_slug}/repos documentation_url: https://docs.github.com/rest/teams/teams#list-team-repositories openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} documentation_url: https://docs.github.com/rest/teams/teams#remove-a-repository-from-a-team openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} documentation_url: https://docs.github.com/rest/teams/teams#check-team-permissions-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} documentation_url: https://docs.github.com/rest/teams/teams#add-or-update-team-repository-permissions openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /orgs/{org}/teams/{team_slug}/team-sync/group-mappings documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/teams/team-sync#list-idp-groups-for-a-team openapi_files: @@ -2439,133 +2516,133 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /orgs/{org}/{security_product}/{enablement} documentation_url: https://docs.github.com/rest/orgs/orgs#enable-or-disable-a-security-feature-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /projects/columns/cards/{card_id} documentation_url: https://docs.github.com/rest/projects/cards#delete-a-project-card openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /projects/columns/cards/{card_id} documentation_url: https://docs.github.com/rest/projects/cards#get-a-project-card openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /projects/columns/cards/{card_id} documentation_url: https://docs.github.com/rest/projects/cards#update-an-existing-project-card openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /projects/columns/cards/{card_id}/moves documentation_url: https://docs.github.com/rest/projects/cards#move-a-project-card openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /projects/columns/{column_id} documentation_url: https://docs.github.com/rest/projects/columns#delete-a-project-column openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /projects/columns/{column_id} documentation_url: https://docs.github.com/rest/projects/columns#get-a-project-column openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /projects/columns/{column_id} documentation_url: https://docs.github.com/rest/projects/columns#update-an-existing-project-column openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /projects/columns/{column_id}/cards documentation_url: https://docs.github.com/rest/projects/cards#list-project-cards openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /projects/columns/{column_id}/cards documentation_url: https://docs.github.com/rest/projects/cards#create-a-project-card openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /projects/columns/{column_id}/moves documentation_url: https://docs.github.com/rest/projects/columns#move-a-project-column openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /projects/{project_id} documentation_url: https://docs.github.com/rest/projects/projects#delete-a-project openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /projects/{project_id} documentation_url: https://docs.github.com/rest/projects/projects#get-a-project openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /projects/{project_id} documentation_url: https://docs.github.com/rest/projects/projects#update-a-project openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /projects/{project_id}/collaborators documentation_url: https://docs.github.com/rest/projects/collaborators#list-project-collaborators openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /projects/{project_id}/collaborators/{username} documentation_url: https://docs.github.com/rest/projects/collaborators#remove-user-as-a-collaborator openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /projects/{project_id}/collaborators/{username} documentation_url: https://docs.github.com/rest/projects/collaborators#add-project-collaborator openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /projects/{project_id}/collaborators/{username}/permission documentation_url: https://docs.github.com/rest/projects/collaborators#get-project-permission-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /projects/{project_id}/columns documentation_url: https://docs.github.com/rest/projects/columns#list-project-columns openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /projects/{project_id}/columns documentation_url: https://docs.github.com/rest/projects/columns#create-a-project-column openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /rate_limit documentation_url: https://docs.github.com/rest/rate-limit/rate-limit#get-rate-limit-status-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /reactions/{reaction_id} documentation_url: https://docs.github.com/enterprise-server@3.4/rest/reference/reactions/#delete-a-reaction-legacy openapi_files: @@ -2575,261 +2652,261 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo} documentation_url: https://docs.github.com/rest/repos/repos#get-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /repos/{owner}/{repo} documentation_url: https://docs.github.com/rest/repos/repos#update-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/actions/artifacts documentation_url: https://docs.github.com/rest/actions/artifacts#list-artifacts-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/actions/artifacts/{artifact_id} documentation_url: https://docs.github.com/rest/actions/artifacts#delete-an-artifact openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id} documentation_url: https://docs.github.com/rest/actions/artifacts#get-an-artifact openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}/{archive_format} documentation_url: https://docs.github.com/rest/actions/artifacts#download-an-artifact openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/actions/cache/usage documentation_url: https://docs.github.com/rest/actions/cache#get-github-actions-cache-usage-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/actions/cache/usage-policy - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/actions/cache#get-github-actions-cache-usage-policy-for-a-repository + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/actions/cache#get-github-actions-cache-usage-policy-for-a-repository openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /repos/{owner}/{repo}/actions/cache/usage-policy - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/actions/cache#set-github-actions-cache-usage-policy-for-a-repository + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/actions/cache#set-github-actions-cache-usage-policy-for-a-repository openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/actions/caches documentation_url: https://docs.github.com/rest/actions/cache#delete-github-actions-caches-for-a-repository-using-a-cache-key openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/actions/caches documentation_url: https://docs.github.com/rest/actions/cache#list-github-actions-caches-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/actions/caches/{cache_id} documentation_url: https://docs.github.com/rest/actions/cache#delete-a-github-actions-cache-for-a-repository-using-a-cache-id openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/actions/jobs/{job_id} documentation_url: https://docs.github.com/rest/actions/workflow-jobs#get-a-job-for-a-workflow-run openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/actions/jobs/{job_id}/logs documentation_url: https://docs.github.com/rest/actions/workflow-jobs#download-job-logs-for-a-workflow-run openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/actions/jobs/{job_id}/rerun documentation_url: https://docs.github.com/rest/actions/workflow-runs#re-run-a-job-from-a-workflow-run openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/actions/oidc/customization/sub documentation_url: https://docs.github.com/rest/actions/oidc#get-the-customization-template-for-an-oidc-subject-claim-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /repos/{owner}/{repo}/actions/oidc/customization/sub documentation_url: https://docs.github.com/rest/actions/oidc#set-the-customization-template-for-an-oidc-subject-claim-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/actions/organization-secrets documentation_url: https://docs.github.com/rest/actions/secrets#list-repository-organization-secrets openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/actions/organization-variables documentation_url: https://docs.github.com/rest/actions/variables#list-repository-organization-variables openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/actions/permissions documentation_url: https://docs.github.com/rest/actions/permissions#get-github-actions-permissions-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /repos/{owner}/{repo}/actions/permissions documentation_url: https://docs.github.com/rest/actions/permissions#set-github-actions-permissions-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/actions/permissions/access documentation_url: https://docs.github.com/rest/actions/permissions#get-the-level-of-access-for-workflows-outside-of-the-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /repos/{owner}/{repo}/actions/permissions/access documentation_url: https://docs.github.com/rest/actions/permissions#set-the-level-of-access-for-workflows-outside-of-the-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/actions/permissions/selected-actions documentation_url: https://docs.github.com/rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /repos/{owner}/{repo}/actions/permissions/selected-actions documentation_url: https://docs.github.com/rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/actions/permissions/workflow documentation_url: https://docs.github.com/rest/actions/permissions#get-default-workflow-permissions-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /repos/{owner}/{repo}/actions/permissions/workflow documentation_url: https://docs.github.com/rest/actions/permissions#set-default-workflow-permissions-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/actions/runners documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#list-self-hosted-runners-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/actions/runners/downloads documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#list-runner-applications-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/actions/runners/generate-jitconfig documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#create-configuration-for-a-just-in-time-runner-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/actions/runners/registration-token documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#create-a-registration-token-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/actions/runners/remove-token documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#create-a-remove-token-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/actions/runners/{runner_id} documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#delete-a-self-hosted-runner-from-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/actions/runners/{runner_id} documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#get-a-self-hosted-runner-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/actions/runners/{runner_id}/labels documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#remove-all-custom-labels-from-a-self-hosted-runner-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/actions/runners/{runner_id}/labels documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#list-labels-for-a-self-hosted-runner-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/actions/runners/{runner_id}/labels documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#add-custom-labels-to-a-self-hosted-runner-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /repos/{owner}/{repo}/actions/runners/{runner_id}/labels documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#set-custom-labels-for-a-self-hosted-runner-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/actions/runners/{runner_id}/labels/{name} documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#remove-a-custom-label-from-a-self-hosted-runner-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/actions/runs documentation_url: https://docs.github.com/rest/actions/workflow-runs#list-workflow-runs-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/actions/runs/{run_id} documentation_url: https://docs.github.com/rest/actions/workflow-runs#delete-a-workflow-run openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/actions/runs/{run_id} documentation_url: https://docs.github.com/rest/actions/workflow-runs#get-a-workflow-run openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/actions/runs/{run_id}/approvals documentation_url: https://docs.github.com/rest/actions/workflow-runs#get-the-review-history-for-a-workflow-run openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/actions/runs/{run_id}/approve documentation_url: https://docs.github.com/rest/actions/workflow-runs#approve-a-workflow-run-for-a-fork-pull-request openapi_files: @@ -2840,37 +2917,37 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number} documentation_url: https://docs.github.com/rest/actions/workflow-runs#get-a-workflow-run-attempt openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/jobs documentation_url: https://docs.github.com/rest/actions/workflow-jobs#list-jobs-for-a-workflow-run-attempt openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/logs documentation_url: https://docs.github.com/rest/actions/workflow-runs#download-workflow-run-attempt-logs openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/actions/runs/{run_id}/cancel documentation_url: https://docs.github.com/rest/actions/workflow-runs#cancel-a-workflow-run openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/actions/runs/{run_id}/deployment_protection_rule documentation_url: https://docs.github.com/rest/actions/workflow-runs#review-custom-deployment-protection-rules-for-a-workflow-run openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/actions/runs/{run_id}/force-cancel documentation_url: https://docs.github.com/rest/actions/workflow-runs#force-cancel-a-workflow-run openapi_files: @@ -2881,43 +2958,43 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/actions/runs/{run_id}/logs documentation_url: https://docs.github.com/rest/actions/workflow-runs#delete-workflow-run-logs openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/actions/runs/{run_id}/logs documentation_url: https://docs.github.com/rest/actions/workflow-runs#download-workflow-run-logs openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments documentation_url: https://docs.github.com/rest/actions/workflow-runs#get-pending-deployments-for-a-workflow-run openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments documentation_url: https://docs.github.com/rest/actions/workflow-runs#review-pending-deployments-for-a-workflow-run openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/actions/runs/{run_id}/rerun documentation_url: https://docs.github.com/rest/actions/workflow-runs#re-run-a-workflow openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/actions/runs/{run_id}/rerun-failed-jobs documentation_url: https://docs.github.com/rest/actions/workflow-runs#re-run-failed-jobs-from-a-workflow-run openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/actions/runs/{run_id}/timing documentation_url: https://docs.github.com/rest/actions/workflow-runs#get-workflow-run-usage openapi_files: @@ -2928,97 +3005,97 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/actions/secrets/public-key documentation_url: https://docs.github.com/rest/actions/secrets#get-a-repository-public-key openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/actions/secrets/{secret_name} documentation_url: https://docs.github.com/rest/actions/secrets#delete-a-repository-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/actions/secrets/{secret_name} documentation_url: https://docs.github.com/rest/actions/secrets#get-a-repository-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /repos/{owner}/{repo}/actions/secrets/{secret_name} documentation_url: https://docs.github.com/rest/actions/secrets#create-or-update-a-repository-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/actions/variables documentation_url: https://docs.github.com/rest/actions/variables#list-repository-variables openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/actions/variables documentation_url: https://docs.github.com/rest/actions/variables#create-a-repository-variable openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/actions/variables/{name} documentation_url: https://docs.github.com/rest/actions/variables#delete-a-repository-variable openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/actions/variables/{name} documentation_url: https://docs.github.com/rest/actions/variables#get-a-repository-variable openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /repos/{owner}/{repo}/actions/variables/{name} documentation_url: https://docs.github.com/rest/actions/variables#update-a-repository-variable openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/actions/workflows documentation_url: https://docs.github.com/rest/actions/workflows#list-repository-workflows openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/actions/workflows/{workflow_id} documentation_url: https://docs.github.com/rest/actions/workflows#get-a-workflow openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable documentation_url: https://docs.github.com/rest/actions/workflows#disable-a-workflow openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches documentation_url: https://docs.github.com/rest/actions/workflows#create-a-workflow-dispatch-event openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable documentation_url: https://docs.github.com/rest/actions/workflows#enable-a-workflow openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs documentation_url: https://docs.github.com/rest/actions/workflow-runs#list-workflow-runs-for-a-workflow openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/timing documentation_url: https://docs.github.com/rest/actions/workflows#get-workflow-usage openapi_files: @@ -3029,42 +3106,43 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/assignees documentation_url: https://docs.github.com/rest/issues/assignees#list-assignees openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/assignees/{assignee} documentation_url: https://docs.github.com/rest/issues/assignees#check-if-a-user-can-be-assigned openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/autolinks documentation_url: https://docs.github.com/rest/repos/autolinks#list-all-autolinks-of-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/autolinks documentation_url: https://docs.github.com/rest/repos/autolinks#create-an-autolink-reference-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/autolinks/{autolink_id} documentation_url: https://docs.github.com/rest/repos/autolinks#delete-an-autolink-reference-from-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/autolinks/{autolink_id} documentation_url: https://docs.github.com/rest/repos/autolinks#get-an-autolink-reference-of-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/automated-security-fixes documentation_url: https://docs.github.com/rest/repos/repos#disable-automated-security-fixes openapi_files: @@ -3075,7 +3153,7 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /repos/{owner}/{repo}/automated-security-fixes documentation_url: https://docs.github.com/rest/repos/repos#enable-automated-security-fixes openapi_files: @@ -3086,319 +3164,319 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/branches/{branch} documentation_url: https://docs.github.com/rest/branches/branches#get-a-branch openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/branches/{branch}/protection documentation_url: https://docs.github.com/rest/branches/branch-protection#delete-branch-protection openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/branches/{branch}/protection documentation_url: https://docs.github.com/rest/branches/branch-protection#get-branch-protection openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /repos/{owner}/{repo}/branches/{branch}/protection documentation_url: https://docs.github.com/rest/branches/branch-protection#update-branch-protection openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins documentation_url: https://docs.github.com/rest/branches/branch-protection#delete-admin-branch-protection openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins documentation_url: https://docs.github.com/rest/branches/branch-protection#get-admin-branch-protection openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins documentation_url: https://docs.github.com/rest/branches/branch-protection#set-admin-branch-protection openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews documentation_url: https://docs.github.com/rest/branches/branch-protection#delete-pull-request-review-protection openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews documentation_url: https://docs.github.com/rest/branches/branch-protection#get-pull-request-review-protection openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews documentation_url: https://docs.github.com/rest/branches/branch-protection#update-pull-request-review-protection openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures documentation_url: https://docs.github.com/rest/branches/branch-protection#delete-commit-signature-protection openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures documentation_url: https://docs.github.com/rest/branches/branch-protection#get-commit-signature-protection openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures documentation_url: https://docs.github.com/rest/branches/branch-protection#create-commit-signature-protection openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks documentation_url: https://docs.github.com/rest/branches/branch-protection#remove-status-check-protection openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks documentation_url: https://docs.github.com/rest/branches/branch-protection#get-status-checks-protection openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks documentation_url: https://docs.github.com/rest/branches/branch-protection#update-status-check-protection openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts documentation_url: https://docs.github.com/rest/branches/branch-protection#remove-status-check-contexts openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts documentation_url: https://docs.github.com/rest/branches/branch-protection#get-all-status-check-contexts openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts documentation_url: https://docs.github.com/rest/branches/branch-protection#add-status-check-contexts openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts documentation_url: https://docs.github.com/rest/branches/branch-protection#set-status-check-contexts openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions documentation_url: https://docs.github.com/rest/branches/branch-protection#delete-access-restrictions openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions documentation_url: https://docs.github.com/rest/branches/branch-protection#get-access-restrictions openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps documentation_url: https://docs.github.com/rest/branches/branch-protection#remove-app-access-restrictions openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps documentation_url: https://docs.github.com/rest/branches/branch-protection#get-apps-with-access-to-the-protected-branch openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps documentation_url: https://docs.github.com/rest/branches/branch-protection#add-app-access-restrictions openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps documentation_url: https://docs.github.com/rest/branches/branch-protection#set-app-access-restrictions openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams documentation_url: https://docs.github.com/rest/branches/branch-protection#remove-team-access-restrictions openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams documentation_url: https://docs.github.com/rest/branches/branch-protection#get-teams-with-access-to-the-protected-branch openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams documentation_url: https://docs.github.com/rest/branches/branch-protection#add-team-access-restrictions openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams documentation_url: https://docs.github.com/rest/branches/branch-protection#set-team-access-restrictions openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users documentation_url: https://docs.github.com/rest/branches/branch-protection#remove-user-access-restrictions openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users documentation_url: https://docs.github.com/rest/branches/branch-protection#get-users-with-access-to-the-protected-branch openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users documentation_url: https://docs.github.com/rest/branches/branch-protection#add-user-access-restrictions openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users documentation_url: https://docs.github.com/rest/branches/branch-protection#set-user-access-restrictions openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/branches/{branch}/rename documentation_url: https://docs.github.com/rest/branches/branches#rename-a-branch openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/check-runs documentation_url: https://docs.github.com/rest/checks/runs#create-a-check-run openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/check-runs/{check_run_id} documentation_url: https://docs.github.com/rest/checks/runs#get-a-check-run openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /repos/{owner}/{repo}/check-runs/{check_run_id} documentation_url: https://docs.github.com/rest/checks/runs#update-a-check-run openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/check-runs/{check_run_id}/annotations documentation_url: https://docs.github.com/rest/checks/runs#list-check-run-annotations openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/check-runs/{check_run_id}/rerequest documentation_url: https://docs.github.com/rest/checks/runs#rerequest-a-check-run openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/check-suites documentation_url: https://docs.github.com/rest/checks/suites#create-a-check-suite openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /repos/{owner}/{repo}/check-suites/preferences documentation_url: https://docs.github.com/rest/checks/suites#update-repository-preferences-for-check-suites openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/check-suites/{check_suite_id} documentation_url: https://docs.github.com/rest/checks/suites#get-a-check-suite openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/check-suites/{check_suite_id}/check-runs documentation_url: https://docs.github.com/rest/checks/runs#list-check-runs-in-a-check-suite openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/check-suites/{check_suite_id}/rerequest documentation_url: https://docs.github.com/rest/checks/suites#rerequest-a-check-suite openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/code-scanning/alerts documentation_url: https://docs.github.com/rest/code-scanning/code-scanning#list-code-scanning-alerts-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number} documentation_url: https://docs.github.com/rest/code-scanning/code-scanning#get-a-code-scanning-alert openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /repos/{owner}/{repo}/code-scanning/alerts/{alert_number} documentation_url: https://docs.github.com/rest/code-scanning/code-scanning#update-a-code-scanning-alert openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances documentation_url: https://docs.github.com/rest/code-scanning/code-scanning#list-instances-of-a-code-scanning-alert openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/code-scanning/analyses documentation_url: https://docs.github.com/rest/code-scanning/code-scanning#list-code-scanning-analyses-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/code-scanning/analyses/{analysis_id} documentation_url: https://docs.github.com/rest/code-scanning/code-scanning#delete-a-code-scanning-analysis-from-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/code-scanning/analyses/{analysis_id} documentation_url: https://docs.github.com/rest/code-scanning/code-scanning#get-a-code-scanning-analysis-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/code-scanning/codeql/databases documentation_url: https://docs.github.com/rest/code-scanning/code-scanning#list-codeql-databases-for-a-repository openapi_files: @@ -3414,31 +3492,31 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /repos/{owner}/{repo}/code-scanning/default-setup documentation_url: https://docs.github.com/rest/code-scanning/code-scanning#update-a-code-scanning-default-setup-configuration openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/code-scanning/sarifs documentation_url: https://docs.github.com/rest/code-scanning/code-scanning#upload-an-analysis-as-sarif-data openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/code-scanning/sarifs/{sarif_id} documentation_url: https://docs.github.com/rest/code-scanning/code-scanning#get-information-about-a-sarif-upload openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/codeowners/errors documentation_url: https://docs.github.com/rest/repos/repos#list-codeowners-errors openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/codespaces documentation_url: https://docs.github.com/rest/codespaces/codespaces#list-codespaces-in-a-repository-for-the-authenticated-user openapi_files: @@ -3499,133 +3577,133 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/collaborators/{username} documentation_url: https://docs.github.com/rest/collaborators/collaborators#remove-a-repository-collaborator openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/collaborators/{username} documentation_url: https://docs.github.com/rest/collaborators/collaborators#check-if-a-user-is-a-repository-collaborator openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /repos/{owner}/{repo}/collaborators/{username} documentation_url: https://docs.github.com/rest/collaborators/collaborators#add-a-repository-collaborator openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/collaborators/{username}/permission documentation_url: https://docs.github.com/rest/collaborators/collaborators#get-repository-permissions-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/comments documentation_url: https://docs.github.com/rest/commits/comments#list-commit-comments-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/comments/{comment_id} documentation_url: https://docs.github.com/rest/commits/comments#delete-a-commit-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/comments/{comment_id} documentation_url: https://docs.github.com/rest/commits/comments#get-a-commit-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /repos/{owner}/{repo}/comments/{comment_id} documentation_url: https://docs.github.com/rest/commits/comments#update-a-commit-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/comments/{comment_id}/reactions documentation_url: https://docs.github.com/rest/reactions/reactions#list-reactions-for-a-commit-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/comments/{comment_id}/reactions documentation_url: https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-commit-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/comments/{comment_id}/reactions/{reaction_id} documentation_url: https://docs.github.com/rest/reactions/reactions#delete-a-commit-comment-reaction openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/commits documentation_url: https://docs.github.com/rest/commits/commits#list-commits openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/commits/{commit_sha}/branches-where-head documentation_url: https://docs.github.com/rest/commits/commits#list-branches-for-head-commit openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/commits/{commit_sha}/comments documentation_url: https://docs.github.com/rest/commits/comments#list-commit-comments openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/commits/{commit_sha}/comments documentation_url: https://docs.github.com/rest/commits/comments#create-a-commit-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls documentation_url: https://docs.github.com/rest/commits/commits#list-pull-requests-associated-with-a-commit openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/commits/{ref} documentation_url: https://docs.github.com/rest/commits/commits#get-a-commit openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/commits/{ref}/check-runs documentation_url: https://docs.github.com/rest/checks/runs#list-check-runs-for-a-git-reference openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/commits/{ref}/check-suites documentation_url: https://docs.github.com/rest/checks/suites#list-check-suites-for-a-git-reference openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/commits/{ref}/status documentation_url: https://docs.github.com/rest/commits/statuses#get-the-combined-status-for-a-specific-reference openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/commits/{ref}/statuses documentation_url: https://docs.github.com/rest/commits/statuses#list-commit-statuses-for-a-reference openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/community/profile documentation_url: https://docs.github.com/rest/metrics/community#get-community-profile-metrics openapi_files: @@ -3636,7 +3714,7 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/content_references/{content_reference_id}/attachments documentation_url: https://docs.github.com/enterprise-server@3.3/rest/reference/apps#create-a-content-attachment openapi_files: @@ -3646,391 +3724,391 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/contents/{path} documentation_url: https://docs.github.com/rest/repos/contents#get-repository-content openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /repos/{owner}/{repo}/contents/{path} documentation_url: https://docs.github.com/rest/repos/contents#create-or-update-file-contents openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/contributors documentation_url: https://docs.github.com/rest/repos/repos#list-repository-contributors openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/dependabot/alerts documentation_url: https://docs.github.com/rest/dependabot/alerts#list-dependabot-alerts-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/dependabot/alerts/{alert_number} documentation_url: https://docs.github.com/rest/dependabot/alerts#get-a-dependabot-alert openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /repos/{owner}/{repo}/dependabot/alerts/{alert_number} documentation_url: https://docs.github.com/rest/dependabot/alerts#update-a-dependabot-alert openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/dependabot/secrets documentation_url: https://docs.github.com/rest/dependabot/secrets#list-repository-secrets openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/dependabot/secrets/public-key documentation_url: https://docs.github.com/rest/dependabot/secrets#get-a-repository-public-key openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/dependabot/secrets/{secret_name} documentation_url: https://docs.github.com/rest/dependabot/secrets#delete-a-repository-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/dependabot/secrets/{secret_name} documentation_url: https://docs.github.com/rest/dependabot/secrets#get-a-repository-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /repos/{owner}/{repo}/dependabot/secrets/{secret_name} documentation_url: https://docs.github.com/rest/dependabot/secrets#create-or-update-a-repository-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/dependency-graph/compare/{basehead} documentation_url: https://docs.github.com/rest/dependency-graph/dependency-review#get-a-diff-of-the-dependencies-between-commits openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/dependency-graph/sbom documentation_url: https://docs.github.com/rest/dependency-graph/sboms#export-a-software-bill-of-materials-sbom-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/dependency-graph/snapshots documentation_url: https://docs.github.com/rest/dependency-graph/dependency-submission#create-a-snapshot-of-dependencies-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/deployments documentation_url: https://docs.github.com/rest/deployments/deployments#list-deployments openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/deployments documentation_url: https://docs.github.com/rest/deployments/deployments#create-a-deployment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/deployments/{deployment_id} documentation_url: https://docs.github.com/rest/deployments/deployments#delete-a-deployment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/deployments/{deployment_id} documentation_url: https://docs.github.com/rest/deployments/deployments#get-a-deployment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses documentation_url: https://docs.github.com/rest/deployments/statuses#list-deployment-statuses openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/deployments/{deployment_id}/statuses documentation_url: https://docs.github.com/rest/deployments/statuses#create-a-deployment-status openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses/{status_id} documentation_url: https://docs.github.com/rest/deployments/statuses#get-a-deployment-status openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/dispatches documentation_url: https://docs.github.com/rest/repos/repos#create-a-repository-dispatch-event openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/environments documentation_url: https://docs.github.com/rest/deployments/environments#list-environments openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/environments/{environment_name} documentation_url: https://docs.github.com/rest/deployments/environments#delete-an-environment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/environments/{environment_name} documentation_url: https://docs.github.com/rest/deployments/environments#get-an-environment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /repos/{owner}/{repo}/environments/{environment_name} documentation_url: https://docs.github.com/rest/deployments/environments#create-or-update-an-environment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies documentation_url: https://docs.github.com/rest/deployments/branch-policies#list-deployment-branch-policies openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies documentation_url: https://docs.github.com/rest/deployments/branch-policies#create-a-deployment-branch-policy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id} documentation_url: https://docs.github.com/rest/deployments/branch-policies#delete-a-deployment-branch-policy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id} documentation_url: https://docs.github.com/rest/deployments/branch-policies#get-a-deployment-branch-policy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id} documentation_url: https://docs.github.com/rest/deployments/branch-policies#update-a-deployment-branch-policy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules documentation_url: https://docs.github.com/rest/deployments/protection-rules#get-all-deployment-protection-rules-for-an-environment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules documentation_url: https://docs.github.com/rest/deployments/protection-rules#create-a-custom-deployment-protection-rule-on-an-environment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/apps documentation_url: https://docs.github.com/rest/deployments/protection-rules#list-custom-deployment-rule-integrations-available-for-an-environment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/{protection_rule_id} documentation_url: https://docs.github.com/rest/deployments/protection-rules#disable-a-custom-protection-rule-for-an-environment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/{protection_rule_id} documentation_url: https://docs.github.com/rest/deployments/protection-rules#get-a-custom-deployment-protection-rule openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/events documentation_url: https://docs.github.com/rest/activity/events#list-repository-events openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/forks documentation_url: https://docs.github.com/rest/repos/forks#list-forks openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/forks documentation_url: https://docs.github.com/rest/repos/forks#create-a-fork openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/git/blobs documentation_url: https://docs.github.com/rest/git/blobs#create-a-blob openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/git/blobs/{file_sha} documentation_url: https://docs.github.com/rest/git/blobs#get-a-blob openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/git/commits documentation_url: https://docs.github.com/rest/git/commits#create-a-commit openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/git/commits/{commit_sha} documentation_url: https://docs.github.com/rest/git/commits#get-a-commit-object openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/git/matching-refs/{ref} documentation_url: https://docs.github.com/rest/git/refs#list-matching-references openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/git/ref/{ref} documentation_url: https://docs.github.com/rest/git/refs#get-a-reference openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/git/refs documentation_url: https://docs.github.com/rest/git/refs#create-a-reference openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/git/refs/{ref} documentation_url: https://docs.github.com/rest/git/refs#delete-a-reference openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /repos/{owner}/{repo}/git/refs/{ref} documentation_url: https://docs.github.com/rest/git/refs#update-a-reference openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/git/tags documentation_url: https://docs.github.com/rest/git/tags#create-a-tag-object openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/git/tags/{tag_sha} documentation_url: https://docs.github.com/rest/git/tags#get-a-tag openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/git/trees documentation_url: https://docs.github.com/rest/git/trees#create-a-tree openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/git/trees/{tree_sha} documentation_url: https://docs.github.com/rest/git/trees#get-a-tree openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/hooks - documentation_url: https://docs.github.com/rest/webhooks/repos#list-repository-webhooks + documentation_url: https://docs.github.com/rest/repos/webhooks#list-repository-webhooks openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/hooks - documentation_url: https://docs.github.com/rest/webhooks/repos#create-a-repository-webhook + documentation_url: https://docs.github.com/rest/repos/webhooks#create-a-repository-webhook openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/hooks/{hook_id} - documentation_url: https://docs.github.com/rest/webhooks/repos#delete-a-repository-webhook + documentation_url: https://docs.github.com/rest/repos/webhooks#delete-a-repository-webhook openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/hooks/{hook_id} - documentation_url: https://docs.github.com/rest/webhooks/repos#get-a-repository-webhook + documentation_url: https://docs.github.com/rest/repos/webhooks#get-a-repository-webhook openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /repos/{owner}/{repo}/hooks/{hook_id} - documentation_url: https://docs.github.com/rest/webhooks/repos#update-a-repository-webhook + documentation_url: https://docs.github.com/rest/repos/webhooks#update-a-repository-webhook openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/hooks/{hook_id}/config - documentation_url: https://docs.github.com/rest/webhooks/repo-config#get-a-webhook-configuration-for-a-repository + documentation_url: https://docs.github.com/rest/repos/webhooks#get-a-webhook-configuration-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /repos/{owner}/{repo}/hooks/{hook_id}/config - documentation_url: https://docs.github.com/rest/webhooks/repo-config#update-a-webhook-configuration-for-a-repository + documentation_url: https://docs.github.com/rest/repos/webhooks#update-a-webhook-configuration-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries - documentation_url: https://docs.github.com/rest/webhooks/repo-deliveries#list-deliveries-for-a-repository-webhook + documentation_url: https://docs.github.com/rest/repos/webhooks#list-deliveries-for-a-repository-webhook openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries/{delivery_id} - documentation_url: https://docs.github.com/rest/webhooks/repo-deliveries#get-a-delivery-for-a-repository-webhook + documentation_url: https://docs.github.com/rest/repos/webhooks#get-a-delivery-for-a-repository-webhook openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/hooks/{hook_id}/deliveries/{delivery_id}/attempts - documentation_url: https://docs.github.com/rest/webhooks/repo-deliveries#redeliver-a-delivery-for-a-repository-webhook + documentation_url: https://docs.github.com/rest/repos/webhooks#redeliver-a-delivery-for-a-repository-webhook openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/hooks/{hook_id}/pings - documentation_url: https://docs.github.com/rest/webhooks/repos#ping-a-repository-webhook + documentation_url: https://docs.github.com/rest/repos/webhooks#ping-a-repository-webhook openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/hooks/{hook_id}/tests - documentation_url: https://docs.github.com/rest/webhooks/repos#test-the-push-repository-webhook + documentation_url: https://docs.github.com/rest/repos/webhooks#test-the-push-repository-webhook openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/import documentation_url: https://docs.github.com/rest/migrations/source-imports#cancel-an-import openapi_files: @@ -4076,7 +4154,7 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/interaction-limits documentation_url: https://docs.github.com/rest/interactions/repos#remove-interaction-restrictions-for-a-repository openapi_files: @@ -4097,410 +4175,410 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/invitations/{invitation_id} documentation_url: https://docs.github.com/rest/collaborators/invitations#delete-a-repository-invitation openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /repos/{owner}/{repo}/invitations/{invitation_id} documentation_url: https://docs.github.com/rest/collaborators/invitations#update-a-repository-invitation openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/issues documentation_url: https://docs.github.com/rest/issues/issues#list-repository-issues openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/issues documentation_url: https://docs.github.com/rest/issues/issues#create-an-issue openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/issues/comments documentation_url: https://docs.github.com/rest/issues/comments#list-issue-comments-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/issues/comments/{comment_id} documentation_url: https://docs.github.com/rest/issues/comments#delete-an-issue-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/issues/comments/{comment_id} documentation_url: https://docs.github.com/rest/issues/comments#get-an-issue-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /repos/{owner}/{repo}/issues/comments/{comment_id} documentation_url: https://docs.github.com/rest/issues/comments#update-an-issue-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions documentation_url: https://docs.github.com/rest/reactions/reactions#list-reactions-for-an-issue-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions documentation_url: https://docs.github.com/rest/reactions/reactions#create-reaction-for-an-issue-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions/{reaction_id} documentation_url: https://docs.github.com/rest/reactions/reactions#delete-an-issue-comment-reaction openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/issues/events documentation_url: https://docs.github.com/rest/issues/events#list-issue-events-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/issues/events/{event_id} documentation_url: https://docs.github.com/rest/issues/events#get-an-issue-event openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/issues/{issue_number} documentation_url: https://docs.github.com/rest/issues/issues#get-an-issue openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /repos/{owner}/{repo}/issues/{issue_number} documentation_url: https://docs.github.com/rest/issues/issues#update-an-issue openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/issues/{issue_number}/assignees documentation_url: https://docs.github.com/rest/issues/assignees#remove-assignees-from-an-issue openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/issues/{issue_number}/assignees documentation_url: https://docs.github.com/rest/issues/assignees#add-assignees-to-an-issue openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/issues/{issue_number}/assignees/{assignee} documentation_url: https://docs.github.com/rest/issues/assignees#check-if-a-user-can-be-assigned-to-a-issue openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/issues/{issue_number}/comments documentation_url: https://docs.github.com/rest/issues/comments#list-issue-comments openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/issues/{issue_number}/comments documentation_url: https://docs.github.com/rest/issues/comments#create-an-issue-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/issues/{issue_number}/events documentation_url: https://docs.github.com/rest/issues/events#list-issue-events openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels documentation_url: https://docs.github.com/rest/issues/labels#remove-all-labels-from-an-issue openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/issues/{issue_number}/labels documentation_url: https://docs.github.com/rest/issues/labels#list-labels-for-an-issue openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/issues/{issue_number}/labels documentation_url: https://docs.github.com/rest/issues/labels#add-labels-to-an-issue openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /repos/{owner}/{repo}/issues/{issue_number}/labels documentation_url: https://docs.github.com/rest/issues/labels#set-labels-for-an-issue openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels/{name} documentation_url: https://docs.github.com/rest/issues/labels#remove-a-label-from-an-issue openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/issues/{issue_number}/lock documentation_url: https://docs.github.com/rest/issues/issues#unlock-an-issue openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /repos/{owner}/{repo}/issues/{issue_number}/lock documentation_url: https://docs.github.com/rest/issues/issues#lock-an-issue openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/issues/{issue_number}/reactions documentation_url: https://docs.github.com/rest/reactions/reactions#list-reactions-for-an-issue openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/issues/{issue_number}/reactions documentation_url: https://docs.github.com/rest/reactions/reactions#create-reaction-for-an-issue openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/issues/{issue_number}/reactions/{reaction_id} documentation_url: https://docs.github.com/rest/reactions/reactions#delete-an-issue-reaction openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/issues/{issue_number}/timeline documentation_url: https://docs.github.com/rest/issues/timeline#list-timeline-events-for-an-issue openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/keys documentation_url: https://docs.github.com/rest/deploy-keys/deploy-keys#list-deploy-keys openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/keys documentation_url: https://docs.github.com/rest/deploy-keys/deploy-keys#create-a-deploy-key openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/keys/{key_id} documentation_url: https://docs.github.com/rest/deploy-keys/deploy-keys#delete-a-deploy-key openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/keys/{key_id} documentation_url: https://docs.github.com/rest/deploy-keys/deploy-keys#get-a-deploy-key openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/labels documentation_url: https://docs.github.com/rest/issues/labels#list-labels-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/labels documentation_url: https://docs.github.com/rest/issues/labels#create-a-label openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/labels/{name} documentation_url: https://docs.github.com/rest/issues/labels#delete-a-label openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/labels/{name} documentation_url: https://docs.github.com/rest/issues/labels#get-a-label openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /repos/{owner}/{repo}/labels/{name} documentation_url: https://docs.github.com/rest/issues/labels#update-a-label openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/languages documentation_url: https://docs.github.com/rest/repos/repos#list-repository-languages openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/lfs documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/repos/lfs#disable-git-lfs-for-a-repository openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /repos/{owner}/{repo}/lfs documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/repos/lfs#enable-git-lfs-for-a-repository openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/license documentation_url: https://docs.github.com/rest/licenses/licenses#get-the-license-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/merge-upstream documentation_url: https://docs.github.com/rest/branches/branches#sync-a-fork-branch-with-the-upstream-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/merges documentation_url: https://docs.github.com/rest/branches/branches#merge-a-branch openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/milestones documentation_url: https://docs.github.com/rest/issues/milestones#list-milestones openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/milestones documentation_url: https://docs.github.com/rest/issues/milestones#create-a-milestone openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/milestones/{milestone_number} documentation_url: https://docs.github.com/rest/issues/milestones#delete-a-milestone openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/milestones/{milestone_number} documentation_url: https://docs.github.com/rest/issues/milestones#get-a-milestone openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /repos/{owner}/{repo}/milestones/{milestone_number} documentation_url: https://docs.github.com/rest/issues/milestones#update-a-milestone openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/milestones/{milestone_number}/labels documentation_url: https://docs.github.com/rest/issues/labels#list-labels-for-issues-in-a-milestone openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/notifications documentation_url: https://docs.github.com/rest/activity/notifications#list-repository-notifications-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /repos/{owner}/{repo}/notifications documentation_url: https://docs.github.com/rest/activity/notifications#mark-repository-notifications-as-read openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/pages documentation_url: https://docs.github.com/rest/pages/pages#delete-a-apiname-pages-site openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/pages documentation_url: https://docs.github.com/rest/pages/pages#get-a-apiname-pages-site openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/pages documentation_url: https://docs.github.com/rest/pages/pages#create-a-apiname-pages-site openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /repos/{owner}/{repo}/pages documentation_url: https://docs.github.com/rest/pages/pages#update-information-about-a-apiname-pages-site openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/pages/builds documentation_url: https://docs.github.com/rest/pages/pages#list-apiname-pages-builds openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/pages/builds documentation_url: https://docs.github.com/rest/pages/pages#request-a-apiname-pages-build openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/pages/builds/latest documentation_url: https://docs.github.com/rest/pages/pages#get-latest-pages-build openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/pages/builds/{build_id} documentation_url: https://docs.github.com/rest/pages/pages#get-apiname-pages-build openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/pages/deployment documentation_url: https://docs.github.com/rest/pages/pages#create-a-github-pages-deployment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/pages/health documentation_url: https://docs.github.com/rest/pages/pages#get-a-dns-health-check-for-github-pages openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - name: GET /repos/{owner}/{repo}/pre-receive-hooks - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/repo-pre-receive-hooks#list-pre-receive-hooks-for-a-repository + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/repo-pre-receive-hooks#list-pre-receive-hooks-for-a-repository openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/pre-receive-hooks/{pre_receive_hook_id} - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/repo-pre-receive-hooks#remove-pre-receive-hook-enforcement-for-a-repository + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/repo-pre-receive-hooks#remove-pre-receive-hook-enforcement-for-a-repository openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/pre-receive-hooks/{pre_receive_hook_id} - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/repo-pre-receive-hooks#get-a-pre-receive-hook-for-a-repository + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/repo-pre-receive-hooks#get-a-pre-receive-hook-for-a-repository openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /repos/{owner}/{repo}/pre-receive-hooks/{pre_receive_hook_id} - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/repo-pre-receive-hooks#update-pre-receive-hook-enforcement-for-a-repository + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/repo-pre-receive-hooks#update-pre-receive-hook-enforcement-for-a-repository openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/private-vulnerability-reporting documentation_url: https://docs.github.com/rest/repos/repos#disable-private-vulnerability-reporting-for-a-repository openapi_files: @@ -4516,15 +4594,15 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/projects documentation_url: https://docs.github.com/rest/projects/projects#create-a-repository-project openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/properties/values - documentation_url: https://docs.github.com/rest/repos/properties#get-all-custom-property-values-for-a-repository + documentation_url: https://docs.github.com/rest/repos/custom-properties#get-all-custom-property-values-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json @@ -4533,67 +4611,67 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/pulls documentation_url: https://docs.github.com/rest/pulls/pulls#create-a-pull-request openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/pulls/comments documentation_url: https://docs.github.com/rest/pulls/comments#list-review-comments-in-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id} documentation_url: https://docs.github.com/rest/pulls/comments#delete-a-review-comment-for-a-pull-request openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/pulls/comments/{comment_id} documentation_url: https://docs.github.com/rest/pulls/comments#get-a-review-comment-for-a-pull-request openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /repos/{owner}/{repo}/pulls/comments/{comment_id} documentation_url: https://docs.github.com/rest/pulls/comments#update-a-review-comment-for-a-pull-request openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions documentation_url: https://docs.github.com/rest/reactions/reactions#list-reactions-for-a-pull-request-review-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions documentation_url: https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-pull-request-review-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions/{reaction_id} documentation_url: https://docs.github.com/rest/reactions/reactions#delete-a-pull-request-comment-reaction openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/pulls/{pull_number} documentation_url: https://docs.github.com/rest/pulls/pulls#get-a-pull-request openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /repos/{owner}/{repo}/pulls/{pull_number} documentation_url: https://docs.github.com/rest/pulls/pulls#update-a-pull-request openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/pulls/{pull_number}/codespaces documentation_url: https://docs.github.com/rest/codespaces/codespaces#create-a-codespace-from-a-pull-request openapi_files: @@ -4604,242 +4682,245 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/pulls/{pull_number}/comments documentation_url: https://docs.github.com/rest/pulls/comments#create-a-review-comment-for-a-pull-request openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/replies documentation_url: https://docs.github.com/rest/pulls/comments#create-a-reply-for-a-review-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/pulls/{pull_number}/commits documentation_url: https://docs.github.com/rest/pulls/pulls#list-commits-on-a-pull-request openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/pulls/{pull_number}/files documentation_url: https://docs.github.com/rest/pulls/pulls#list-pull-requests-files openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/pulls/{pull_number}/merge documentation_url: https://docs.github.com/rest/pulls/pulls#check-if-a-pull-request-has-been-merged openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge documentation_url: https://docs.github.com/rest/pulls/pulls#merge-a-pull-request openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers documentation_url: https://docs.github.com/rest/pulls/review-requests#remove-requested-reviewers-from-a-pull-request openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers documentation_url: https://docs.github.com/rest/pulls/review-requests#get-all-requested-reviewers-for-a-pull-request openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers documentation_url: https://docs.github.com/rest/pulls/review-requests#request-reviewers-for-a-pull-request openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews documentation_url: https://docs.github.com/rest/pulls/reviews#list-reviews-for-a-pull-request openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews documentation_url: https://docs.github.com/rest/pulls/reviews#create-a-review-for-a-pull-request openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id} documentation_url: https://docs.github.com/rest/pulls/reviews#delete-a-pending-review-for-a-pull-request openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id} documentation_url: https://docs.github.com/rest/pulls/reviews#get-a-review-for-a-pull-request openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id} documentation_url: https://docs.github.com/rest/pulls/reviews#update-a-review-for-a-pull-request openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/comments documentation_url: https://docs.github.com/rest/pulls/reviews#list-comments-for-a-pull-request-review openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/dismissals documentation_url: https://docs.github.com/rest/pulls/reviews#dismiss-a-review-for-a-pull-request openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/events documentation_url: https://docs.github.com/rest/pulls/reviews#submit-a-review-for-a-pull-request openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /repos/{owner}/{repo}/pulls/{pull_number}/update-branch documentation_url: https://docs.github.com/rest/pulls/pulls#update-a-pull-request-branch openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/readme documentation_url: https://docs.github.com/rest/repos/contents#get-a-repository-readme openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/readme/{dir} documentation_url: https://docs.github.com/rest/repos/contents#get-a-repository-readme-for-a-directory openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/releases documentation_url: https://docs.github.com/rest/releases/releases#list-releases openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/releases documentation_url: https://docs.github.com/rest/releases/releases#create-a-release openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/releases/assets/{asset_id} documentation_url: https://docs.github.com/rest/releases/assets#delete-a-release-asset openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/releases/assets/{asset_id} documentation_url: https://docs.github.com/rest/releases/assets#get-a-release-asset openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /repos/{owner}/{repo}/releases/assets/{asset_id} documentation_url: https://docs.github.com/rest/releases/assets#update-a-release-asset openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/releases/generate-notes documentation_url: https://docs.github.com/rest/releases/releases#generate-release-notes-content-for-a-release openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/releases/latest documentation_url: https://docs.github.com/rest/releases/releases#get-the-latest-release openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/releases/tags/{tag} documentation_url: https://docs.github.com/rest/releases/releases#get-a-release-by-tag-name openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/releases/{release_id} documentation_url: https://docs.github.com/rest/releases/releases#delete-a-release openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/releases/{release_id} documentation_url: https://docs.github.com/rest/releases/releases#get-a-release openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /repos/{owner}/{repo}/releases/{release_id} documentation_url: https://docs.github.com/rest/releases/releases#update-a-release openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/releases/{release_id}/assets documentation_url: https://docs.github.com/rest/releases/assets#list-release-assets openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/releases/{release_id}/assets documentation_url: https://docs.github.com/rest/releases/assets#upload-a-release-asset openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/releases/{release_id}/reactions documentation_url: https://docs.github.com/rest/reactions/reactions#list-reactions-for-a-release openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/releases/{release_id}/reactions documentation_url: https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-release openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/releases/{release_id}/reactions/{reaction_id} documentation_url: https://docs.github.com/rest/reactions/reactions#delete-a-release-reaction openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/replicas/caches - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/repos/repos#list-repository-cache-replication-status + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/repos/repos#list-repository-cache-replication-status openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/rules/branches/{branch} documentation_url: https://docs.github.com/rest/repos/rules#get-rules-for-a-branch openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/rulesets documentation_url: https://docs.github.com/rest/repos/rules#get-all-repository-rulesets openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/rulesets documentation_url: https://docs.github.com/rest/repos/rules#create-a-repository-ruleset openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/rulesets/rule-suites documentation_url: https://docs.github.com/rest/repos/rule-suites#list-repository-rule-suites openapi_files: @@ -4855,40 +4936,43 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/rulesets/{ruleset_id} documentation_url: https://docs.github.com/rest/repos/rules#get-a-repository-ruleset openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /repos/{owner}/{repo}/rulesets/{ruleset_id} documentation_url: https://docs.github.com/rest/repos/rules#update-a-repository-ruleset openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/secret-scanning/alerts documentation_url: https://docs.github.com/rest/secret-scanning/secret-scanning#list-secret-scanning-alerts-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number} documentation_url: https://docs.github.com/rest/secret-scanning/secret-scanning#get-a-secret-scanning-alert openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number} documentation_url: https://docs.github.com/rest/secret-scanning/secret-scanning#update-a-secret-scanning-alert openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}/locations documentation_url: https://docs.github.com/rest/secret-scanning/secret-scanning#list-locations-for-a-secret-scanning-alert openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/security-advisories documentation_url: https://docs.github.com/rest/security-advisories/repository-advisories#list-repository-security-advisories openapi_files: @@ -4919,120 +5003,125 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json + - name: POST /repos/{owner}/{repo}/security-advisories/{ghsa_id}/forks + documentation_url: https://docs.github.com/rest/security-advisories/repository-advisories#create-a-temporary-private-fork + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json - name: GET /repos/{owner}/{repo}/stargazers documentation_url: https://docs.github.com/rest/activity/starring#list-stargazers openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/stats/code_frequency documentation_url: https://docs.github.com/rest/metrics/statistics#get-the-weekly-commit-activity openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/stats/commit_activity documentation_url: https://docs.github.com/rest/metrics/statistics#get-the-last-year-of-commit-activity openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/stats/contributors documentation_url: https://docs.github.com/rest/metrics/statistics#get-all-contributor-commit-activity openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/stats/participation documentation_url: https://docs.github.com/rest/metrics/statistics#get-the-weekly-commit-count openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/stats/punch_card documentation_url: https://docs.github.com/rest/metrics/statistics#get-the-hourly-commit-count-for-each-day openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/statuses/{sha} documentation_url: https://docs.github.com/rest/commits/statuses#create-a-commit-status openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/subscribers documentation_url: https://docs.github.com/rest/activity/watching#list-watchers openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/subscription documentation_url: https://docs.github.com/rest/activity/watching#delete-a-repository-subscription openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/subscription documentation_url: https://docs.github.com/rest/activity/watching#get-a-repository-subscription openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /repos/{owner}/{repo}/subscription documentation_url: https://docs.github.com/rest/activity/watching#set-a-repository-subscription openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/tags documentation_url: https://docs.github.com/rest/repos/repos#list-repository-tags openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/tags/protection documentation_url: https://docs.github.com/rest/repos/tags#list-tag-protection-states-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{owner}/{repo}/tags/protection documentation_url: https://docs.github.com/rest/repos/tags#create-a-tag-protection-state-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/tags/protection/{tag_protection_id} documentation_url: https://docs.github.com/rest/repos/tags#delete-a-tag-protection-state-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/tarball/{ref} documentation_url: https://docs.github.com/rest/repos/contents#download-a-repository-archive-tar openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/teams documentation_url: https://docs.github.com/rest/repos/repos#list-repository-teams openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/topics documentation_url: https://docs.github.com/rest/repos/repos#get-all-repository-topics openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /repos/{owner}/{repo}/topics documentation_url: https://docs.github.com/rest/repos/repos#replace-all-repository-topics openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/traffic/clones documentation_url: https://docs.github.com/rest/metrics/traffic#get-repository-clones openapi_files: @@ -5058,163 +5147,163 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repos/{owner}/{repo}/vulnerability-alerts documentation_url: https://docs.github.com/rest/repos/repos#disable-vulnerability-alerts openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/vulnerability-alerts documentation_url: https://docs.github.com/rest/repos/repos#check-if-vulnerability-alerts-are-enabled-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /repos/{owner}/{repo}/vulnerability-alerts documentation_url: https://docs.github.com/rest/repos/repos#enable-vulnerability-alerts openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repos/{owner}/{repo}/zipball/{ref} documentation_url: https://docs.github.com/rest/repos/contents#download-a-repository-archive-zip openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repos/{template_owner}/{template_repo}/generate documentation_url: https://docs.github.com/rest/repos/repos#create-a-repository-using-a-template openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repositories documentation_url: https://docs.github.com/rest/repos/repos#list-public-repositories openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repositories/{repository_id}/environments/{environment_name}/secrets documentation_url: https://docs.github.com/rest/actions/secrets#list-environment-secrets openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repositories/{repository_id}/environments/{environment_name}/secrets/public-key documentation_url: https://docs.github.com/rest/actions/secrets#get-an-environment-public-key openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name} documentation_url: https://docs.github.com/rest/actions/secrets#delete-an-environment-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name} documentation_url: https://docs.github.com/rest/actions/secrets#get-an-environment-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name} documentation_url: https://docs.github.com/rest/actions/secrets#create-or-update-an-environment-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repositories/{repository_id}/environments/{environment_name}/variables documentation_url: https://docs.github.com/rest/actions/variables#list-environment-variables openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /repositories/{repository_id}/environments/{environment_name}/variables documentation_url: https://docs.github.com/rest/actions/variables#create-an-environment-variable openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /repositories/{repository_id}/environments/{environment_name}/variables/{name} documentation_url: https://docs.github.com/rest/actions/variables#delete-an-environment-variable openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /repositories/{repository_id}/environments/{environment_name}/variables/{name} documentation_url: https://docs.github.com/rest/actions/variables#get-an-environment-variable openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /repositories/{repository_id}/environments/{environment_name}/variables/{name} documentation_url: https://docs.github.com/rest/actions/variables#update-an-environment-variable openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /scim/v2/Groups documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/scim#list-provisioned-scim-groups-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /scim/v2/Groups documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/scim#provision-a-scim-enterprise-group openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /scim/v2/Groups/{scim_group_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/scim#delete-a-scim-group-from-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /scim/v2/Groups/{scim_group_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/scim#get-scim-provisioning-information-for-an-enterprise-group openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /scim/v2/Groups/{scim_group_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/scim#update-an-attribute-for-a-scim-enterprise-group openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /scim/v2/Groups/{scim_group_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/scim#set-scim-information-for-a-provisioned-enterprise-group openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /scim/v2/Users documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/scim#list-scim-provisioned-identities-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /scim/v2/Users documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/scim#provision-a-scim-enterprise-user openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /scim/v2/Users/{scim_user_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/scim#delete-a-scim-user-from-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /scim/v2/Users/{scim_user_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/scim#get-scim-provisioning-information-for-an-enterprise-user openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /scim/v2/Users/{scim_user_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/scim#update-an-attribute-for-a-scim-enterprise-user openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /scim/v2/Users/{scim_user_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/scim#set-scim-information-for-a-provisioned-enterprise-user openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /scim/v2/organizations/{org}/Users documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/scim/scim#list-scim-provisioned-identities openapi_files: @@ -5244,189 +5333,189 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /search/commits documentation_url: https://docs.github.com/rest/search/search#search-commits openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /search/issues documentation_url: https://docs.github.com/rest/search/search#search-issues-and-pull-requests openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /search/labels documentation_url: https://docs.github.com/rest/search/search#search-labels openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /search/repositories documentation_url: https://docs.github.com/rest/search/search#search-repositories openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /search/topics documentation_url: https://docs.github.com/rest/search/search#search-topics openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /search/users documentation_url: https://docs.github.com/rest/search/search#search-users openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /setup/api/configcheck - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/management-console#get-the-configuration-status + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/management-console#get-the-configuration-status openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /setup/api/configure - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/management-console#start-a-configuration-process + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/management-console#start-a-configuration-process openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /setup/api/maintenance - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/management-console#get-the-maintenance-status + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/management-console#get-the-maintenance-status openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /setup/api/maintenance - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/management-console#enable-or-disable-maintenance-mode + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/management-console#enable-or-disable-maintenance-mode openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /setup/api/settings - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/management-console#get-settings + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/management-console#get-settings openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /setup/api/settings - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/management-console#set-settings + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/management-console#set-settings openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /setup/api/settings/authorized-keys - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/management-console#remove-an-authorized-ssh-key + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/management-console#remove-an-authorized-ssh-key openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /setup/api/settings/authorized-keys - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/management-console#get-all-authorized-ssh-keys + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/management-console#get-all-authorized-ssh-keys openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /setup/api/settings/authorized-keys - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/management-console#add-an-authorized-ssh-key + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/management-console#add-an-authorized-ssh-key openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /setup/api/start - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/management-console#create-a-github-license + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/management-console#create-a-github-license openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /setup/api/upgrade - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/management-console#upgrade-a-license + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/management-console#upgrade-a-license openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /teams/{team_id} documentation_url: https://docs.github.com/rest/teams/teams#delete-a-team-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /teams/{team_id} documentation_url: https://docs.github.com/rest/teams/teams#get-a-team-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /teams/{team_id} documentation_url: https://docs.github.com/rest/teams/teams#update-a-team-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /teams/{team_id}/discussions documentation_url: https://docs.github.com/rest/teams/discussions#list-discussions-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /teams/{team_id}/discussions documentation_url: https://docs.github.com/rest/teams/discussions#create-a-discussion-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /teams/{team_id}/discussions/{discussion_number} documentation_url: https://docs.github.com/rest/teams/discussions#delete-a-discussion-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /teams/{team_id}/discussions/{discussion_number} documentation_url: https://docs.github.com/rest/teams/discussions#get-a-discussion-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /teams/{team_id}/discussions/{discussion_number} documentation_url: https://docs.github.com/rest/teams/discussions#update-a-discussion-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /teams/{team_id}/discussions/{discussion_number}/comments documentation_url: https://docs.github.com/rest/teams/discussion-comments#list-discussion-comments-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /teams/{team_id}/discussions/{discussion_number}/comments documentation_url: https://docs.github.com/rest/teams/discussion-comments#create-a-discussion-comment-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number} documentation_url: https://docs.github.com/rest/teams/discussion-comments#delete-a-discussion-comment-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number} documentation_url: https://docs.github.com/rest/teams/discussion-comments#get-a-discussion-comment-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number} documentation_url: https://docs.github.com/rest/teams/discussion-comments#update-a-discussion-comment-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions documentation_url: https://docs.github.com/rest/reactions/reactions#list-reactions-for-a-team-discussion-comment-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions documentation_url: https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-team-discussion-comment-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /teams/{team_id}/discussions/{discussion_number}/reactions documentation_url: https://docs.github.com/rest/reactions/reactions#list-reactions-for-a-team-discussion-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /teams/{team_id}/discussions/{discussion_number}/reactions documentation_url: https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-team-discussion-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /teams/{team_id}/invitations documentation_url: https://docs.github.com/rest/teams/members#list-pending-team-invitations-legacy openapi_files: @@ -5437,91 +5526,91 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /teams/{team_id}/members/{username} documentation_url: https://docs.github.com/rest/teams/members#remove-team-member-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /teams/{team_id}/members/{username} documentation_url: https://docs.github.com/rest/teams/members#get-team-member-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /teams/{team_id}/members/{username} documentation_url: https://docs.github.com/rest/teams/members#add-team-member-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /teams/{team_id}/memberships/{username} documentation_url: https://docs.github.com/rest/teams/members#remove-team-membership-for-a-user-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /teams/{team_id}/memberships/{username} documentation_url: https://docs.github.com/rest/teams/members#get-team-membership-for-a-user-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /teams/{team_id}/memberships/{username} documentation_url: https://docs.github.com/rest/teams/members#add-or-update-team-membership-for-a-user-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /teams/{team_id}/projects documentation_url: https://docs.github.com/rest/teams/teams#list-team-projects-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /teams/{team_id}/projects/{project_id} documentation_url: https://docs.github.com/rest/teams/teams#remove-a-project-from-a-team-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /teams/{team_id}/projects/{project_id} documentation_url: https://docs.github.com/rest/teams/teams#check-team-permissions-for-a-project-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /teams/{team_id}/projects/{project_id} documentation_url: https://docs.github.com/rest/teams/teams#add-or-update-team-project-permissions-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /teams/{team_id}/repos documentation_url: https://docs.github.com/rest/teams/teams#list-team-repositories-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /teams/{team_id}/repos/{owner}/{repo} documentation_url: https://docs.github.com/rest/teams/teams#remove-a-repository-from-a-team-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /teams/{team_id}/repos/{owner}/{repo} documentation_url: https://docs.github.com/rest/teams/teams#check-team-permissions-for-a-repository-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /teams/{team_id}/repos/{owner}/{repo} documentation_url: https://docs.github.com/rest/teams/teams#add-or-update-team-repository-permissions-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /teams/{team_id}/team-sync/group-mappings documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/teams/team-sync#list-idp-groups-for-a-team-legacy openapi_files: @@ -5535,19 +5624,19 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /user documentation_url: https://docs.github.com/rest/users/users#get-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /user documentation_url: https://docs.github.com/rest/users/users#update-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /user/blocks documentation_url: https://docs.github.com/rest/users/blocking#list-users-blocked-by-the-authenticated-user openapi_files: @@ -5673,7 +5762,7 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /user/email/visibility documentation_url: https://docs.github.com/rest/users/emails#set-primary-email-visibility-for-the-authenticated-user openapi_files: @@ -5684,97 +5773,97 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /user/emails documentation_url: https://docs.github.com/rest/users/emails#list-email-addresses-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /user/emails documentation_url: https://docs.github.com/rest/users/emails#add-an-email-address-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /user/followers documentation_url: https://docs.github.com/rest/users/followers#list-followers-of-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /user/following documentation_url: https://docs.github.com/rest/users/followers#list-the-people-the-authenticated-user-follows openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /user/following/{username} documentation_url: https://docs.github.com/rest/users/followers#unfollow-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /user/following/{username} documentation_url: https://docs.github.com/rest/users/followers#check-if-a-person-is-followed-by-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /user/following/{username} documentation_url: https://docs.github.com/rest/users/followers#follow-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /user/gpg_keys documentation_url: https://docs.github.com/rest/users/gpg-keys#list-gpg-keys-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /user/gpg_keys documentation_url: https://docs.github.com/rest/users/gpg-keys#create-a-gpg-key-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /user/gpg_keys/{gpg_key_id} documentation_url: https://docs.github.com/rest/users/gpg-keys#delete-a-gpg-key-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /user/gpg_keys/{gpg_key_id} documentation_url: https://docs.github.com/rest/users/gpg-keys#get-a-gpg-key-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /user/installations documentation_url: https://docs.github.com/rest/apps/installations#list-app-installations-accessible-to-the-user-access-token openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /user/installations/{installation_id}/repositories documentation_url: https://docs.github.com/rest/apps/installations#list-repositories-accessible-to-the-user-access-token openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /user/installations/{installation_id}/repositories/{repository_id} documentation_url: https://docs.github.com/rest/apps/installations#remove-a-repository-from-an-app-installation openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /user/installations/{installation_id}/repositories/{repository_id} documentation_url: https://docs.github.com/rest/apps/installations#add-a-repository-to-an-app-installation openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /user/interaction-limits documentation_url: https://docs.github.com/rest/interactions/user#remove-interaction-restrictions-from-your-public-repositories openapi_files: @@ -5795,31 +5884,31 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /user/keys documentation_url: https://docs.github.com/rest/users/keys#list-public-ssh-keys-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /user/keys documentation_url: https://docs.github.com/rest/users/keys#create-a-public-ssh-key-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /user/keys/{key_id} documentation_url: https://docs.github.com/rest/users/keys#delete-a-public-ssh-key-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /user/keys/{key_id} documentation_url: https://docs.github.com/rest/users/keys#get-a-public-ssh-key-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /user/marketplace_purchases documentation_url: https://docs.github.com/rest/apps/marketplace#list-subscriptions-for-the-authenticated-user openapi_files: @@ -5835,31 +5924,31 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /user/memberships/orgs/{org} documentation_url: https://docs.github.com/rest/orgs/members#get-an-organization-membership-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /user/memberships/orgs/{org} documentation_url: https://docs.github.com/rest/orgs/members#update-an-organization-membership-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /user/migrations documentation_url: https://docs.github.com/rest/migrations/users#list-user-migrations openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /user/migrations documentation_url: https://docs.github.com/rest/migrations/users#start-a-user-migration openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /user/migrations/{migration_id} documentation_url: https://docs.github.com/rest/migrations/users#get-a-user-migration-status openapi_files: @@ -5875,7 +5964,7 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /user/migrations/{migration_id}/repos/{repo_name}/lock documentation_url: https://docs.github.com/rest/migrations/users#unlock-a-user-repository openapi_files: @@ -5886,343 +5975,343 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /user/orgs documentation_url: https://docs.github.com/rest/orgs/orgs#list-organizations-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /user/packages documentation_url: https://docs.github.com/rest/packages/packages#list-packages-for-the-authenticated-users-namespace openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /user/packages/{package_type}/{package_name} documentation_url: https://docs.github.com/rest/packages/packages#delete-a-package-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /user/packages/{package_type}/{package_name} documentation_url: https://docs.github.com/rest/packages/packages#get-a-package-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /user/packages/{package_type}/{package_name}/restore documentation_url: https://docs.github.com/rest/packages/packages#restore-a-package-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /user/packages/{package_type}/{package_name}/versions documentation_url: https://docs.github.com/rest/packages/packages#list-package-versions-for-a-package-owned-by-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /user/packages/{package_type}/{package_name}/versions/{package_version_id} documentation_url: https://docs.github.com/rest/packages/packages#delete-a-package-version-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /user/packages/{package_type}/{package_name}/versions/{package_version_id} documentation_url: https://docs.github.com/rest/packages/packages#get-a-package-version-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /user/packages/{package_type}/{package_name}/versions/{package_version_id}/restore documentation_url: https://docs.github.com/rest/packages/packages#restore-a-package-version-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /user/projects documentation_url: https://docs.github.com/rest/projects/projects#create-a-user-project openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /user/public_emails documentation_url: https://docs.github.com/rest/users/emails#list-public-email-addresses-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /user/repos documentation_url: https://docs.github.com/rest/repos/repos#list-repositories-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /user/repos documentation_url: https://docs.github.com/rest/repos/repos#create-a-repository-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /user/repository_invitations documentation_url: https://docs.github.com/rest/collaborators/invitations#list-repository-invitations-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /user/repository_invitations/{invitation_id} documentation_url: https://docs.github.com/rest/collaborators/invitations#decline-a-repository-invitation openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PATCH /user/repository_invitations/{invitation_id} documentation_url: https://docs.github.com/rest/collaborators/invitations#accept-a-repository-invitation openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /user/social_accounts documentation_url: https://docs.github.com/rest/users/social-accounts#delete-social-accounts-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /user/social_accounts documentation_url: https://docs.github.com/rest/users/social-accounts#list-social-accounts-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /user/social_accounts documentation_url: https://docs.github.com/rest/users/social-accounts#add-social-accounts-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /user/ssh_signing_keys documentation_url: https://docs.github.com/rest/users/ssh-signing-keys#list-ssh-signing-keys-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /user/ssh_signing_keys documentation_url: https://docs.github.com/rest/users/ssh-signing-keys#create-a-ssh-signing-key-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /user/ssh_signing_keys/{ssh_signing_key_id} documentation_url: https://docs.github.com/rest/users/ssh-signing-keys#delete-an-ssh-signing-key-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /user/ssh_signing_keys/{ssh_signing_key_id} documentation_url: https://docs.github.com/rest/users/ssh-signing-keys#get-an-ssh-signing-key-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /user/starred documentation_url: https://docs.github.com/rest/activity/starring#list-repositories-starred-by-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /user/starred/{owner}/{repo} documentation_url: https://docs.github.com/rest/activity/starring#unstar-a-repository-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /user/starred/{owner}/{repo} documentation_url: https://docs.github.com/rest/activity/starring#check-if-a-repository-is-starred-by-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /user/starred/{owner}/{repo} documentation_url: https://docs.github.com/rest/activity/starring#star-a-repository-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /user/subscriptions documentation_url: https://docs.github.com/rest/activity/watching#list-repositories-watched-by-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /user/teams documentation_url: https://docs.github.com/rest/teams/teams#list-teams-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /users documentation_url: https://docs.github.com/rest/users/users#list-users openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /users/{username} documentation_url: https://docs.github.com/rest/users/users#get-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /users/{username}/docker/conflicts documentation_url: https://docs.github.com/rest/packages/packages#get-list-of-conflicting-packages-during-docker-migration-for-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /users/{username}/events documentation_url: https://docs.github.com/rest/activity/events#list-events-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /users/{username}/events/orgs/{org} documentation_url: https://docs.github.com/rest/activity/events#list-organization-events-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /users/{username}/events/public documentation_url: https://docs.github.com/rest/activity/events#list-public-events-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /users/{username}/followers documentation_url: https://docs.github.com/rest/users/followers#list-followers-of-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /users/{username}/following documentation_url: https://docs.github.com/rest/users/followers#list-the-people-a-user-follows openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /users/{username}/following/{target_user} documentation_url: https://docs.github.com/rest/users/followers#check-if-a-user-follows-another-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /users/{username}/gists documentation_url: https://docs.github.com/rest/gists/gists#list-gists-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /users/{username}/gpg_keys documentation_url: https://docs.github.com/rest/users/gpg-keys#list-gpg-keys-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /users/{username}/hovercard documentation_url: https://docs.github.com/rest/users/users#get-contextual-information-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /users/{username}/installation documentation_url: https://docs.github.com/rest/apps/apps#get-a-user-installation-for-the-authenticated-app openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /users/{username}/keys documentation_url: https://docs.github.com/rest/users/keys#list-public-keys-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /users/{username}/orgs documentation_url: https://docs.github.com/rest/orgs/orgs#list-organizations-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /users/{username}/packages documentation_url: https://docs.github.com/rest/packages/packages#list-packages-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /users/{username}/packages/{package_type}/{package_name} documentation_url: https://docs.github.com/rest/packages/packages#delete-a-package-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /users/{username}/packages/{package_type}/{package_name} documentation_url: https://docs.github.com/rest/packages/packages#get-a-package-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /users/{username}/packages/{package_type}/{package_name}/restore documentation_url: https://docs.github.com/rest/packages/packages#restore-a-package-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /users/{username}/packages/{package_type}/{package_name}/versions documentation_url: https://docs.github.com/rest/packages/packages#list-package-versions-for-a-package-owned-by-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id} documentation_url: https://docs.github.com/rest/packages/packages#delete-package-version-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id} documentation_url: https://docs.github.com/rest/packages/packages#get-a-package-version-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: POST /users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id}/restore documentation_url: https://docs.github.com/rest/packages/packages#restore-package-version-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /users/{username}/projects documentation_url: https://docs.github.com/rest/projects/projects#list-user-projects openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /users/{username}/received_events documentation_url: https://docs.github.com/rest/activity/events#list-events-received-by-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /users/{username}/received_events/public documentation_url: https://docs.github.com/rest/activity/events#list-public-events-received-by-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /users/{username}/repos documentation_url: https://docs.github.com/rest/repos/repos#list-repositories-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /users/{username}/settings/billing/actions documentation_url: https://docs.github.com/rest/billing/billing#get-github-actions-billing-for-a-user openapi_files: @@ -6239,45 +6328,45 @@ openapi_operations: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - name: DELETE /users/{username}/site_admin - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#demote-a-site-administrator + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#demote-a-site-administrator openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /users/{username}/site_admin - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#promote-a-user-to-be-a-site-administrator + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#promote-a-user-to-be-a-site-administrator openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /users/{username}/social_accounts documentation_url: https://docs.github.com/rest/users/social-accounts#list-social-accounts-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /users/{username}/ssh_signing_keys documentation_url: https://docs.github.com/rest/users/ssh-signing-keys#list-ssh-signing-keys-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /users/{username}/starred documentation_url: https://docs.github.com/rest/activity/starring#list-repositories-starred-by-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /users/{username}/subscriptions documentation_url: https://docs.github.com/rest/activity/watching#list-repositories-watched-by-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: DELETE /users/{username}/suspended - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#unsuspend-a-user + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#unsuspend-a-user openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: PUT /users/{username}/suspended - documentation_url: https://docs.github.com/enterprise-server@3.10/rest/enterprise-admin/users#suspend-a-user + documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#suspend-a-user openapi_files: - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json - name: GET /versions documentation_url: https://docs.github.com/rest/meta/meta#get-all-api-versions openapi_files: @@ -6288,4 +6377,4 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.10/ghes-3.10.json + - descriptions/ghes-3.11/ghes-3.11.json From c135be9459ed40979be841f065badb7de19d467b Mon Sep 17 00:00:00 2001 From: Peter Aglen <86360391+peter-aglen@users.noreply.github.com> Date: Fri, 8 Dec 2023 14:36:23 +0100 Subject: [PATCH 068/145] Fix broken CreateOrUpdateRepoCustomPropertyValues (#3023) Fixes: #3021. --- github/orgs_properties.go | 6 +++--- github/orgs_properties_test.go | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/github/orgs_properties.go b/github/orgs_properties.go index 45e3f1f964d..2e88b7f4f98 100644 --- a/github/orgs_properties.go +++ b/github/orgs_properties.go @@ -178,12 +178,12 @@ func (s *OrganizationsService) ListCustomPropertyValues(ctx context.Context, org // GitHub API docs: https://docs.github.com/rest/orgs/custom-properties#create-or-update-custom-property-values-for-organization-repositories // //meta:operation PATCH /orgs/{org}/properties/values -func (s *OrganizationsService) CreateOrUpdateRepoCustomPropertyValues(ctx context.Context, org string, repoNames []string, properties []*CustomProperty) (*Response, error) { +func (s *OrganizationsService) CreateOrUpdateRepoCustomPropertyValues(ctx context.Context, org string, repoNames []string, properties []*CustomPropertyValue) (*Response, error) { u := fmt.Sprintf("orgs/%v/properties/values", org) params := struct { - RepositoryNames []string `json:"repository_names"` - Properties []*CustomProperty `json:"properties"` + RepositoryNames []string `json:"repository_names"` + Properties []*CustomPropertyValue `json:"properties"` }{ RepositoryNames: repoNames, Properties: properties, diff --git a/github/orgs_properties_test.go b/github/orgs_properties_test.go index 1a372306046..86daedb3a5b 100644 --- a/github/orgs_properties_test.go +++ b/github/orgs_properties_test.go @@ -347,14 +347,14 @@ func TestOrganizationsService_CreateOrUpdateRepoCustomPropertyValues(t *testing. mux.HandleFunc("/orgs/o/properties/values", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PATCH") - testBody(t, r, `{"repository_names":["repo"],"properties":[{"property_name":"service","value_type":"string"}]}`+"\n") + testBody(t, r, `{"repository_names":["repo"],"properties":[{"property_name":"service","value":"string"}]}`+"\n") }) ctx := context.Background() - _, err := client.Organizations.CreateOrUpdateRepoCustomPropertyValues(ctx, "o", []string{"repo"}, []*CustomProperty{ + _, err := client.Organizations.CreateOrUpdateRepoCustomPropertyValues(ctx, "o", []string{"repo"}, []*CustomPropertyValue{ { - PropertyName: String("service"), - ValueType: "string", + PropertyName: "service", + Value: String("string"), }, }) if err != nil { From fb8a83de3e7046c49ab76e09a4e9b5857f8f3997 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Dec 2023 14:28:57 -0500 Subject: [PATCH 069/145] Bump actions/setup-go from 4 to 5 (#3027) --- .github/workflows/linter.yml | 2 +- .github/workflows/tests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index f9d6d7e4639..24f3d909db4 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: 1.x cache-dependency-path: "**/go.sum" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b3abd8b6f92..3067b1b0bec 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -39,7 +39,7 @@ jobs: runs-on: ${{ matrix.platform }} steps: - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: ${{ matrix.go-version }} - uses: actions/checkout@v4 From c4ec3276de8584568e12e2a6af0d84a29a5ba8d8 Mon Sep 17 00:00:00 2001 From: Tomasz Adam Skrzypczak Date: Thu, 14 Dec 2023 09:14:41 -0500 Subject: [PATCH 070/145] Add scanning validity checks (#3026) Fixes: #3006. --- .../enterprise_code_security_and_analysis.go | 1 + ...erprise_code_security_and_analysis_test.go | 5 ++- github/github-accessors.go | 32 ++++++++++++++++ github/github-accessors_test.go | 37 +++++++++++++++++++ github/github-stringify_test.go | 20 +++++----- github/orgs.go | 2 + github/repos.go | 8 ++++ github/repos_test.go | 4 +- 8 files changed, 97 insertions(+), 12 deletions(-) diff --git a/github/enterprise_code_security_and_analysis.go b/github/enterprise_code_security_and_analysis.go index af8eb0ffb2f..159aeae4dca 100644 --- a/github/enterprise_code_security_and_analysis.go +++ b/github/enterprise_code_security_and_analysis.go @@ -16,6 +16,7 @@ type EnterpriseSecurityAnalysisSettings struct { SecretScanningEnabledForNewRepositories *bool `json:"secret_scanning_enabled_for_new_repositories,omitempty"` SecretScanningPushProtectionEnabledForNewRepositories *bool `json:"secret_scanning_push_protection_enabled_for_new_repositories,omitempty"` SecretScanningPushProtectionCustomLink *string `json:"secret_scanning_push_protection_custom_link,omitempty"` + SecretScanningValidityChecksEnabled *bool `json:"secret_scanning_validity_checks_enabled,omitempty"` } // GetCodeSecurityAndAnalysis gets code security and analysis features for an enterprise. diff --git a/github/enterprise_code_security_and_analysis_test.go b/github/enterprise_code_security_and_analysis_test.go index 25dbd941702..17bbe18beae 100644 --- a/github/enterprise_code_security_and_analysis_test.go +++ b/github/enterprise_code_security_and_analysis_test.go @@ -27,7 +27,8 @@ func TestEnterpriseService_GetCodeSecurityAndAnalysis(t *testing.T) { "advanced_security_enabled_for_new_repositories": true, "secret_scanning_enabled_for_new_repositories": true, "secret_scanning_push_protection_enabled_for_new_repositories": true, - "secret_scanning_push_protection_custom_link": "https://github.com/test-org/test-repo/blob/main/README.md" + "secret_scanning_push_protection_custom_link": "https://github.com/test-org/test-repo/blob/main/README.md", + "secret_scanning_validity_checks_enabled": true }`) }) @@ -44,6 +45,7 @@ func TestEnterpriseService_GetCodeSecurityAndAnalysis(t *testing.T) { SecretScanningEnabledForNewRepositories: Bool(true), SecretScanningPushProtectionEnabledForNewRepositories: Bool(true), SecretScanningPushProtectionCustomLink: String("https://github.com/test-org/test-repo/blob/main/README.md"), + SecretScanningValidityChecksEnabled: Bool(true), } if !cmp.Equal(settings, want) { @@ -73,6 +75,7 @@ func TestEnterpriseService_UpdateCodeSecurityAndAnalysis(t *testing.T) { SecretScanningEnabledForNewRepositories: Bool(true), SecretScanningPushProtectionEnabledForNewRepositories: Bool(true), SecretScanningPushProtectionCustomLink: String("https://github.com/test-org/test-repo/blob/main/README.md"), + SecretScanningValidityChecksEnabled: Bool(true), } mux.HandleFunc("/enterprises/e/code_security_and_analysis", func(w http.ResponseWriter, r *http.Request) { diff --git a/github/github-accessors.go b/github/github-accessors.go index e15eb10204b..4cb34b1260a 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -6974,6 +6974,14 @@ func (e *EnterpriseSecurityAnalysisSettings) GetSecretScanningPushProtectionEnab return *e.SecretScanningPushProtectionEnabledForNewRepositories } +// GetSecretScanningValidityChecksEnabled returns the SecretScanningValidityChecksEnabled field if it's non-nil, zero value otherwise. +func (e *EnterpriseSecurityAnalysisSettings) GetSecretScanningValidityChecksEnabled() bool { + if e == nil || e.SecretScanningValidityChecksEnabled == nil { + return false + } + return *e.SecretScanningValidityChecksEnabled +} + // GetCanAdminsBypass returns the CanAdminsBypass field if it's non-nil, zero value otherwise. func (e *Environment) GetCanAdminsBypass() bool { if e == nil || e.CanAdminsBypass == nil { @@ -12734,6 +12742,14 @@ func (o *Organization) GetSecretScanningPushProtectionEnabledForNewRepos() bool return *o.SecretScanningPushProtectionEnabledForNewRepos } +// GetSecretScanningValidityChecksEnabled returns the SecretScanningValidityChecksEnabled field if it's non-nil, zero value otherwise. +func (o *Organization) GetSecretScanningValidityChecksEnabled() bool { + if o == nil || o.SecretScanningValidityChecksEnabled == nil { + return false + } + return *o.SecretScanningValidityChecksEnabled +} + // GetTotalPrivateRepos returns the TotalPrivateRepos field if it's non-nil, zero value otherwise. func (o *Organization) GetTotalPrivateRepos() int64 { if o == nil || o.TotalPrivateRepos == nil { @@ -21590,6 +21606,14 @@ func (s *SecretScanningPushProtection) GetStatus() string { return *s.Status } +// GetStatus returns the Status field if it's non-nil, zero value otherwise. +func (s *SecretScanningValidityChecks) GetStatus() string { + if s == nil || s.Status == nil { + return "" + } + return *s.Status +} + // GetAuthor returns the Author field. func (s *SecurityAdvisory) GetAuthor() *User { if s == nil { @@ -21830,6 +21854,14 @@ func (s *SecurityAndAnalysis) GetSecretScanningPushProtection() *SecretScanningP return s.SecretScanningPushProtection } +// GetSecretScanningValidityChecks returns the SecretScanningValidityChecks field. +func (s *SecurityAndAnalysis) GetSecretScanningValidityChecks() *SecretScanningValidityChecks { + if s == nil { + return nil + } + return s.SecretScanningValidityChecks +} + // GetFrom returns the From field. func (s *SecurityAndAnalysisChange) GetFrom() *SecurityAndAnalysisChangeFrom { if s == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 84d104f18cb..cdc27ab9966 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -8175,6 +8175,16 @@ func TestEnterpriseSecurityAnalysisSettings_GetSecretScanningPushProtectionEnabl e.GetSecretScanningPushProtectionEnabledForNewRepositories() } +func TestEnterpriseSecurityAnalysisSettings_GetSecretScanningValidityChecksEnabled(tt *testing.T) { + var zeroValue bool + e := &EnterpriseSecurityAnalysisSettings{SecretScanningValidityChecksEnabled: &zeroValue} + e.GetSecretScanningValidityChecksEnabled() + e = &EnterpriseSecurityAnalysisSettings{} + e.GetSecretScanningValidityChecksEnabled() + e = nil + e.GetSecretScanningValidityChecksEnabled() +} + func TestEnvironment_GetCanAdminsBypass(tt *testing.T) { var zeroValue bool e := &Environment{CanAdminsBypass: &zeroValue} @@ -14928,6 +14938,16 @@ func TestOrganization_GetSecretScanningPushProtectionEnabledForNewRepos(tt *test o.GetSecretScanningPushProtectionEnabledForNewRepos() } +func TestOrganization_GetSecretScanningValidityChecksEnabled(tt *testing.T) { + var zeroValue bool + o := &Organization{SecretScanningValidityChecksEnabled: &zeroValue} + o.GetSecretScanningValidityChecksEnabled() + o = &Organization{} + o.GetSecretScanningValidityChecksEnabled() + o = nil + o.GetSecretScanningValidityChecksEnabled() +} + func TestOrganization_GetTotalPrivateRepos(tt *testing.T) { var zeroValue int64 o := &Organization{TotalPrivateRepos: &zeroValue} @@ -25149,6 +25169,16 @@ func TestSecretScanningPushProtection_GetStatus(tt *testing.T) { s.GetStatus() } +func TestSecretScanningValidityChecks_GetStatus(tt *testing.T) { + var zeroValue string + s := &SecretScanningValidityChecks{Status: &zeroValue} + s.GetStatus() + s = &SecretScanningValidityChecks{} + s.GetStatus() + s = nil + s.GetStatus() +} + func TestSecurityAdvisory_GetAuthor(tt *testing.T) { s := &SecurityAdvisory{} s.GetAuthor() @@ -25404,6 +25434,13 @@ func TestSecurityAndAnalysis_GetSecretScanningPushProtection(tt *testing.T) { s.GetSecretScanningPushProtection() } +func TestSecurityAndAnalysis_GetSecretScanningValidityChecks(tt *testing.T) { + s := &SecurityAndAnalysis{} + s.GetSecretScanningValidityChecks() + s = nil + s.GetSecretScanningValidityChecks() +} + func TestSecurityAndAnalysisChange_GetFrom(tt *testing.T) { s := &SecurityAndAnalysisChange{} s.GetFrom() diff --git a/github/github-stringify_test.go b/github/github-stringify_test.go index 7472edfd59a..bb69ce1ad5a 100644 --- a/github/github-stringify_test.go +++ b/github/github-stringify_test.go @@ -1051,15 +1051,16 @@ func TestOrganization_String(t *testing.T) { DependencyGraphEnabledForNewRepos: Bool(false), SecretScanningEnabledForNewRepos: Bool(false), SecretScanningPushProtectionEnabledForNewRepos: Bool(false), - URL: String(""), - EventsURL: String(""), - HooksURL: String(""), - IssuesURL: String(""), - MembersURL: String(""), - PublicMembersURL: String(""), - ReposURL: String(""), + SecretScanningValidityChecksEnabled: Bool(false), + URL: String(""), + EventsURL: String(""), + HooksURL: String(""), + IssuesURL: String(""), + MembersURL: String(""), + PublicMembersURL: String(""), + ReposURL: String(""), } - want := `github.Organization{Login:"", ID:0, NodeID:"", AvatarURL:"", HTMLURL:"", Name:"", Company:"", Blog:"", Location:"", Email:"", TwitterUsername:"", Description:"", PublicRepos:0, PublicGists:0, Followers:0, Following:0, CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, TotalPrivateRepos:0, OwnedPrivateRepos:0, PrivateGists:0, DiskUsage:0, Collaborators:0, BillingEmail:"", Type:"", Plan:github.Plan{}, TwoFactorRequirementEnabled:false, IsVerified:false, HasOrganizationProjects:false, HasRepositoryProjects:false, DefaultRepoPermission:"", DefaultRepoSettings:"", MembersCanCreateRepos:false, MembersCanCreatePublicRepos:false, MembersCanCreatePrivateRepos:false, MembersCanCreateInternalRepos:false, MembersCanForkPrivateRepos:false, MembersAllowedRepositoryCreationType:"", MembersCanCreatePages:false, MembersCanCreatePublicPages:false, MembersCanCreatePrivatePages:false, WebCommitSignoffRequired:false, AdvancedSecurityEnabledForNewRepos:false, DependabotAlertsEnabledForNewRepos:false, DependabotSecurityUpdatesEnabledForNewRepos:false, DependencyGraphEnabledForNewRepos:false, SecretScanningEnabledForNewRepos:false, SecretScanningPushProtectionEnabledForNewRepos:false, URL:"", EventsURL:"", HooksURL:"", IssuesURL:"", MembersURL:"", PublicMembersURL:"", ReposURL:""}` + want := `github.Organization{Login:"", ID:0, NodeID:"", AvatarURL:"", HTMLURL:"", Name:"", Company:"", Blog:"", Location:"", Email:"", TwitterUsername:"", Description:"", PublicRepos:0, PublicGists:0, Followers:0, Following:0, CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, TotalPrivateRepos:0, OwnedPrivateRepos:0, PrivateGists:0, DiskUsage:0, Collaborators:0, BillingEmail:"", Type:"", Plan:github.Plan{}, TwoFactorRequirementEnabled:false, IsVerified:false, HasOrganizationProjects:false, HasRepositoryProjects:false, DefaultRepoPermission:"", DefaultRepoSettings:"", MembersCanCreateRepos:false, MembersCanCreatePublicRepos:false, MembersCanCreatePrivateRepos:false, MembersCanCreateInternalRepos:false, MembersCanForkPrivateRepos:false, MembersAllowedRepositoryCreationType:"", MembersCanCreatePages:false, MembersCanCreatePublicPages:false, MembersCanCreatePrivatePages:false, WebCommitSignoffRequired:false, AdvancedSecurityEnabledForNewRepos:false, DependabotAlertsEnabledForNewRepos:false, DependabotSecurityUpdatesEnabledForNewRepos:false, DependencyGraphEnabledForNewRepos:false, SecretScanningEnabledForNewRepos:false, SecretScanningPushProtectionEnabledForNewRepos:false, SecretScanningValidityChecksEnabled:false, URL:"", EventsURL:"", HooksURL:"", IssuesURL:"", MembersURL:"", PublicMembersURL:"", ReposURL:""}` if got := v.String(); got != want { t.Errorf("Organization.String = %v, want %v", got, want) } @@ -1826,8 +1827,9 @@ func TestSecurityAndAnalysis_String(t *testing.T) { SecretScanning: &SecretScanning{}, SecretScanningPushProtection: &SecretScanningPushProtection{}, DependabotSecurityUpdates: &DependabotSecurityUpdates{}, + SecretScanningValidityChecks: &SecretScanningValidityChecks{}, } - want := `github.SecurityAndAnalysis{AdvancedSecurity:github.AdvancedSecurity{}, SecretScanning:github.SecretScanning{}, SecretScanningPushProtection:github.SecretScanningPushProtection{}, DependabotSecurityUpdates:github.DependabotSecurityUpdates{}}` + want := `github.SecurityAndAnalysis{AdvancedSecurity:github.AdvancedSecurity{}, SecretScanning:github.SecretScanning{}, SecretScanningPushProtection:github.SecretScanningPushProtection{}, DependabotSecurityUpdates:github.DependabotSecurityUpdates{}, SecretScanningValidityChecks:github.SecretScanningValidityChecks{}}` if got := v.String(); got != want { t.Errorf("SecurityAndAnalysis.String = %v, want %v", got, want) } diff --git a/github/orgs.go b/github/orgs.go index 4d3465271b6..27c0f102842 100644 --- a/github/orgs.go +++ b/github/orgs.go @@ -95,6 +95,8 @@ type Organization struct { SecretScanningEnabledForNewRepos *bool `json:"secret_scanning_enabled_for_new_repositories,omitempty"` // SecretScanningPushProtectionEnabledForNewRepos toggles whether secret scanning push protection is enabled on new repositories. SecretScanningPushProtectionEnabledForNewRepos *bool `json:"secret_scanning_push_protection_enabled_for_new_repositories,omitempty"` + // SecretScanningValidityChecksEnabled toggles whether secret scanning validity check is enabled. + SecretScanningValidityChecksEnabled *bool `json:"secret_scanning_validity_checks_enabled,omitempty"` // API URLs URL *string `json:"url,omitempty"` diff --git a/github/repos.go b/github/repos.go index 5fcf219b3cf..a7574d72f07 100644 --- a/github/repos.go +++ b/github/repos.go @@ -198,6 +198,7 @@ type SecurityAndAnalysis struct { SecretScanning *SecretScanning `json:"secret_scanning,omitempty"` SecretScanningPushProtection *SecretScanningPushProtection `json:"secret_scanning_push_protection,omitempty"` DependabotSecurityUpdates *DependabotSecurityUpdates `json:"dependabot_security_updates,omitempty"` + SecretScanningValidityChecks *SecretScanningValidityChecks `json:"secret_scanning_validity_checks,omitempty"` } func (s SecurityAndAnalysis) String() string { @@ -248,6 +249,13 @@ func (d DependabotSecurityUpdates) String() string { return Stringify(d) } +// SecretScanningValidityChecks represents the state of secret scanning validity checks on a repository. +// +// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-security-and-analysis-settings-for-your-repository#allowing-validity-checks-for-partner-patterns-in-a-repository +type SecretScanningValidityChecks struct { + Status *string `json:"status,omitempty"` +} + // List calls either RepositoriesService.ListByUser or RepositoriesService.ListByAuthenticatedUser // depending on whether user is empty. // diff --git a/github/repos_test.go b/github/repos_test.go index fa49ddd4f5c..2e61aeb1b1f 100644 --- a/github/repos_test.go +++ b/github/repos_test.go @@ -360,7 +360,7 @@ func TestRepositoriesService_Get(t *testing.T) { mux.HandleFunc("/repos/o/r", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", ")) - fmt.Fprint(w, `{"id":1,"name":"n","description":"d","owner":{"login":"l"},"license":{"key":"mit"},"security_and_analysis":{"advanced_security":{"status":"enabled"},"secret_scanning":{"status":"enabled"},"secret_scanning_push_protection":{"status":"enabled"},"dependabot_security_updates":{"status": "enabled"}}}`) + fmt.Fprint(w, `{"id":1,"name":"n","description":"d","owner":{"login":"l"},"license":{"key":"mit"},"security_and_analysis":{"advanced_security":{"status":"enabled"},"secret_scanning":{"status":"enabled"},"secret_scanning_push_protection":{"status":"enabled"},"dependabot_security_updates":{"status": "enabled"}, "secret_scanning_validity_checks":{"status":"enabled"}}}`) }) ctx := context.Background() @@ -369,7 +369,7 @@ func TestRepositoriesService_Get(t *testing.T) { t.Errorf("Repositories.Get returned error: %v", err) } - want := &Repository{ID: Int64(1), Name: String("n"), Description: String("d"), Owner: &User{Login: String("l")}, License: &License{Key: String("mit")}, SecurityAndAnalysis: &SecurityAndAnalysis{AdvancedSecurity: &AdvancedSecurity{Status: String("enabled")}, SecretScanning: &SecretScanning{String("enabled")}, SecretScanningPushProtection: &SecretScanningPushProtection{String("enabled")}, DependabotSecurityUpdates: &DependabotSecurityUpdates{String("enabled")}}} + want := &Repository{ID: Int64(1), Name: String("n"), Description: String("d"), Owner: &User{Login: String("l")}, License: &License{Key: String("mit")}, SecurityAndAnalysis: &SecurityAndAnalysis{AdvancedSecurity: &AdvancedSecurity{Status: String("enabled")}, SecretScanning: &SecretScanning{String("enabled")}, SecretScanningPushProtection: &SecretScanningPushProtection{String("enabled")}, DependabotSecurityUpdates: &DependabotSecurityUpdates{String("enabled")}, SecretScanningValidityChecks: &SecretScanningValidityChecks{String("enabled")}}} if !cmp.Equal(got, want) { t.Errorf("Repositories.Get returned %+v, want %+v", got, want) } From d47936fec3c94de5b655df9d9da717a7d9137ce2 Mon Sep 17 00:00:00 2001 From: Khanh Ngo Date: Fri, 15 Dec 2023 18:55:20 +0100 Subject: [PATCH 071/145] Add Referrer field to AuditEntry (#3032) Fixes: #3031. --- github/github-accessors.go | 8 ++++++++ github/github-accessors_test.go | 10 ++++++++++ github/orgs_audit_log.go | 1 + 3 files changed, 19 insertions(+) diff --git a/github/github-accessors.go b/github/github-accessors.go index 4cb34b1260a..b13ed4083ff 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -1454,6 +1454,14 @@ func (a *AuditEntry) GetReadOnly() string { return *a.ReadOnly } +// GetReferrer returns the Referrer field if it's non-nil, zero value otherwise. +func (a *AuditEntry) GetReferrer() string { + if a == nil || a.Referrer == nil { + return "" + } + return *a.Referrer +} + // GetRepo returns the Repo field if it's non-nil, zero value otherwise. func (a *AuditEntry) GetRepo() string { if a == nil || a.Repo == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index cdc27ab9966..c8bd40b5333 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -1731,6 +1731,16 @@ func TestAuditEntry_GetReadOnly(tt *testing.T) { a.GetReadOnly() } +func TestAuditEntry_GetReferrer(tt *testing.T) { + var zeroValue string + a := &AuditEntry{Referrer: &zeroValue} + a.GetReferrer() + a = &AuditEntry{} + a.GetReferrer() + a = nil + a.GetReferrer() +} + func TestAuditEntry_GetRepo(tt *testing.T) { var zeroValue string a := &AuditEntry{Repo: &zeroValue} diff --git a/github/orgs_audit_log.go b/github/orgs_audit_log.go index e3afd3117f5..aa3591359ef 100644 --- a/github/orgs_audit_log.go +++ b/github/orgs_audit_log.go @@ -95,6 +95,7 @@ type AuditEntry struct { PullRequestURL *string `json:"pull_request_url,omitempty"` ReadOnly *string `json:"read_only,omitempty"` Reasons []*PolicyOverrideReason `json:"reasons,omitempty"` + Referrer *string `json:"referrer,omitempty"` Repo *string `json:"repo,omitempty"` Repository *string `json:"repository,omitempty"` RepositoryPublic *bool `json:"repository_public,omitempty"` From 2cc47f9fa6b4d4997260c590388eecd19045c145 Mon Sep 17 00:00:00 2001 From: Rufina Talalaeva Date: Fri, 15 Dec 2023 22:20:07 +0300 Subject: [PATCH 072/145] Add code_search and dependency_snapshots for RateLimits (#3019) Fixes: #3018. --- github/github-accessors.go | 16 ++++++++ github/github-accessors_test.go | 14 +++++++ github/github.go | 14 +++++++ github/github_test.go | 10 +++++ github/rate_limit.go | 8 ++++ github/rate_limit_test.go | 68 +++++++++++++++++++++++++++++++-- 6 files changed, 127 insertions(+), 3 deletions(-) diff --git a/github/github-accessors.go b/github/github-accessors.go index b13ed4083ff..02d1212cd9b 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -17790,6 +17790,14 @@ func (r *RateLimits) GetCodeScanningUpload() *Rate { return r.CodeScanningUpload } +// GetCodeSearch returns the CodeSearch field. +func (r *RateLimits) GetCodeSearch() *Rate { + if r == nil { + return nil + } + return r.CodeSearch +} + // GetCore returns the Core field. func (r *RateLimits) GetCore() *Rate { if r == nil { @@ -17798,6 +17806,14 @@ func (r *RateLimits) GetCore() *Rate { return r.Core } +// GetDependencySnapshots returns the DependencySnapshots field. +func (r *RateLimits) GetDependencySnapshots() *Rate { + if r == nil { + return nil + } + return r.DependencySnapshots +} + // GetGraphQL returns the GraphQL field. func (r *RateLimits) GetGraphQL() *Rate { if r == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index c8bd40b5333..6ae89e454a6 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -20636,6 +20636,13 @@ func TestRateLimits_GetCodeScanningUpload(tt *testing.T) { r.GetCodeScanningUpload() } +func TestRateLimits_GetCodeSearch(tt *testing.T) { + r := &RateLimits{} + r.GetCodeSearch() + r = nil + r.GetCodeSearch() +} + func TestRateLimits_GetCore(tt *testing.T) { r := &RateLimits{} r.GetCore() @@ -20643,6 +20650,13 @@ func TestRateLimits_GetCore(tt *testing.T) { r.GetCore() } +func TestRateLimits_GetDependencySnapshots(tt *testing.T) { + r := &RateLimits{} + r.GetDependencySnapshots() + r = nil + r.GetDependencySnapshots() +} + func TestRateLimits_GetGraphQL(tt *testing.T) { r := &RateLimits{} r.GetGraphQL() diff --git a/github/github.go b/github/github.go index c248b256f6e..e41036361a8 100644 --- a/github/github.go +++ b/github/github.go @@ -1303,6 +1303,8 @@ const ( codeScanningUploadCategory actionsRunnerRegistrationCategory scimCategory + dependencySnapshotsCategory + codeSearchCategory categories // An array of this length will be able to contain all rate limit categories. ) @@ -1315,6 +1317,12 @@ func category(method, path string) rateLimitCategory { // NOTE: coreCategory is returned for actionsRunnerRegistrationCategory too, // because no API found for this category. return coreCategory + + // https://docs.github.com/en/rest/search/search#search-code + case strings.HasPrefix(path, "/search/code") && + method == http.MethodGet: + return codeSearchCategory + case strings.HasPrefix(path, "/search/"): return searchCategory case path == "/graphql": @@ -1337,6 +1345,12 @@ func category(method, path string) rateLimitCategory { // https://docs.github.com/enterprise-cloud@latest/rest/scim case strings.HasPrefix(path, "/scim/"): return scimCategory + + // https://docs.github.com/en/rest/dependency-graph/dependency-submission#create-a-snapshot-of-dependencies-for-a-repository + case strings.HasPrefix(path, "/repos/") && + strings.HasSuffix(path, "/dependency-graph/snapshots") && + method == http.MethodPost: + return dependencySnapshotsCategory } } diff --git a/github/github_test.go b/github/github_test.go index b994496cc01..933d29e7741 100644 --- a/github/github_test.go +++ b/github/github_test.go @@ -1153,6 +1153,16 @@ func TestDo_rateLimitCategory(t *testing.T) { url: "/scim/v2/organizations/ORG/Users", category: scimCategory, }, + { + method: http.MethodPost, + url: "/repos/google/go-github/dependency-graph/snapshots", + category: dependencySnapshotsCategory, + }, + { + method: http.MethodGet, + url: "/search/code?q=rate", + category: codeSearchCategory, + }, // missing a check for actionsRunnerRegistrationCategory: API not found } diff --git a/github/rate_limit.go b/github/rate_limit.go index 0fc15f815e2..febe5edccfb 100644 --- a/github/rate_limit.go +++ b/github/rate_limit.go @@ -52,6 +52,8 @@ type RateLimits struct { CodeScanningUpload *Rate `json:"code_scanning_upload"` ActionsRunnerRegistration *Rate `json:"actions_runner_registration"` SCIM *Rate `json:"scim"` + DependencySnapshots *Rate `json:"dependency_snapshots"` + CodeSearch *Rate `json:"code_search"` } func (r RateLimits) String() string { @@ -106,6 +108,12 @@ func (s *RateLimitService) Get(ctx context.Context) (*RateLimits, *Response, err if response.Resources.SCIM != nil { s.client.rateLimits[scimCategory] = *response.Resources.SCIM } + if response.Resources.DependencySnapshots != nil { + s.client.rateLimits[dependencySnapshotsCategory] = *response.Resources.DependencySnapshots + } + if response.Resources.CodeSearch != nil { + s.client.rateLimits[codeSearchCategory] = *response.Resources.CodeSearch + } s.client.rateMu.Unlock() } diff --git a/github/rate_limit_test.go b/github/rate_limit_test.go index 167288bc889..da8a68c9106 100644 --- a/github/rate_limit_test.go +++ b/github/rate_limit_test.go @@ -25,8 +25,10 @@ func TestRateLimits_String(t *testing.T) { CodeScanningUpload: &Rate{}, ActionsRunnerRegistration: &Rate{}, SCIM: &Rate{}, + DependencySnapshots: &Rate{}, + CodeSearch: &Rate{}, } - want := `github.RateLimits{Core:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, Search:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, GraphQL:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, IntegrationManifest:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, SourceImport:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, CodeScanningUpload:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, ActionsRunnerRegistration:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, SCIM:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}}` + want := `github.RateLimits{Core:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, Search:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, GraphQL:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, IntegrationManifest:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, SourceImport:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, CodeScanningUpload:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, ActionsRunnerRegistration:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, SCIM:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, DependencySnapshots:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, CodeSearch:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}}` if got := v.String(); got != want { t.Errorf("RateLimits.String = %v, want %v", got, want) } @@ -46,7 +48,9 @@ func TestRateLimits(t *testing.T) { "source_import": {"limit":6,"remaining":5,"reset":1372700877}, "code_scanning_upload": {"limit":7,"remaining":6,"reset":1372700878}, "actions_runner_registration": {"limit":8,"remaining":7,"reset":1372700879}, - "scim": {"limit":9,"remaining":8,"reset":1372700880} + "scim": {"limit":9,"remaining":8,"reset":1372700880}, + "dependency_snapshots": {"limit":10,"remaining":9,"reset":1372700881}, + "code_search": {"limit":11,"remaining":10,"reset":1372700882} }}`) }) @@ -97,6 +101,16 @@ func TestRateLimits(t *testing.T) { Remaining: 8, Reset: Timestamp{time.Date(2013, time.July, 1, 17, 48, 00, 0, time.UTC).Local()}, }, + DependencySnapshots: &Rate{ + Limit: 10, + Remaining: 9, + Reset: Timestamp{time.Date(2013, time.July, 1, 17, 48, 1, 0, time.UTC).Local()}, + }, + CodeSearch: &Rate{ + Limit: 11, + Remaining: 10, + Reset: Timestamp{time.Date(2013, time.July, 1, 17, 48, 2, 0, time.UTC).Local()}, + }, } if !cmp.Equal(rate, want) { t.Errorf("RateLimits returned %+v, want %+v", rate, want) @@ -137,6 +151,14 @@ func TestRateLimits(t *testing.T) { category: scimCategory, rate: want.SCIM, }, + { + category: dependencySnapshotsCategory, + rate: want.DependencySnapshots, + }, + { + category: codeSearchCategory, + rate: want.CodeSearch, + }, } for _, tt := range tests { @@ -177,7 +199,9 @@ func TestRateLimits_overQuota(t *testing.T) { "source_import": {"limit":6,"remaining":5,"reset":1372700877}, "code_scanning_upload": {"limit":7,"remaining":6,"reset":1372700878}, "actions_runner_registration": {"limit":8,"remaining":7,"reset":1372700879}, - "scim": {"limit":9,"remaining":8,"reset":1372700880} + "scim": {"limit":9,"remaining":8,"reset":1372700880}, + "dependency_snapshots": {"limit":10,"remaining":9,"reset":1372700881}, + "code_search": {"limit":11,"remaining":10,"reset":1372700882} }}`) }) @@ -228,6 +252,16 @@ func TestRateLimits_overQuota(t *testing.T) { Remaining: 8, Reset: Timestamp{time.Date(2013, time.July, 1, 17, 48, 00, 0, time.UTC).Local()}, }, + DependencySnapshots: &Rate{ + Limit: 10, + Remaining: 9, + Reset: Timestamp{time.Date(2013, time.July, 1, 17, 48, 1, 0, time.UTC).Local()}, + }, + CodeSearch: &Rate{ + Limit: 11, + Remaining: 10, + Reset: Timestamp{time.Date(2013, time.July, 1, 17, 48, 2, 0, time.UTC).Local()}, + }, } if !cmp.Equal(rate, want) { t.Errorf("RateLimits returned %+v, want %+v", rate, want) @@ -269,6 +303,14 @@ func TestRateLimits_overQuota(t *testing.T) { category: scimCategory, rate: want.SCIM, }, + { + category: dependencySnapshotsCategory, + rate: want.DependencySnapshots, + }, + { + category: codeSearchCategory, + rate: want.CodeSearch, + }, } for _, tt := range tests { if got, want := client.rateLimits[tt.category], *tt.rate; got != want { @@ -321,6 +363,16 @@ func TestRateLimits_Marshal(t *testing.T) { Remaining: 1, Reset: Timestamp{referenceTime}, }, + DependencySnapshots: &Rate{ + Limit: 1, + Remaining: 1, + Reset: Timestamp{referenceTime}, + }, + CodeSearch: &Rate{ + Limit: 1, + Remaining: 1, + Reset: Timestamp{referenceTime}, + }, } want := `{ @@ -363,6 +415,16 @@ func TestRateLimits_Marshal(t *testing.T) { "limit": 1, "remaining": 1, "reset": ` + referenceTimeStr + ` + }, + "dependency_snapshots": { + "limit": 1, + "remaining": 1, + "reset": ` + referenceTimeStr + ` + }, + "code_search": { + "limit": 1, + "remaining": 1, + "reset": ` + referenceTimeStr + ` } }` From 37f1826a2248f21f2affb8a37f0ba7787f5afaae Mon Sep 17 00:00:00 2001 From: Kiyofumi Sano <62272140+Kiyo510@users.noreply.github.com> Date: Sat, 16 Dec 2023 07:22:57 +0900 Subject: [PATCH 073/145] Support temporary private fork creation via API (#3025) Fixes: #3007. --- github/security_advisories.go | 31 ++ github/security_advisories_test.go | 474 ++++++++++++++++++++++++++++- 2 files changed, 501 insertions(+), 4 deletions(-) diff --git a/github/security_advisories.go b/github/security_advisories.go index 635263748d4..b5a43f1aac8 100644 --- a/github/security_advisories.go +++ b/github/security_advisories.go @@ -7,6 +7,7 @@ package github import ( "context" + "encoding/json" "fmt" ) @@ -148,6 +149,36 @@ func (s *SecurityAdvisoriesService) RequestCVE(ctx context.Context, owner, repo, return resp, nil } +// CreateTemporaryPrivateFork creates a temporary private fork to collaborate on fixing a security vulnerability in your repository. +// The ghsaID is the GitHub Security Advisory identifier of the advisory. +// +// GitHub API docs: https://docs.github.com/rest/security-advisories/repository-advisories#create-a-temporary-private-fork +// +//meta:operation POST /repos/{owner}/{repo}/security-advisories/{ghsa_id}/forks +func (s *SecurityAdvisoriesService) CreateTemporaryPrivateFork(ctx context.Context, owner, repo, ghsaID string) (*Repository, *Response, error) { + url := fmt.Sprintf("repos/%v/%v/security-advisories/%v/forks", owner, repo, ghsaID) + + req, err := s.client.NewRequest("POST", url, nil) + if err != nil { + return nil, nil, err + } + + fork := new(Repository) + resp, err := s.client.Do(ctx, req, fork) + if err != nil { + if aerr, ok := err.(*AcceptedError); ok { + if err := json.Unmarshal(aerr.Raw, fork); err != nil { + return fork, resp, err + } + + return fork, resp, err + } + return nil, resp, err + } + + return fork, resp, nil +} + // ListRepositorySecurityAdvisoriesForOrg lists the repository security advisories for an organization. // // GitHub API docs: https://docs.github.com/rest/security-advisories/repository-advisories#list-repository-security-advisories-for-an-organization diff --git a/github/security_advisories_test.go b/github/security_advisories_test.go index 918e3e05002..eb8e7d317d6 100644 --- a/github/security_advisories_test.go +++ b/github/security_advisories_test.go @@ -56,6 +56,472 @@ func TestSecurityAdvisoriesService_RequestCVE(t *testing.T) { }) } +func TestSecurityAdvisoriesService_CreateTemporaryPrivateFork(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/repos/o/r/security-advisories/ghsa_id/forks", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "POST") + fmt.Fprint(w, `{ + "id": 1, + "node_id": "R_kgDPP3c6pQ", + "owner": { + "login": "owner", + "id": 2, + "node_id": "MDQ6VXFGcjYyMjcyMTQw", + "avatar_url": "https://avatars.githubusercontent.com/u/111111?v=4", + "html_url": "https://github.com/xxxxx", + "gravatar_id": "", + "type": "User", + "site_admin": false, + "url": "https://api.github.com/users/owner", + "events_url": "https://api.github.com/users/owner/events{/privacy}", + "following_url": "https://api.github.com/users/owner/following{/other_user}", + "followers_url": "https://api.github.com/users/owner/followers", + "gists_url": "https://api.github.com/users/owner/gists{/gist_id}", + "organizations_url": "https://api.github.com/users/owner/orgs", + "received_events_url": "https://api.github.com/users/owner/received_events", + "repos_url": "https://api.github.com/users/owner/repos", + "starred_url": "https://api.github.com/users/owner/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/owner/subscriptions" + }, + "name": "repo-ghsa-xxxx-xxxx-xxxx", + "full_name": "owner/repo-ghsa-xxxx-xxxx-xxxx", + "default_branch": "master", + "created_at": "2023-12-08T17:22:41Z", + "pushed_at": "2023-12-03T11:27:08Z", + "updated_at": "2023-12-08T17:22:42Z", + "html_url": "https://github.com/owner/repo-ghsa-xxxx-xxxx-xxxx", + "clone_url": "https://github.com/owner/repo-ghsa-xxxx-xxxx-xxxx.git", + "git_url": "git://github.com/owner/repo-ghsa-xxxx-xxxx-xxxx.git", + "ssh_url": "git@github.com:owner/repo-ghsa-xxxx-xxxx-xxxx.git", + "svn_url": "https://github.com/owner/repo-ghsa-xxxx-xxxx-xxxx", + "fork": false, + "forks_count": 0, + "network_count": 0, + "open_issues_count": 0, + "open_issues": 0, + "stargazers_count": 0, + "subscribers_count": 0, + "watchers_count": 0, + "watchers": 0, + "size": 0, + "permissions": { + "admin": true, + "maintain": true, + "pull": true, + "push": true, + "triage": true + }, + "allow_forking": true, + "web_commit_signoff_required": false, + "archived": false, + "disabled": false, + "private": true, + "has_issues": false, + "has_wiki": false, + "has_pages": false, + "has_projects": false, + "has_downloads": false, + "has_discussions": false, + "is_template": false, + "url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx", + "archive_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/{archive_format}{/ref}", + "assignees_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/assignees{/user}", + "blobs_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/branches{/branch}", + "collaborators_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/comments{/number}", + "commits_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/commits{/sha}", + "compare_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/contents/{+path}", + "contributors_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/contributors", + "deployments_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/deployments", + "downloads_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/downloads", + "events_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/events", + "forks_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/forks", + "git_commits_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/git/tags{/sha}", + "hooks_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/hooks", + "issue_comment_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/issues/events{/number}", + "issues_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/issues{/number}", + "keys_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/keys{/key_id}", + "labels_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/labels{/name}", + "languages_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/languages", + "merges_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/merges", + "milestones_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/milestones{/number}", + "notifications_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/notifications{?since,all,participating}", + "pulls_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/pulls{/number}", + "releases_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/releases{/id}", + "stargazers_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/stargazers", + "statuses_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/subscribers", + "subscription_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/subscription", + "tags_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/tags", + "teams_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/teams", + "visibility": "private" + }`) + }) + + ctx := context.Background() + fork, _, err := client.SecurityAdvisories.CreateTemporaryPrivateFork(ctx, "o", "r", "ghsa_id") + if err != nil { + t.Errorf("SecurityAdvisoriesService.CreateTemporaryPrivateFork returned error: %v", err) + } + + want := &Repository{ + ID: Int64(1), + NodeID: String("R_kgDPP3c6pQ"), + Owner: &User{ + Login: String("owner"), + ID: Int64(2), + NodeID: String("MDQ6VXFGcjYyMjcyMTQw"), + AvatarURL: String("https://avatars.githubusercontent.com/u/111111?v=4"), + HTMLURL: String("https://github.com/xxxxx"), + GravatarID: String(""), + Type: String("User"), + SiteAdmin: Bool(false), + URL: String("https://api.github.com/users/owner"), + EventsURL: String("https://api.github.com/users/owner/events{/privacy}"), + FollowingURL: String("https://api.github.com/users/owner/following{/other_user}"), + FollowersURL: String("https://api.github.com/users/owner/followers"), + GistsURL: String("https://api.github.com/users/owner/gists{/gist_id}"), + OrganizationsURL: String("https://api.github.com/users/owner/orgs"), + ReceivedEventsURL: String("https://api.github.com/users/owner/received_events"), + ReposURL: String("https://api.github.com/users/owner/repos"), + StarredURL: String("https://api.github.com/users/owner/starred{/owner}{/repo}"), + SubscriptionsURL: String("https://api.github.com/users/owner/subscriptions"), + }, + Name: String("repo-ghsa-xxxx-xxxx-xxxx"), + FullName: String("owner/repo-ghsa-xxxx-xxxx-xxxx"), + DefaultBranch: String("master"), + CreatedAt: &Timestamp{time.Date(2023, time.December, 8, 17, 22, 41, 0, time.UTC)}, + PushedAt: &Timestamp{time.Date(2023, time.December, 3, 11, 27, 8, 0, time.UTC)}, + UpdatedAt: &Timestamp{time.Date(2023, time.December, 8, 17, 22, 42, 0, time.UTC)}, + HTMLURL: String("https://github.com/owner/repo-ghsa-xxxx-xxxx-xxxx"), + CloneURL: String("https://github.com/owner/repo-ghsa-xxxx-xxxx-xxxx.git"), + GitURL: String("git://github.com/owner/repo-ghsa-xxxx-xxxx-xxxx.git"), + SSHURL: String("git@github.com:owner/repo-ghsa-xxxx-xxxx-xxxx.git"), + SVNURL: String("https://github.com/owner/repo-ghsa-xxxx-xxxx-xxxx"), + Fork: Bool(false), + ForksCount: Int(0), + NetworkCount: Int(0), + OpenIssuesCount: Int(0), + OpenIssues: Int(0), + StargazersCount: Int(0), + SubscribersCount: Int(0), + WatchersCount: Int(0), + Watchers: Int(0), + Size: Int(0), + Permissions: map[string]bool{ + "admin": true, + "maintain": true, + "pull": true, + "push": true, + "triage": true, + }, + AllowForking: Bool(true), + WebCommitSignoffRequired: Bool(false), + Archived: Bool(false), + Disabled: Bool(false), + Private: Bool(true), + HasIssues: Bool(false), + HasWiki: Bool(false), + HasPages: Bool(false), + HasProjects: Bool(false), + HasDownloads: Bool(false), + HasDiscussions: Bool(false), + IsTemplate: Bool(false), + URL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx"), + ArchiveURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/{archive_format}{/ref}"), + AssigneesURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/assignees{/user}"), + BlobsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/git/blobs{/sha}"), + BranchesURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/branches{/branch}"), + CollaboratorsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/collaborators{/collaborator}"), + CommentsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/comments{/number}"), + CommitsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/commits{/sha}"), + CompareURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/compare/{base}...{head}"), + ContentsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/contents/{+path}"), + ContributorsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/contributors"), + DeploymentsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/deployments"), + DownloadsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/downloads"), + EventsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/events"), + ForksURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/forks"), + GitCommitsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/git/commits{/sha}"), + GitRefsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/git/refs{/sha}"), + GitTagsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/git/tags{/sha}"), + HooksURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/hooks"), + IssueCommentURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/issues/comments{/number}"), + IssueEventsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/issues/events{/number}"), + IssuesURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/issues{/number}"), + KeysURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/keys{/key_id}"), + LabelsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/labels{/name}"), + LanguagesURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/languages"), + MergesURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/merges"), + MilestonesURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/milestones{/number}"), + NotificationsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/notifications{?since,all,participating}"), + PullsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/pulls{/number}"), + ReleasesURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/releases{/id}"), + StargazersURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/stargazers"), + StatusesURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/statuses/{sha}"), + SubscribersURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/subscribers"), + SubscriptionURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/subscription"), + TagsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/tags"), + TeamsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/teams"), + Visibility: String("private"), + } + if !cmp.Equal(fork, want) { + t.Errorf("SecurityAdvisoriesService.CreateTemporaryPrivateFork returned %+v, want %+v", fork, want) + } + + const methodName = "CreateTemporaryPrivateFork" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.SecurityAdvisories.CreateTemporaryPrivateFork(ctx, "\n", "\n", "\n") + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.SecurityAdvisories.CreateTemporaryPrivateFork(ctx, "o", "r", "ghsa_id") + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestSecurityAdvisoriesService_CreateTemporaryPrivateFork_deferred(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/repos/o/r/security-advisories/ghsa_id/forks", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "POST") + w.WriteHeader(http.StatusAccepted) + fmt.Fprint(w, `{ + "id": 1, + "node_id": "R_kgDPP3c6pQ", + "owner": { + "login": "owner", + "id": 2, + "node_id": "MDQ6VXFGcjYyMjcyMTQw", + "avatar_url": "https://avatars.githubusercontent.com/u/111111?v=4", + "html_url": "https://github.com/xxxxx", + "gravatar_id": "", + "type": "User", + "site_admin": false, + "url": "https://api.github.com/users/owner", + "events_url": "https://api.github.com/users/owner/events{/privacy}", + "following_url": "https://api.github.com/users/owner/following{/other_user}", + "followers_url": "https://api.github.com/users/owner/followers", + "gists_url": "https://api.github.com/users/owner/gists{/gist_id}", + "organizations_url": "https://api.github.com/users/owner/orgs", + "received_events_url": "https://api.github.com/users/owner/received_events", + "repos_url": "https://api.github.com/users/owner/repos", + "starred_url": "https://api.github.com/users/owner/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/owner/subscriptions" + }, + "name": "repo-ghsa-xxxx-xxxx-xxxx", + "full_name": "owner/repo-ghsa-xxxx-xxxx-xxxx", + "default_branch": "master", + "created_at": "2023-12-08T17:22:41Z", + "pushed_at": "2023-12-03T11:27:08Z", + "updated_at": "2023-12-08T17:22:42Z", + "html_url": "https://github.com/owner/repo-ghsa-xxxx-xxxx-xxxx", + "clone_url": "https://github.com/owner/repo-ghsa-xxxx-xxxx-xxxx.git", + "git_url": "git://github.com/owner/repo-ghsa-xxxx-xxxx-xxxx.git", + "ssh_url": "git@github.com:owner/repo-ghsa-xxxx-xxxx-xxxx.git", + "svn_url": "https://github.com/owner/repo-ghsa-xxxx-xxxx-xxxx", + "fork": false, + "forks_count": 0, + "network_count": 0, + "open_issues_count": 0, + "open_issues": 0, + "stargazers_count": 0, + "subscribers_count": 0, + "watchers_count": 0, + "watchers": 0, + "size": 0, + "permissions": { + "admin": true, + "maintain": true, + "pull": true, + "push": true, + "triage": true + }, + "allow_forking": true, + "web_commit_signoff_required": false, + "archived": false, + "disabled": false, + "private": true, + "has_issues": false, + "has_wiki": false, + "has_pages": false, + "has_projects": false, + "has_downloads": false, + "has_discussions": false, + "is_template": false, + "url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx", + "archive_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/{archive_format}{/ref}", + "assignees_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/assignees{/user}", + "blobs_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/branches{/branch}", + "collaborators_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/comments{/number}", + "commits_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/commits{/sha}", + "compare_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/contents/{+path}", + "contributors_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/contributors", + "deployments_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/deployments", + "downloads_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/downloads", + "events_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/events", + "forks_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/forks", + "git_commits_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/git/tags{/sha}", + "hooks_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/hooks", + "issue_comment_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/issues/events{/number}", + "issues_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/issues{/number}", + "keys_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/keys{/key_id}", + "labels_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/labels{/name}", + "languages_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/languages", + "merges_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/merges", + "milestones_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/milestones{/number}", + "notifications_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/notifications{?since,all,participating}", + "pulls_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/pulls{/number}", + "releases_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/releases{/id}", + "stargazers_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/stargazers", + "statuses_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/subscribers", + "subscription_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/subscription", + "tags_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/tags", + "teams_url": "https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/teams", + "visibility": "private" + }`) + }) + + ctx := context.Background() + fork, _, err := client.SecurityAdvisories.CreateTemporaryPrivateFork(ctx, "o", "r", "ghsa_id") + if _, ok := err.(*AcceptedError); !ok { + t.Errorf("SecurityAdvisoriesService.CreateTemporaryPrivateFork returned error: %v (want AcceptedError)", err) + } + + want := &Repository{ + ID: Int64(1), + NodeID: String("R_kgDPP3c6pQ"), + Owner: &User{ + Login: String("owner"), + ID: Int64(2), + NodeID: String("MDQ6VXFGcjYyMjcyMTQw"), + AvatarURL: String("https://avatars.githubusercontent.com/u/111111?v=4"), + HTMLURL: String("https://github.com/xxxxx"), + GravatarID: String(""), + Type: String("User"), + SiteAdmin: Bool(false), + URL: String("https://api.github.com/users/owner"), + EventsURL: String("https://api.github.com/users/owner/events{/privacy}"), + FollowingURL: String("https://api.github.com/users/owner/following{/other_user}"), + FollowersURL: String("https://api.github.com/users/owner/followers"), + GistsURL: String("https://api.github.com/users/owner/gists{/gist_id}"), + OrganizationsURL: String("https://api.github.com/users/owner/orgs"), + ReceivedEventsURL: String("https://api.github.com/users/owner/received_events"), + ReposURL: String("https://api.github.com/users/owner/repos"), + StarredURL: String("https://api.github.com/users/owner/starred{/owner}{/repo}"), + SubscriptionsURL: String("https://api.github.com/users/owner/subscriptions"), + }, + Name: String("repo-ghsa-xxxx-xxxx-xxxx"), + FullName: String("owner/repo-ghsa-xxxx-xxxx-xxxx"), + DefaultBranch: String("master"), + CreatedAt: &Timestamp{time.Date(2023, time.December, 8, 17, 22, 41, 0, time.UTC)}, + PushedAt: &Timestamp{time.Date(2023, time.December, 3, 11, 27, 8, 0, time.UTC)}, + UpdatedAt: &Timestamp{time.Date(2023, time.December, 8, 17, 22, 42, 0, time.UTC)}, + HTMLURL: String("https://github.com/owner/repo-ghsa-xxxx-xxxx-xxxx"), + CloneURL: String("https://github.com/owner/repo-ghsa-xxxx-xxxx-xxxx.git"), + GitURL: String("git://github.com/owner/repo-ghsa-xxxx-xxxx-xxxx.git"), + SSHURL: String("git@github.com:owner/repo-ghsa-xxxx-xxxx-xxxx.git"), + SVNURL: String("https://github.com/owner/repo-ghsa-xxxx-xxxx-xxxx"), + Fork: Bool(false), + ForksCount: Int(0), + NetworkCount: Int(0), + OpenIssuesCount: Int(0), + OpenIssues: Int(0), + StargazersCount: Int(0), + SubscribersCount: Int(0), + WatchersCount: Int(0), + Watchers: Int(0), + Size: Int(0), + Permissions: map[string]bool{ + "admin": true, + "maintain": true, + "pull": true, + "push": true, + "triage": true, + }, + AllowForking: Bool(true), + WebCommitSignoffRequired: Bool(false), + Archived: Bool(false), + Disabled: Bool(false), + Private: Bool(true), + HasIssues: Bool(false), + HasWiki: Bool(false), + HasPages: Bool(false), + HasProjects: Bool(false), + HasDownloads: Bool(false), + HasDiscussions: Bool(false), + IsTemplate: Bool(false), + URL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx"), + ArchiveURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/{archive_format}{/ref}"), + AssigneesURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/assignees{/user}"), + BlobsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/git/blobs{/sha}"), + BranchesURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/branches{/branch}"), + CollaboratorsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/collaborators{/collaborator}"), + CommentsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/comments{/number}"), + CommitsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/commits{/sha}"), + CompareURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/compare/{base}...{head}"), + ContentsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/contents/{+path}"), + ContributorsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/contributors"), + DeploymentsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/deployments"), + DownloadsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/downloads"), + EventsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/events"), + ForksURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/forks"), + GitCommitsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/git/commits{/sha}"), + GitRefsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/git/refs{/sha}"), + GitTagsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/git/tags{/sha}"), + HooksURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/hooks"), + IssueCommentURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/issues/comments{/number}"), + IssueEventsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/issues/events{/number}"), + IssuesURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/issues{/number}"), + KeysURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/keys{/key_id}"), + LabelsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/labels{/name}"), + LanguagesURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/languages"), + MergesURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/merges"), + MilestonesURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/milestones{/number}"), + NotificationsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/notifications{?since,all,participating}"), + PullsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/pulls{/number}"), + ReleasesURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/releases{/id}"), + StargazersURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/stargazers"), + StatusesURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/statuses/{sha}"), + SubscribersURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/subscribers"), + SubscriptionURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/subscription"), + TagsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/tags"), + TeamsURL: String("https://api.github.com/repos/owner/repo-ghsa-xxxx-xxxx-xxxx/teams"), + Visibility: String("private"), + } + if !cmp.Equal(fork, want) { + t.Errorf("SecurityAdvisoriesService.CreateTemporaryPrivateFork returned %+v, want %+v", fork, want) + } +} + +func TestSecurityAdvisoriesService_CreateTemporaryPrivateFork_invalidOwner(t *testing.T) { + client, _, _, teardown := setup() + defer teardown() + + ctx := context.Background() + _, _, err := client.SecurityAdvisories.CreateTemporaryPrivateFork(ctx, "%", "r", "ghsa_id") + testURLParseError(t, err) +} + func TestSecurityAdvisoriesService_ListRepositorySecurityAdvisoriesForOrg_BadRequest(t *testing.T) { client, mux, _, teardown := setup() defer teardown() @@ -146,8 +612,8 @@ func TestSecurityAdvisoriesService_ListRepositorySecurityAdvisoriesForOrg(t *tes assertWrite(t, w, []byte(`[ { "ghsa_id": "GHSA-abcd-1234-efgh", - "cve_id": "CVE-2050-00000" - } + "cve_id": "CVE-2050-00000" + } ]`)) }) @@ -277,8 +743,8 @@ func TestSecurityAdvisoriesService_ListRepositorySecurityAdvisories(t *testing.T assertWrite(t, w, []byte(`[ { "ghsa_id": "GHSA-abcd-1234-efgh", - "cve_id": "CVE-2050-00000" - } + "cve_id": "CVE-2050-00000" + } ]`)) }) From ee55955a121f80d3dcdf28faf92005b5e3df13fe Mon Sep 17 00:00:00 2001 From: Benjamin Nater Date: Sat, 16 Dec 2023 02:01:49 +0100 Subject: [PATCH 074/145] Escape package names to support names which include a slash (#3002) --- github/orgs_packages.go | 29 ++++++++--- github/orgs_packages_test.go | 95 +++++++++++++++++++++--------------- 2 files changed, 79 insertions(+), 45 deletions(-) diff --git a/github/orgs_packages.go b/github/orgs_packages.go index 4fb9a63b428..edd8e508fb4 100644 --- a/github/orgs_packages.go +++ b/github/orgs_packages.go @@ -8,6 +8,7 @@ package github import ( "context" "fmt" + "net/url" ) // ListPackages lists the packages for an organization. @@ -38,11 +39,13 @@ func (s *OrganizationsService) ListPackages(ctx context.Context, org string, opt // GetPackage gets a package by name from an organization. // +// Note that packageName is escaped for the URL path so that you don't need to. +// // GitHub API docs: https://docs.github.com/rest/packages/packages#get-a-package-for-an-organization // //meta:operation GET /orgs/{org}/packages/{package_type}/{package_name} func (s *OrganizationsService) GetPackage(ctx context.Context, org, packageType, packageName string) (*Package, *Response, error) { - u := fmt.Sprintf("orgs/%v/packages/%v/%v", org, packageType, packageName) + u := fmt.Sprintf("orgs/%v/packages/%v/%v", org, packageType, url.PathEscape(packageName)) req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err @@ -59,11 +62,13 @@ func (s *OrganizationsService) GetPackage(ctx context.Context, org, packageType, // DeletePackage deletes a package from an organization. // +// Note that packageName is escaped for the URL path so that you don't need to. +// // GitHub API docs: https://docs.github.com/rest/packages/packages#delete-a-package-for-an-organization // //meta:operation DELETE /orgs/{org}/packages/{package_type}/{package_name} func (s *OrganizationsService) DeletePackage(ctx context.Context, org, packageType, packageName string) (*Response, error) { - u := fmt.Sprintf("orgs/%v/packages/%v/%v", org, packageType, packageName) + u := fmt.Sprintf("orgs/%v/packages/%v/%v", org, packageType, url.PathEscape(packageName)) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { return nil, err @@ -74,11 +79,13 @@ func (s *OrganizationsService) DeletePackage(ctx context.Context, org, packageTy // RestorePackage restores a package to an organization. // +// Note that packageName is escaped for the URL path so that you don't need to. +// // GitHub API docs: https://docs.github.com/rest/packages/packages#restore-a-package-for-an-organization // //meta:operation POST /orgs/{org}/packages/{package_type}/{package_name}/restore func (s *OrganizationsService) RestorePackage(ctx context.Context, org, packageType, packageName string) (*Response, error) { - u := fmt.Sprintf("orgs/%v/packages/%v/%v/restore", org, packageType, packageName) + u := fmt.Sprintf("orgs/%v/packages/%v/%v/restore", org, packageType, url.PathEscape(packageName)) req, err := s.client.NewRequest("POST", u, nil) if err != nil { return nil, err @@ -89,11 +96,13 @@ func (s *OrganizationsService) RestorePackage(ctx context.Context, org, packageT // PackageGetAllVersions gets all versions of a package in an organization. // +// Note that packageName is escaped for the URL path so that you don't need to. +// // GitHub API docs: https://docs.github.com/rest/packages/packages#list-package-versions-for-a-package-owned-by-an-organization // //meta:operation GET /orgs/{org}/packages/{package_type}/{package_name}/versions func (s *OrganizationsService) PackageGetAllVersions(ctx context.Context, org, packageType, packageName string, opts *PackageListOptions) ([]*PackageVersion, *Response, error) { - u := fmt.Sprintf("orgs/%v/packages/%v/%v/versions", org, packageType, packageName) + u := fmt.Sprintf("orgs/%v/packages/%v/%v/versions", org, packageType, url.PathEscape(packageName)) u, err := addOptions(u, opts) if err != nil { return nil, nil, err @@ -115,11 +124,13 @@ func (s *OrganizationsService) PackageGetAllVersions(ctx context.Context, org, p // PackageGetVersion gets a specific version of a package in an organization. // +// Note that packageName is escaped for the URL path so that you don't need to. +// // GitHub API docs: https://docs.github.com/rest/packages/packages#get-a-package-version-for-an-organization // //meta:operation GET /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id} func (s *OrganizationsService) PackageGetVersion(ctx context.Context, org, packageType, packageName string, packageVersionID int64) (*PackageVersion, *Response, error) { - u := fmt.Sprintf("orgs/%v/packages/%v/%v/versions/%v", org, packageType, packageName, packageVersionID) + u := fmt.Sprintf("orgs/%v/packages/%v/%v/versions/%v", org, packageType, url.PathEscape(packageName), packageVersionID) req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err @@ -136,11 +147,13 @@ func (s *OrganizationsService) PackageGetVersion(ctx context.Context, org, packa // PackageDeleteVersion deletes a package version from an organization. // +// Note that packageName is escaped for the URL path so that you don't need to. +// // GitHub API docs: https://docs.github.com/rest/packages/packages#delete-package-version-for-an-organization // //meta:operation DELETE /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id} func (s *OrganizationsService) PackageDeleteVersion(ctx context.Context, org, packageType, packageName string, packageVersionID int64) (*Response, error) { - u := fmt.Sprintf("orgs/%v/packages/%v/%v/versions/%v", org, packageType, packageName, packageVersionID) + u := fmt.Sprintf("orgs/%v/packages/%v/%v/versions/%v", org, packageType, url.PathEscape(packageName), packageVersionID) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { return nil, err @@ -151,11 +164,13 @@ func (s *OrganizationsService) PackageDeleteVersion(ctx context.Context, org, pa // PackageRestoreVersion restores a package version to an organization. // +// Note that packageName is escaped for the URL path so that you don't need to. +// // GitHub API docs: https://docs.github.com/rest/packages/packages#restore-package-version-for-an-organization // //meta:operation POST /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}/restore func (s *OrganizationsService) PackageRestoreVersion(ctx context.Context, org, packageType, packageName string, packageVersionID int64) (*Response, error) { - u := fmt.Sprintf("orgs/%v/packages/%v/%v/versions/%v/restore", org, packageType, packageName, packageVersionID) + u := fmt.Sprintf("orgs/%v/packages/%v/%v/versions/%v/restore", org, packageType, url.PathEscape(packageName), packageVersionID) req, err := s.client.NewRequest("POST", u, nil) if err != nil { return nil, err diff --git a/github/orgs_packages_test.go b/github/orgs_packages_test.go index f8c8701d300..097cae76282 100644 --- a/github/orgs_packages_test.go +++ b/github/orgs_packages_test.go @@ -7,7 +7,7 @@ package github import ( "context" - "fmt" + "io" "net/http" "testing" @@ -20,7 +20,7 @@ func TestOrganizationsService_ListPackages(t *testing.T) { mux.HandleFunc("/orgs/o/packages", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - fmt.Fprint(w, `[{ + _, err := io.WriteString(w, `[{ "id": 197, "name": "hello_docker", "package_type": "container", @@ -52,6 +52,9 @@ func TestOrganizationsService_ListPackages(t *testing.T) { "html_url": "https://github.com/orgs/github/packages/container/package/hello_docker" } ]`) + if err != nil { + t.Fatal("Failed to write test response: ", err) + } }) ctx := context.Background() @@ -114,35 +117,39 @@ func TestOrganizationsService_GetPackage(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - mux.HandleFunc("/orgs/o/packages/container/hello_docker", func(w http.ResponseWriter, r *http.Request) { + // don't url escape the package name here since mux will convert it to a slash automatically + mux.HandleFunc("/orgs/o/packages/container/hello/hello_docker", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - fmt.Fprint(w, `{ + _, err := io.WriteString(w, `{ "id": 197, - "name": "hello_docker", + "name": "hello/hello_docker", "package_type": "container", "version_count": 1, "visibility": "private", - "url": "https://api.github.com/orgs/github/packages/container/hello_docker", + "url": "https://api.github.com/orgs/github/packages/container/hello%2Fhello_docker", "created_at": `+referenceTimeStr+`, "updated_at": `+referenceTimeStr+`, - "html_url": "https://github.com/orgs/github/packages/container/package/hello_docker" + "html_url": "https://github.com/orgs/github/packages/container/package/hello%2Fhello_docker" }`) + if err != nil { + t.Fatal("Failed to write test response: ", err) + } }) ctx := context.Background() - packages, _, err := client.Organizations.GetPackage(ctx, "o", "container", "hello_docker") + packages, _, err := client.Organizations.GetPackage(ctx, "o", "container", "hello/hello_docker") if err != nil { t.Errorf("Organizations.GetPackage returned error: %v", err) } want := &Package{ ID: Int64(197), - Name: String("hello_docker"), + Name: String("hello/hello_docker"), PackageType: String("container"), VersionCount: Int64(1), Visibility: String("private"), - URL: String("https://api.github.com/orgs/github/packages/container/hello_docker"), - HTMLURL: String("https://github.com/orgs/github/packages/container/package/hello_docker"), + URL: String("https://api.github.com/orgs/github/packages/container/hello%2Fhello_docker"), + HTMLURL: String("https://github.com/orgs/github/packages/container/package/hello%2Fhello_docker"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, } @@ -169,12 +176,13 @@ func TestOrganizationsService_DeletePackage(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - mux.HandleFunc("/orgs/o/packages/container/hello_docker", func(w http.ResponseWriter, r *http.Request) { + // don't url escape the package name here since mux will convert it to a slash automatically + mux.HandleFunc("/orgs/o/packages/container/hello/hello_docker", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) ctx := context.Background() - _, err := client.Organizations.DeletePackage(ctx, "o", "container", "hello_docker") + _, err := client.Organizations.DeletePackage(ctx, "o", "container", "hello/hello_docker") if err != nil { t.Errorf("Organizations.DeletePackage returned error: %v", err) } @@ -198,12 +206,13 @@ func TestOrganizationsService_RestorePackage(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - mux.HandleFunc("/orgs/o/packages/container/hello_docker/restore", func(w http.ResponseWriter, r *http.Request) { + // don't url escape the package name here since mux will convert it to a slash automatically + mux.HandleFunc("/orgs/o/packages/container/hello/hello_docker/restore", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") }) ctx := context.Background() - _, err := client.Organizations.RestorePackage(ctx, "o", "container", "hello_docker") + _, err := client.Organizations.RestorePackage(ctx, "o", "container", "hello/hello_docker") if err != nil { t.Errorf("Organizations.RestorePackage returned error: %v", err) } @@ -215,7 +224,7 @@ func TestOrganizationsService_RestorePackage(t *testing.T) { }) testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - return client.Organizations.RestorePackage(ctx, "", "container", "hello_docker") + return client.Organizations.RestorePackage(ctx, "", "container", "hello/hello_docker") }) } @@ -223,18 +232,19 @@ func TestOrganizationsService_ListPackagesVersions(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - mux.HandleFunc("/orgs/o/packages/container/hello_docker/versions", func(w http.ResponseWriter, r *http.Request) { + // don't url escape the package name here since mux will convert it to a slash automatically + mux.HandleFunc("/orgs/o/packages/container/hello/hello_docker/versions", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") testFormValues(t, r, values{"per_page": "2", "page": "1", "state": "deleted", "visibility": "internal", "package_type": "container"}) - fmt.Fprint(w, `[ + _, err := io.WriteString(w, `[ { "id": 45763, "name": "sha256:08a44bab0bddaddd8837a8b381aebc2e4b933768b981685a9e088360af0d3dd9", - "url": "https://api.github.com/users/octocat/packages/container/hello_docker/versions/45763", - "package_html_url": "https://github.com/users/octocat/packages/container/package/hello_docker", + "url": "https://api.github.com/users/octocat/packages/container/hello%2Fhello_docker/versions/45763", + "package_html_url": "https://github.com/users/octocat/packages/container/package/hello%2Fhello_docker", "created_at": `+referenceTimeStr+`, "updated_at": `+referenceTimeStr+`, - "html_url": "https://github.com/users/octocat/packages/container/hello_docker/45763", + "html_url": "https://github.com/users/octocat/packages/container/hello%2Fhello_docker/45763", "metadata": { "package_type": "container", "container": { @@ -244,13 +254,16 @@ func TestOrganizationsService_ListPackagesVersions(t *testing.T) { } } }]`) + if err != nil { + t.Fatal("Failed to write test response: ", err) + } }) ctx := context.Background() opts := &PackageListOptions{ String("internal"), String("container"), String("deleted"), ListOptions{Page: 1, PerPage: 2}, } - packages, _, err := client.Organizations.PackageGetAllVersions(ctx, "o", "container", "hello_docker", opts) + packages, _, err := client.Organizations.PackageGetAllVersions(ctx, "o", "container", "hello/hello_docker", opts) if err != nil { t.Errorf("Organizations.PackageGetAllVersions returned error: %v", err) } @@ -258,11 +271,11 @@ func TestOrganizationsService_ListPackagesVersions(t *testing.T) { want := []*PackageVersion{{ ID: Int64(45763), Name: String("sha256:08a44bab0bddaddd8837a8b381aebc2e4b933768b981685a9e088360af0d3dd9"), - URL: String("https://api.github.com/users/octocat/packages/container/hello_docker/versions/45763"), - PackageHTMLURL: String("https://github.com/users/octocat/packages/container/package/hello_docker"), + URL: String("https://api.github.com/users/octocat/packages/container/hello%2Fhello_docker/versions/45763"), + PackageHTMLURL: String("https://github.com/users/octocat/packages/container/package/hello%2Fhello_docker"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HTMLURL: String("https://github.com/users/octocat/packages/container/hello_docker/45763"), + HTMLURL: String("https://github.com/users/octocat/packages/container/hello%2Fhello_docker/45763"), Metadata: &PackageMetadata{ PackageType: String("container"), Container: &PackageContainerMetadata{ @@ -293,17 +306,18 @@ func TestOrganizationsService_PackageGetVersion(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - mux.HandleFunc("/orgs/o/packages/container/hello_docker/versions/45763", func(w http.ResponseWriter, r *http.Request) { + // don't url escape the package name here since mux will convert it to a slash automatically + mux.HandleFunc("/orgs/o/packages/container/hello/hello_docker/versions/45763", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - fmt.Fprint(w, ` + _, err := io.WriteString(w, ` { "id": 45763, "name": "sha256:08a44bab0bddaddd8837a8b381aebc2e4b933768b981685a9e088360af0d3dd9", - "url": "https://api.github.com/users/octocat/packages/container/hello_docker/versions/45763", - "package_html_url": "https://github.com/users/octocat/packages/container/package/hello_docker", + "url": "https://api.github.com/users/octocat/packages/container/hello%2Fhello_docker/versions/45763", + "package_html_url": "https://github.com/users/octocat/packages/container/package/hello%2Fhello_docker", "created_at": `+referenceTimeStr+`, "updated_at": `+referenceTimeStr+`, - "html_url": "https://github.com/users/octocat/packages/container/hello_docker/45763", + "html_url": "https://github.com/users/octocat/packages/container/hello%2Fhello_docker/45763", "metadata": { "package_type": "container", "container": { @@ -313,10 +327,13 @@ func TestOrganizationsService_PackageGetVersion(t *testing.T) { } } }`) + if err != nil { + t.Fatal("Failed to write test response: ", err) + } }) ctx := context.Background() - packages, _, err := client.Organizations.PackageGetVersion(ctx, "o", "container", "hello_docker", 45763) + packages, _, err := client.Organizations.PackageGetVersion(ctx, "o", "container", "hello/hello_docker", 45763) if err != nil { t.Errorf("Organizations.PackageGetVersion returned error: %v", err) } @@ -324,11 +341,11 @@ func TestOrganizationsService_PackageGetVersion(t *testing.T) { want := &PackageVersion{ ID: Int64(45763), Name: String("sha256:08a44bab0bddaddd8837a8b381aebc2e4b933768b981685a9e088360af0d3dd9"), - URL: String("https://api.github.com/users/octocat/packages/container/hello_docker/versions/45763"), - PackageHTMLURL: String("https://github.com/users/octocat/packages/container/package/hello_docker"), + URL: String("https://api.github.com/users/octocat/packages/container/hello%2Fhello_docker/versions/45763"), + PackageHTMLURL: String("https://github.com/users/octocat/packages/container/package/hello%2Fhello_docker"), CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, - HTMLURL: String("https://github.com/users/octocat/packages/container/hello_docker/45763"), + HTMLURL: String("https://github.com/users/octocat/packages/container/hello%2Fhello_docker/45763"), Metadata: &PackageMetadata{ PackageType: String("container"), Container: &PackageContainerMetadata{ @@ -359,12 +376,13 @@ func TestOrganizationsService_PackageDeleteVersion(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - mux.HandleFunc("/orgs/o/packages/container/hello_docker/versions/45763", func(w http.ResponseWriter, r *http.Request) { + // don't url escape the package name here since mux will convert it to a slash automatically + mux.HandleFunc("/orgs/o/packages/container/hello/hello_docker/versions/45763", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) ctx := context.Background() - _, err := client.Organizations.PackageDeleteVersion(ctx, "o", "container", "hello_docker", 45763) + _, err := client.Organizations.PackageDeleteVersion(ctx, "o", "container", "hello/hello_docker", 45763) if err != nil { t.Errorf("Organizations.PackageDeleteVersion returned error: %v", err) } @@ -384,12 +402,13 @@ func TestOrganizationsService_PackageRestoreVersion(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - mux.HandleFunc("/orgs/o/packages/container/hello_docker/versions/45763/restore", func(w http.ResponseWriter, r *http.Request) { + // don't url escape the package name here since mux will convert it to a slash automatically + mux.HandleFunc("/orgs/o/packages/container/hello/hello_docker/versions/45763/restore", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") }) ctx := context.Background() - _, err := client.Organizations.PackageRestoreVersion(ctx, "o", "container", "hello_docker", 45763) + _, err := client.Organizations.PackageRestoreVersion(ctx, "o", "container", "hello/hello_docker", 45763) if err != nil { t.Errorf("Organizations.PackageRestoreVersion returned error: %v", err) } From 6d3dfc616349d61e32cac97a82415d4205926d7a Mon Sep 17 00:00:00 2001 From: WillAbides <233500+WillAbides@users.noreply.github.com> Date: Fri, 15 Dec 2023 19:07:07 -0600 Subject: [PATCH 075/145] Don't update httpClient passed to NewClient (#3011) --- github/github.go | 8 ++++++- github/github_test.go | 51 +++++++++++++++++++++++++++++-------------- 2 files changed, 42 insertions(+), 17 deletions(-) diff --git a/github/github.go b/github/github.go index e41036361a8..da4f2d067ee 100644 --- a/github/github.go +++ b/github/github.go @@ -220,6 +220,8 @@ type service struct { } // Client returns the http.Client used by this GitHub client. +// This should only be used for requests to the GitHub API because +// request headers will contain an authorization token. func (c *Client) Client() *http.Client { c.clientMu.Lock() defer c.clientMu.Unlock() @@ -315,7 +317,11 @@ func addOptions(s string, opts interface{}) (string, error) { // an http.Client that will perform the authentication for you (such as that // provided by the golang.org/x/oauth2 library). func NewClient(httpClient *http.Client) *Client { - c := &Client{client: httpClient} + if httpClient == nil { + httpClient = &http.Client{} + } + httpClient2 := *httpClient + c := &Client{client: &httpClient2} c.initialize() return c } diff --git a/github/github_test.go b/github/github_test.go index 933d29e7741..4d672f6096f 100644 --- a/github/github_test.go +++ b/github/github_test.go @@ -321,26 +321,45 @@ func TestClient(t *testing.T) { func TestWithAuthToken(t *testing.T) { token := "gh_test_token" - var gotAuthHeaderVals []string - wantAuthHeaderVals := []string{"Bearer " + token} - srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - gotAuthHeaderVals = r.Header["Authorization"] - })) - validate := func(c *Client) { + + validate := func(t *testing.T, c *http.Client, token string) { t.Helper() - gotAuthHeaderVals = nil - _, err := c.Client().Get(srv.URL) - if err != nil { - t.Fatalf("Get returned unexpected error: %v", err) + want := token + if want != "" { + want = "Bearer " + want + } + gotReq := false + headerVal := "" + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + gotReq = true + headerVal = r.Header.Get("Authorization") + })) + _, err := c.Get(srv.URL) + assertNilError(t, err) + if !gotReq { + t.Error("request not sent") } - diff := cmp.Diff(wantAuthHeaderVals, gotAuthHeaderVals) - if diff != "" { - t.Errorf("Authorization header values mismatch (-want +got):\n%s", diff) + if headerVal != want { + t.Errorf("Authorization header is %v, want %v", headerVal, want) } } - validate(NewClient(nil).WithAuthToken(token)) - validate(new(Client).WithAuthToken(token)) - validate(NewTokenClient(context.Background(), token)) + + t.Run("zero-value Client", func(t *testing.T) { + c := new(Client).WithAuthToken(token) + validate(t, c.Client(), token) + }) + + t.Run("NewClient", func(t *testing.T) { + httpClient := &http.Client{} + client := NewClient(httpClient).WithAuthToken(token) + validate(t, client.Client(), token) + // make sure the original client isn't setting auth headers now + validate(t, httpClient, "") + }) + + t.Run("NewTokenClient", func(t *testing.T) { + validate(t, NewTokenClient(context.Background(), token).Client(), token) + }) } func TestWithEnterpriseURLs(t *testing.T) { From 005e6c884528e50ce94914b2e07e1a580e4f5836 Mon Sep 17 00:00:00 2001 From: Daniel Liao <10663736+liaodaniel@users.noreply.github.com> Date: Mon, 18 Dec 2023 06:46:23 +1100 Subject: [PATCH 076/145] Add GetAllCustomPropertyValues for repositories (#3020) Fixes: #3014. --- github/repos_properties.go | 33 +++++++++++++++++ github/repos_properties_test.go | 65 +++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 github/repos_properties.go create mode 100644 github/repos_properties_test.go diff --git a/github/repos_properties.go b/github/repos_properties.go new file mode 100644 index 00000000000..5a8626c4530 --- /dev/null +++ b/github/repos_properties.go @@ -0,0 +1,33 @@ +// Copyright 2023 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// GetAllCustomPropertyValues gets all custom property values that are set for a repository. +// +// GitHub API docs: https://docs.github.com/rest/repos/custom-properties#get-all-custom-property-values-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/properties/values +func (s *RepositoriesService) GetAllCustomPropertyValues(ctx context.Context, org, repo string) ([]*CustomPropertyValue, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/properties/values", org, repo) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var customPropertyValues []*CustomPropertyValue + resp, err := s.client.Do(ctx, req, &customPropertyValues) + if err != nil { + return nil, resp, err + } + + return customPropertyValues, resp, nil +} diff --git a/github/repos_properties_test.go b/github/repos_properties_test.go new file mode 100644 index 00000000000..ee231a138c6 --- /dev/null +++ b/github/repos_properties_test.go @@ -0,0 +1,65 @@ +// Copyright 2023 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" + "net/http" + "testing" + + "github.com/google/go-cmp/cmp" +) + +func TestRepositoriesService_GetAllCustomPropertyValues(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/repos/o/r/properties/values", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + fmt.Fprint(w, `[ + { + "property_name": "environment", + "value": "production" + }, + { + "property_name": "service", + "value": "web" + } + ]`) + }) + + ctx := context.Background() + customPropertyValues, _, err := client.Repositories.GetAllCustomPropertyValues(ctx, "o", "r") + if err != nil { + t.Errorf("Repositories.GetAllCustomPropertyValues returned error: %v", err) + } + + want := []*CustomPropertyValue{ + { + PropertyName: "environment", + Value: String("production"), + }, + { + PropertyName: "service", + Value: String("web"), + }, + } + + if !cmp.Equal(customPropertyValues, want) { + t.Errorf("Repositories.GetAllCustomPropertyValues returned %+v, want %+v", customPropertyValues, want) + } + + const methodName = "GetAllCustomPropertyValues" + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Repositories.GetAllCustomPropertyValues(ctx, "o", "r") + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} From a354a6c890321a8b4736be0ab7713582a4e26b21 Mon Sep 17 00:00:00 2001 From: WillAbides <233500+WillAbides@users.noreply.github.com> Date: Sun, 17 Dec 2023 19:38:55 -0600 Subject: [PATCH 077/145] Remove ambiguous fields from AuditEntry (#3017) Fixes: #3016. --- github/enterprise_audit_log_test.go | 43 +- github/github-accessors.go | 524 +--------------------- github/github-accessors_test.go | 645 +--------------------------- github/github_test.go | 7 + github/orgs_audit_log.go | 177 ++++---- github/orgs_audit_log_test.go | 322 +++++++------- test/integration/audit_log_test.go | 2 +- 7 files changed, 308 insertions(+), 1412 deletions(-) diff --git a/github/enterprise_audit_log_test.go b/github/enterprise_audit_log_test.go index 2e91346ebf3..0d9e44a3eb6 100644 --- a/github/enterprise_audit_log_test.go +++ b/github/enterprise_audit_log_test.go @@ -11,8 +11,6 @@ import ( "net/http" "testing" "time" - - "github.com/google/go-cmp/cmp" ) func TestEnterpriseService_GetAuditLog(t *testing.T) { @@ -54,34 +52,31 @@ func TestEnterpriseService_GetAuditLog(t *testing.T) { if err != nil { t.Errorf("Enterprise.GetAuditLog returned error: %v", err) } - startedAt, _ := time.Parse(time.RFC3339, "2021-03-07T00:33:04.000Z") - completedAt, _ := time.Parse(time.RFC3339, "2021-03-07T00:35:08.000Z") timestamp := time.Unix(0, 1615077308538*1e6) - want := []*AuditEntry{ { - Timestamp: &Timestamp{timestamp}, - DocumentID: String("beeZYapIUe-wKg5-beadb33"), - Action: String("workflows.completed_workflow_run"), - Actor: String("testactor"), - CompletedAt: &Timestamp{completedAt}, - Conclusion: String("success"), - CreatedAt: &Timestamp{timestamp}, - Event: String("schedule"), - HeadBranch: String("master"), - HeadSHA: String("5acdeadbeef64d1a62388e901e5cdc9358644b37"), - Name: String("Code scanning - action"), - Org: String("o"), - Repo: String("o/blue-crayon-1"), - StartedAt: &Timestamp{startedAt}, - WorkflowID: Int64(123456), - WorkflowRunID: Int64(628312345), + Timestamp: &Timestamp{timestamp}, + DocumentID: String("beeZYapIUe-wKg5-beadb33"), + Action: String("workflows.completed_workflow_run"), + Actor: String("testactor"), + CreatedAt: &Timestamp{timestamp}, + Org: String("o"), + AdditionalFields: map[string]interface{}{ + "completed_at": "2021-03-07T00:35:08.000Z", + "conclusion": "success", + "event": "schedule", + "head_branch": "master", + "head_sha": "5acdeadbeef64d1a62388e901e5cdc9358644b37", + "name": "Code scanning - action", + "repo": "o/blue-crayon-1", + "started_at": "2021-03-07T00:33:04.000Z", + "workflow_id": float64(123456), + "workflow_run_id": float64(628312345), + }, }, } - if !cmp.Equal(auditEntries, want) { - t.Errorf("Enterprise.GetAuditLog return \ngot: %+v,\nwant:%+v", auditEntries, want) - } + assertNoDiff(t, want, auditEntries) const methodName = "GetAuditLog" testBadOptions(t, methodName, func() (err error) { diff --git a/github/github-accessors.go b/github/github-accessors.go index 02d1212cd9b..f41409f9e6c 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -1070,22 +1070,6 @@ func (a *AuditEntry) GetAction() string { return *a.Action } -// GetActive returns the Active field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetActive() bool { - if a == nil || a.Active == nil { - return false - } - return *a.Active -} - -// GetActiveWas returns the ActiveWas field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetActiveWas() bool { - if a == nil || a.ActiveWas == nil { - return false - } - return *a.ActiveWas -} - // GetActor returns the Actor field if it's non-nil, zero value otherwise. func (a *AuditEntry) GetActor() string { if a == nil || a.Actor == nil { @@ -1094,12 +1078,12 @@ func (a *AuditEntry) GetActor() string { return *a.Actor } -// GetActorIP returns the ActorIP field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetActorIP() string { - if a == nil || a.ActorIP == nil { - return "" +// GetActorID returns the ActorID field if it's non-nil, zero value otherwise. +func (a *AuditEntry) GetActorID() int64 { + if a == nil || a.ActorID == nil { + return 0 } - return *a.ActorIP + return *a.ActorID } // GetActorLocation returns the ActorLocation field. @@ -1110,14 +1094,6 @@ func (a *AuditEntry) GetActorLocation() *ActorLocation { return a.ActorLocation } -// GetBlockedUser returns the BlockedUser field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetBlockedUser() string { - if a == nil || a.BlockedUser == nil { - return "" - } - return *a.BlockedUser -} - // GetBusiness returns the Business field if it's non-nil, zero value otherwise. func (a *AuditEntry) GetBusiness() string { if a == nil || a.Business == nil { @@ -1126,52 +1102,12 @@ func (a *AuditEntry) GetBusiness() string { return *a.Business } -// GetCancelledAt returns the CancelledAt field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetCancelledAt() Timestamp { - if a == nil || a.CancelledAt == nil { - return Timestamp{} - } - return *a.CancelledAt -} - -// GetCompletedAt returns the CompletedAt field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetCompletedAt() Timestamp { - if a == nil || a.CompletedAt == nil { - return Timestamp{} - } - return *a.CompletedAt -} - -// GetConclusion returns the Conclusion field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetConclusion() string { - if a == nil || a.Conclusion == nil { - return "" - } - return *a.Conclusion -} - -// GetConfig returns the Config field. -func (a *AuditEntry) GetConfig() *HookConfig { - if a == nil { - return nil - } - return a.Config -} - -// GetConfigWas returns the ConfigWas field. -func (a *AuditEntry) GetConfigWas() *HookConfig { - if a == nil { - return nil - } - return a.ConfigWas -} - -// GetContentType returns the ContentType field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetContentType() string { - if a == nil || a.ContentType == nil { - return "" +// GetBusinessID returns the BusinessID field if it's non-nil, zero value otherwise. +func (a *AuditEntry) GetBusinessID() int64 { + if a == nil || a.BusinessID == nil { + return 0 } - return *a.ContentType + return *a.BusinessID } // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. @@ -1182,22 +1118,6 @@ func (a *AuditEntry) GetCreatedAt() Timestamp { return *a.CreatedAt } -// GetData returns the Data field. -func (a *AuditEntry) GetData() *AuditEntryData { - if a == nil { - return nil - } - return a.Data -} - -// GetDeployKeyFingerprint returns the DeployKeyFingerprint field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetDeployKeyFingerprint() string { - if a == nil || a.DeployKeyFingerprint == nil { - return "" - } - return *a.DeployKeyFingerprint -} - // GetDocumentID returns the DocumentID field if it's non-nil, zero value otherwise. func (a *AuditEntry) GetDocumentID() string { if a == nil || a.DocumentID == nil { @@ -1206,38 +1126,6 @@ func (a *AuditEntry) GetDocumentID() string { return *a.DocumentID } -// GetEmoji returns the Emoji field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetEmoji() string { - if a == nil || a.Emoji == nil { - return "" - } - return *a.Emoji -} - -// GetEnvironmentName returns the EnvironmentName field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetEnvironmentName() string { - if a == nil || a.EnvironmentName == nil { - return "" - } - return *a.EnvironmentName -} - -// GetEvent returns the Event field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetEvent() string { - if a == nil || a.Event == nil { - return "" - } - return *a.Event -} - -// GetExplanation returns the Explanation field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetExplanation() string { - if a == nil || a.Explanation == nil { - return "" - } - return *a.Explanation -} - // GetExternalIdentityNameID returns the ExternalIdentityNameID field if it's non-nil, zero value otherwise. func (a *AuditEntry) GetExternalIdentityNameID() string { if a == nil || a.ExternalIdentityNameID == nil { @@ -1254,14 +1142,6 @@ func (a *AuditEntry) GetExternalIdentityUsername() string { return *a.ExternalIdentityUsername } -// GetFingerprint returns the Fingerprint field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetFingerprint() string { - if a == nil || a.Fingerprint == nil { - return "" - } - return *a.Fingerprint -} - // GetHashedToken returns the HashedToken field if it's non-nil, zero value otherwise. func (a *AuditEntry) GetHashedToken() string { if a == nil || a.HashedToken == nil { @@ -1270,118 +1150,6 @@ func (a *AuditEntry) GetHashedToken() string { return *a.HashedToken } -// GetHeadBranch returns the HeadBranch field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetHeadBranch() string { - if a == nil || a.HeadBranch == nil { - return "" - } - return *a.HeadBranch -} - -// GetHeadSHA returns the HeadSHA field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetHeadSHA() string { - if a == nil || a.HeadSHA == nil { - return "" - } - return *a.HeadSHA -} - -// GetHookID returns the HookID field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetHookID() int64 { - if a == nil || a.HookID == nil { - return 0 - } - return *a.HookID -} - -// GetIsHostedRunner returns the IsHostedRunner field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetIsHostedRunner() bool { - if a == nil || a.IsHostedRunner == nil { - return false - } - return *a.IsHostedRunner -} - -// GetJobName returns the JobName field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetJobName() string { - if a == nil || a.JobName == nil { - return "" - } - return *a.JobName -} - -// GetJobWorkflowRef returns the JobWorkflowRef field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetJobWorkflowRef() string { - if a == nil || a.JobWorkflowRef == nil { - return "" - } - return *a.JobWorkflowRef -} - -// GetLimitedAvailability returns the LimitedAvailability field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetLimitedAvailability() bool { - if a == nil || a.LimitedAvailability == nil { - return false - } - return *a.LimitedAvailability -} - -// GetMessage returns the Message field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetMessage() string { - if a == nil || a.Message == nil { - return "" - } - return *a.Message -} - -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetName() string { - if a == nil || a.Name == nil { - return "" - } - return *a.Name -} - -// GetOAuthApplicationID returns the OAuthApplicationID field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetOAuthApplicationID() int64 { - if a == nil || a.OAuthApplicationID == nil { - return 0 - } - return *a.OAuthApplicationID -} - -// GetOldPermission returns the OldPermission field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetOldPermission() string { - if a == nil || a.OldPermission == nil { - return "" - } - return *a.OldPermission -} - -// GetOldUser returns the OldUser field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetOldUser() string { - if a == nil || a.OldUser == nil { - return "" - } - return *a.OldUser -} - -// GetOpenSSHPublicKey returns the OpenSSHPublicKey field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetOpenSSHPublicKey() string { - if a == nil || a.OpenSSHPublicKey == nil { - return "" - } - return *a.OpenSSHPublicKey -} - -// GetOperationType returns the OperationType field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetOperationType() string { - if a == nil || a.OperationType == nil { - return "" - } - return *a.OperationType -} - // GetOrg returns the Org field if it's non-nil, zero value otherwise. func (a *AuditEntry) GetOrg() string { if a == nil || a.Org == nil { @@ -1398,182 +1166,6 @@ func (a *AuditEntry) GetOrgID() int64 { return *a.OrgID } -// GetPermission returns the Permission field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetPermission() string { - if a == nil || a.Permission == nil { - return "" - } - return *a.Permission -} - -// GetPreviousVisibility returns the PreviousVisibility field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetPreviousVisibility() string { - if a == nil || a.PreviousVisibility == nil { - return "" - } - return *a.PreviousVisibility -} - -// GetProgrammaticAccessType returns the ProgrammaticAccessType field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetProgrammaticAccessType() string { - if a == nil || a.ProgrammaticAccessType == nil { - return "" - } - return *a.ProgrammaticAccessType -} - -// GetPullRequestID returns the PullRequestID field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetPullRequestID() int64 { - if a == nil || a.PullRequestID == nil { - return 0 - } - return *a.PullRequestID -} - -// GetPullRequestTitle returns the PullRequestTitle field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetPullRequestTitle() string { - if a == nil || a.PullRequestTitle == nil { - return "" - } - return *a.PullRequestTitle -} - -// GetPullRequestURL returns the PullRequestURL field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetPullRequestURL() string { - if a == nil || a.PullRequestURL == nil { - return "" - } - return *a.PullRequestURL -} - -// GetReadOnly returns the ReadOnly field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetReadOnly() string { - if a == nil || a.ReadOnly == nil { - return "" - } - return *a.ReadOnly -} - -// GetReferrer returns the Referrer field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetReferrer() string { - if a == nil || a.Referrer == nil { - return "" - } - return *a.Referrer -} - -// GetRepo returns the Repo field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetRepo() string { - if a == nil || a.Repo == nil { - return "" - } - return *a.Repo -} - -// GetRepository returns the Repository field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetRepository() string { - if a == nil || a.Repository == nil { - return "" - } - return *a.Repository -} - -// GetRepositoryPublic returns the RepositoryPublic field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetRepositoryPublic() bool { - if a == nil || a.RepositoryPublic == nil { - return false - } - return *a.RepositoryPublic -} - -// GetRunAttempt returns the RunAttempt field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetRunAttempt() int64 { - if a == nil || a.RunAttempt == nil { - return 0 - } - return *a.RunAttempt -} - -// GetRunnerGroupID returns the RunnerGroupID field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetRunnerGroupID() int64 { - if a == nil || a.RunnerGroupID == nil { - return 0 - } - return *a.RunnerGroupID -} - -// GetRunnerGroupName returns the RunnerGroupName field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetRunnerGroupName() string { - if a == nil || a.RunnerGroupName == nil { - return "" - } - return *a.RunnerGroupName -} - -// GetRunnerID returns the RunnerID field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetRunnerID() int64 { - if a == nil || a.RunnerID == nil { - return 0 - } - return *a.RunnerID -} - -// GetRunnerName returns the RunnerName field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetRunnerName() string { - if a == nil || a.RunnerName == nil { - return "" - } - return *a.RunnerName -} - -// GetRunNumber returns the RunNumber field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetRunNumber() int64 { - if a == nil || a.RunNumber == nil { - return 0 - } - return *a.RunNumber -} - -// GetSourceVersion returns the SourceVersion field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetSourceVersion() string { - if a == nil || a.SourceVersion == nil { - return "" - } - return *a.SourceVersion -} - -// GetStartedAt returns the StartedAt field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetStartedAt() Timestamp { - if a == nil || a.StartedAt == nil { - return Timestamp{} - } - return *a.StartedAt -} - -// GetTargetLogin returns the TargetLogin field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetTargetLogin() string { - if a == nil || a.TargetLogin == nil { - return "" - } - return *a.TargetLogin -} - -// GetTargetVersion returns the TargetVersion field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetTargetVersion() string { - if a == nil || a.TargetVersion == nil { - return "" - } - return *a.TargetVersion -} - -// GetTeam returns the Team field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetTeam() string { - if a == nil || a.Team == nil { - return "" - } - return *a.Team -} - // GetTimestamp returns the Timestamp field if it's non-nil, zero value otherwise. func (a *AuditEntry) GetTimestamp() Timestamp { if a == nil || a.Timestamp == nil { @@ -1598,38 +1190,6 @@ func (a *AuditEntry) GetTokenScopes() string { return *a.TokenScopes } -// GetTopic returns the Topic field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetTopic() string { - if a == nil || a.Topic == nil { - return "" - } - return *a.Topic -} - -// GetTransportProtocol returns the TransportProtocol field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetTransportProtocol() int { - if a == nil || a.TransportProtocol == nil { - return 0 - } - return *a.TransportProtocol -} - -// GetTransportProtocolName returns the TransportProtocolName field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetTransportProtocolName() string { - if a == nil || a.TransportProtocolName == nil { - return "" - } - return *a.TransportProtocolName -} - -// GetTriggerID returns the TriggerID field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetTriggerID() int64 { - if a == nil || a.TriggerID == nil { - return 0 - } - return *a.TriggerID -} - // GetUser returns the User field if it's non-nil, zero value otherwise. func (a *AuditEntry) GetUser() string { if a == nil || a.User == nil { @@ -1638,52 +1198,12 @@ func (a *AuditEntry) GetUser() string { return *a.User } -// GetUserAgent returns the UserAgent field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetUserAgent() string { - if a == nil || a.UserAgent == nil { - return "" - } - return *a.UserAgent -} - -// GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetVisibility() string { - if a == nil || a.Visibility == nil { - return "" - } - return *a.Visibility -} - -// GetWorkflowID returns the WorkflowID field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetWorkflowID() int64 { - if a == nil || a.WorkflowID == nil { +// GetUserID returns the UserID field if it's non-nil, zero value otherwise. +func (a *AuditEntry) GetUserID() int64 { + if a == nil || a.UserID == nil { return 0 } - return *a.WorkflowID -} - -// GetWorkflowRunID returns the WorkflowRunID field if it's non-nil, zero value otherwise. -func (a *AuditEntry) GetWorkflowRunID() int64 { - if a == nil || a.WorkflowRunID == nil { - return 0 - } - return *a.WorkflowRunID -} - -// GetOldLogin returns the OldLogin field if it's non-nil, zero value otherwise. -func (a *AuditEntryData) GetOldLogin() string { - if a == nil || a.OldLogin == nil { - return "" - } - return *a.OldLogin -} - -// GetOldName returns the OldName field if it's non-nil, zero value otherwise. -func (a *AuditEntryData) GetOldName() string { - if a == nil || a.OldName == nil { - return "" - } - return *a.OldName + return *a.UserID } // GetApp returns the App field. @@ -14478,22 +13998,6 @@ func (p *Plan) GetSpace() int { return *p.Space } -// GetCode returns the Code field if it's non-nil, zero value otherwise. -func (p *PolicyOverrideReason) GetCode() string { - if p == nil || p.Code == nil { - return "" - } - return *p.Code -} - -// GetMessage returns the Message field if it's non-nil, zero value otherwise. -func (p *PolicyOverrideReason) GetMessage() string { - if p == nil || p.Message == nil { - return "" - } - return *p.Message -} - // GetConfigURL returns the ConfigURL field if it's non-nil, zero value otherwise. func (p *PreReceiveHook) GetConfigURL() string { if p == nil || p.ConfigURL == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 6ae89e454a6..5b0b9911bdb 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -1263,26 +1263,6 @@ func TestAuditEntry_GetAction(tt *testing.T) { a.GetAction() } -func TestAuditEntry_GetActive(tt *testing.T) { - var zeroValue bool - a := &AuditEntry{Active: &zeroValue} - a.GetActive() - a = &AuditEntry{} - a.GetActive() - a = nil - a.GetActive() -} - -func TestAuditEntry_GetActiveWas(tt *testing.T) { - var zeroValue bool - a := &AuditEntry{ActiveWas: &zeroValue} - a.GetActiveWas() - a = &AuditEntry{} - a.GetActiveWas() - a = nil - a.GetActiveWas() -} - func TestAuditEntry_GetActor(tt *testing.T) { var zeroValue string a := &AuditEntry{Actor: &zeroValue} @@ -1293,14 +1273,14 @@ func TestAuditEntry_GetActor(tt *testing.T) { a.GetActor() } -func TestAuditEntry_GetActorIP(tt *testing.T) { - var zeroValue string - a := &AuditEntry{ActorIP: &zeroValue} - a.GetActorIP() +func TestAuditEntry_GetActorID(tt *testing.T) { + var zeroValue int64 + a := &AuditEntry{ActorID: &zeroValue} + a.GetActorID() a = &AuditEntry{} - a.GetActorIP() + a.GetActorID() a = nil - a.GetActorIP() + a.GetActorID() } func TestAuditEntry_GetActorLocation(tt *testing.T) { @@ -1310,16 +1290,6 @@ func TestAuditEntry_GetActorLocation(tt *testing.T) { a.GetActorLocation() } -func TestAuditEntry_GetBlockedUser(tt *testing.T) { - var zeroValue string - a := &AuditEntry{BlockedUser: &zeroValue} - a.GetBlockedUser() - a = &AuditEntry{} - a.GetBlockedUser() - a = nil - a.GetBlockedUser() -} - func TestAuditEntry_GetBusiness(tt *testing.T) { var zeroValue string a := &AuditEntry{Business: &zeroValue} @@ -1330,58 +1300,14 @@ func TestAuditEntry_GetBusiness(tt *testing.T) { a.GetBusiness() } -func TestAuditEntry_GetCancelledAt(tt *testing.T) { - var zeroValue Timestamp - a := &AuditEntry{CancelledAt: &zeroValue} - a.GetCancelledAt() - a = &AuditEntry{} - a.GetCancelledAt() - a = nil - a.GetCancelledAt() -} - -func TestAuditEntry_GetCompletedAt(tt *testing.T) { - var zeroValue Timestamp - a := &AuditEntry{CompletedAt: &zeroValue} - a.GetCompletedAt() - a = &AuditEntry{} - a.GetCompletedAt() - a = nil - a.GetCompletedAt() -} - -func TestAuditEntry_GetConclusion(tt *testing.T) { - var zeroValue string - a := &AuditEntry{Conclusion: &zeroValue} - a.GetConclusion() - a = &AuditEntry{} - a.GetConclusion() - a = nil - a.GetConclusion() -} - -func TestAuditEntry_GetConfig(tt *testing.T) { - a := &AuditEntry{} - a.GetConfig() - a = nil - a.GetConfig() -} - -func TestAuditEntry_GetConfigWas(tt *testing.T) { - a := &AuditEntry{} - a.GetConfigWas() - a = nil - a.GetConfigWas() -} - -func TestAuditEntry_GetContentType(tt *testing.T) { - var zeroValue string - a := &AuditEntry{ContentType: &zeroValue} - a.GetContentType() +func TestAuditEntry_GetBusinessID(tt *testing.T) { + var zeroValue int64 + a := &AuditEntry{BusinessID: &zeroValue} + a.GetBusinessID() a = &AuditEntry{} - a.GetContentType() + a.GetBusinessID() a = nil - a.GetContentType() + a.GetBusinessID() } func TestAuditEntry_GetCreatedAt(tt *testing.T) { @@ -1394,23 +1320,6 @@ func TestAuditEntry_GetCreatedAt(tt *testing.T) { a.GetCreatedAt() } -func TestAuditEntry_GetData(tt *testing.T) { - a := &AuditEntry{} - a.GetData() - a = nil - a.GetData() -} - -func TestAuditEntry_GetDeployKeyFingerprint(tt *testing.T) { - var zeroValue string - a := &AuditEntry{DeployKeyFingerprint: &zeroValue} - a.GetDeployKeyFingerprint() - a = &AuditEntry{} - a.GetDeployKeyFingerprint() - a = nil - a.GetDeployKeyFingerprint() -} - func TestAuditEntry_GetDocumentID(tt *testing.T) { var zeroValue string a := &AuditEntry{DocumentID: &zeroValue} @@ -1421,46 +1330,6 @@ func TestAuditEntry_GetDocumentID(tt *testing.T) { a.GetDocumentID() } -func TestAuditEntry_GetEmoji(tt *testing.T) { - var zeroValue string - a := &AuditEntry{Emoji: &zeroValue} - a.GetEmoji() - a = &AuditEntry{} - a.GetEmoji() - a = nil - a.GetEmoji() -} - -func TestAuditEntry_GetEnvironmentName(tt *testing.T) { - var zeroValue string - a := &AuditEntry{EnvironmentName: &zeroValue} - a.GetEnvironmentName() - a = &AuditEntry{} - a.GetEnvironmentName() - a = nil - a.GetEnvironmentName() -} - -func TestAuditEntry_GetEvent(tt *testing.T) { - var zeroValue string - a := &AuditEntry{Event: &zeroValue} - a.GetEvent() - a = &AuditEntry{} - a.GetEvent() - a = nil - a.GetEvent() -} - -func TestAuditEntry_GetExplanation(tt *testing.T) { - var zeroValue string - a := &AuditEntry{Explanation: &zeroValue} - a.GetExplanation() - a = &AuditEntry{} - a.GetExplanation() - a = nil - a.GetExplanation() -} - func TestAuditEntry_GetExternalIdentityNameID(tt *testing.T) { var zeroValue string a := &AuditEntry{ExternalIdentityNameID: &zeroValue} @@ -1481,16 +1350,6 @@ func TestAuditEntry_GetExternalIdentityUsername(tt *testing.T) { a.GetExternalIdentityUsername() } -func TestAuditEntry_GetFingerprint(tt *testing.T) { - var zeroValue string - a := &AuditEntry{Fingerprint: &zeroValue} - a.GetFingerprint() - a = &AuditEntry{} - a.GetFingerprint() - a = nil - a.GetFingerprint() -} - func TestAuditEntry_GetHashedToken(tt *testing.T) { var zeroValue string a := &AuditEntry{HashedToken: &zeroValue} @@ -1501,146 +1360,6 @@ func TestAuditEntry_GetHashedToken(tt *testing.T) { a.GetHashedToken() } -func TestAuditEntry_GetHeadBranch(tt *testing.T) { - var zeroValue string - a := &AuditEntry{HeadBranch: &zeroValue} - a.GetHeadBranch() - a = &AuditEntry{} - a.GetHeadBranch() - a = nil - a.GetHeadBranch() -} - -func TestAuditEntry_GetHeadSHA(tt *testing.T) { - var zeroValue string - a := &AuditEntry{HeadSHA: &zeroValue} - a.GetHeadSHA() - a = &AuditEntry{} - a.GetHeadSHA() - a = nil - a.GetHeadSHA() -} - -func TestAuditEntry_GetHookID(tt *testing.T) { - var zeroValue int64 - a := &AuditEntry{HookID: &zeroValue} - a.GetHookID() - a = &AuditEntry{} - a.GetHookID() - a = nil - a.GetHookID() -} - -func TestAuditEntry_GetIsHostedRunner(tt *testing.T) { - var zeroValue bool - a := &AuditEntry{IsHostedRunner: &zeroValue} - a.GetIsHostedRunner() - a = &AuditEntry{} - a.GetIsHostedRunner() - a = nil - a.GetIsHostedRunner() -} - -func TestAuditEntry_GetJobName(tt *testing.T) { - var zeroValue string - a := &AuditEntry{JobName: &zeroValue} - a.GetJobName() - a = &AuditEntry{} - a.GetJobName() - a = nil - a.GetJobName() -} - -func TestAuditEntry_GetJobWorkflowRef(tt *testing.T) { - var zeroValue string - a := &AuditEntry{JobWorkflowRef: &zeroValue} - a.GetJobWorkflowRef() - a = &AuditEntry{} - a.GetJobWorkflowRef() - a = nil - a.GetJobWorkflowRef() -} - -func TestAuditEntry_GetLimitedAvailability(tt *testing.T) { - var zeroValue bool - a := &AuditEntry{LimitedAvailability: &zeroValue} - a.GetLimitedAvailability() - a = &AuditEntry{} - a.GetLimitedAvailability() - a = nil - a.GetLimitedAvailability() -} - -func TestAuditEntry_GetMessage(tt *testing.T) { - var zeroValue string - a := &AuditEntry{Message: &zeroValue} - a.GetMessage() - a = &AuditEntry{} - a.GetMessage() - a = nil - a.GetMessage() -} - -func TestAuditEntry_GetName(tt *testing.T) { - var zeroValue string - a := &AuditEntry{Name: &zeroValue} - a.GetName() - a = &AuditEntry{} - a.GetName() - a = nil - a.GetName() -} - -func TestAuditEntry_GetOAuthApplicationID(tt *testing.T) { - var zeroValue int64 - a := &AuditEntry{OAuthApplicationID: &zeroValue} - a.GetOAuthApplicationID() - a = &AuditEntry{} - a.GetOAuthApplicationID() - a = nil - a.GetOAuthApplicationID() -} - -func TestAuditEntry_GetOldPermission(tt *testing.T) { - var zeroValue string - a := &AuditEntry{OldPermission: &zeroValue} - a.GetOldPermission() - a = &AuditEntry{} - a.GetOldPermission() - a = nil - a.GetOldPermission() -} - -func TestAuditEntry_GetOldUser(tt *testing.T) { - var zeroValue string - a := &AuditEntry{OldUser: &zeroValue} - a.GetOldUser() - a = &AuditEntry{} - a.GetOldUser() - a = nil - a.GetOldUser() -} - -func TestAuditEntry_GetOpenSSHPublicKey(tt *testing.T) { - var zeroValue string - a := &AuditEntry{OpenSSHPublicKey: &zeroValue} - a.GetOpenSSHPublicKey() - a = &AuditEntry{} - a.GetOpenSSHPublicKey() - a = nil - a.GetOpenSSHPublicKey() -} - -func TestAuditEntry_GetOperationType(tt *testing.T) { - var zeroValue string - a := &AuditEntry{OperationType: &zeroValue} - a.GetOperationType() - a = &AuditEntry{} - a.GetOperationType() - a = nil - a.GetOperationType() -} - func TestAuditEntry_GetOrg(tt *testing.T) { var zeroValue string a := &AuditEntry{Org: &zeroValue} @@ -1661,226 +1380,6 @@ func TestAuditEntry_GetOrgID(tt *testing.T) { a.GetOrgID() } -func TestAuditEntry_GetPermission(tt *testing.T) { - var zeroValue string - a := &AuditEntry{Permission: &zeroValue} - a.GetPermission() - a = &AuditEntry{} - a.GetPermission() - a = nil - a.GetPermission() -} - -func TestAuditEntry_GetPreviousVisibility(tt *testing.T) { - var zeroValue string - a := &AuditEntry{PreviousVisibility: &zeroValue} - a.GetPreviousVisibility() - a = &AuditEntry{} - a.GetPreviousVisibility() - a = nil - a.GetPreviousVisibility() -} - -func TestAuditEntry_GetProgrammaticAccessType(tt *testing.T) { - var zeroValue string - a := &AuditEntry{ProgrammaticAccessType: &zeroValue} - a.GetProgrammaticAccessType() - a = &AuditEntry{} - a.GetProgrammaticAccessType() - a = nil - a.GetProgrammaticAccessType() -} - -func TestAuditEntry_GetPullRequestID(tt *testing.T) { - var zeroValue int64 - a := &AuditEntry{PullRequestID: &zeroValue} - a.GetPullRequestID() - a = &AuditEntry{} - a.GetPullRequestID() - a = nil - a.GetPullRequestID() -} - -func TestAuditEntry_GetPullRequestTitle(tt *testing.T) { - var zeroValue string - a := &AuditEntry{PullRequestTitle: &zeroValue} - a.GetPullRequestTitle() - a = &AuditEntry{} - a.GetPullRequestTitle() - a = nil - a.GetPullRequestTitle() -} - -func TestAuditEntry_GetPullRequestURL(tt *testing.T) { - var zeroValue string - a := &AuditEntry{PullRequestURL: &zeroValue} - a.GetPullRequestURL() - a = &AuditEntry{} - a.GetPullRequestURL() - a = nil - a.GetPullRequestURL() -} - -func TestAuditEntry_GetReadOnly(tt *testing.T) { - var zeroValue string - a := &AuditEntry{ReadOnly: &zeroValue} - a.GetReadOnly() - a = &AuditEntry{} - a.GetReadOnly() - a = nil - a.GetReadOnly() -} - -func TestAuditEntry_GetReferrer(tt *testing.T) { - var zeroValue string - a := &AuditEntry{Referrer: &zeroValue} - a.GetReferrer() - a = &AuditEntry{} - a.GetReferrer() - a = nil - a.GetReferrer() -} - -func TestAuditEntry_GetRepo(tt *testing.T) { - var zeroValue string - a := &AuditEntry{Repo: &zeroValue} - a.GetRepo() - a = &AuditEntry{} - a.GetRepo() - a = nil - a.GetRepo() -} - -func TestAuditEntry_GetRepository(tt *testing.T) { - var zeroValue string - a := &AuditEntry{Repository: &zeroValue} - a.GetRepository() - a = &AuditEntry{} - a.GetRepository() - a = nil - a.GetRepository() -} - -func TestAuditEntry_GetRepositoryPublic(tt *testing.T) { - var zeroValue bool - a := &AuditEntry{RepositoryPublic: &zeroValue} - a.GetRepositoryPublic() - a = &AuditEntry{} - a.GetRepositoryPublic() - a = nil - a.GetRepositoryPublic() -} - -func TestAuditEntry_GetRunAttempt(tt *testing.T) { - var zeroValue int64 - a := &AuditEntry{RunAttempt: &zeroValue} - a.GetRunAttempt() - a = &AuditEntry{} - a.GetRunAttempt() - a = nil - a.GetRunAttempt() -} - -func TestAuditEntry_GetRunnerGroupID(tt *testing.T) { - var zeroValue int64 - a := &AuditEntry{RunnerGroupID: &zeroValue} - a.GetRunnerGroupID() - a = &AuditEntry{} - a.GetRunnerGroupID() - a = nil - a.GetRunnerGroupID() -} - -func TestAuditEntry_GetRunnerGroupName(tt *testing.T) { - var zeroValue string - a := &AuditEntry{RunnerGroupName: &zeroValue} - a.GetRunnerGroupName() - a = &AuditEntry{} - a.GetRunnerGroupName() - a = nil - a.GetRunnerGroupName() -} - -func TestAuditEntry_GetRunnerID(tt *testing.T) { - var zeroValue int64 - a := &AuditEntry{RunnerID: &zeroValue} - a.GetRunnerID() - a = &AuditEntry{} - a.GetRunnerID() - a = nil - a.GetRunnerID() -} - -func TestAuditEntry_GetRunnerName(tt *testing.T) { - var zeroValue string - a := &AuditEntry{RunnerName: &zeroValue} - a.GetRunnerName() - a = &AuditEntry{} - a.GetRunnerName() - a = nil - a.GetRunnerName() -} - -func TestAuditEntry_GetRunNumber(tt *testing.T) { - var zeroValue int64 - a := &AuditEntry{RunNumber: &zeroValue} - a.GetRunNumber() - a = &AuditEntry{} - a.GetRunNumber() - a = nil - a.GetRunNumber() -} - -func TestAuditEntry_GetSourceVersion(tt *testing.T) { - var zeroValue string - a := &AuditEntry{SourceVersion: &zeroValue} - a.GetSourceVersion() - a = &AuditEntry{} - a.GetSourceVersion() - a = nil - a.GetSourceVersion() -} - -func TestAuditEntry_GetStartedAt(tt *testing.T) { - var zeroValue Timestamp - a := &AuditEntry{StartedAt: &zeroValue} - a.GetStartedAt() - a = &AuditEntry{} - a.GetStartedAt() - a = nil - a.GetStartedAt() -} - -func TestAuditEntry_GetTargetLogin(tt *testing.T) { - var zeroValue string - a := &AuditEntry{TargetLogin: &zeroValue} - a.GetTargetLogin() - a = &AuditEntry{} - a.GetTargetLogin() - a = nil - a.GetTargetLogin() -} - -func TestAuditEntry_GetTargetVersion(tt *testing.T) { - var zeroValue string - a := &AuditEntry{TargetVersion: &zeroValue} - a.GetTargetVersion() - a = &AuditEntry{} - a.GetTargetVersion() - a = nil - a.GetTargetVersion() -} - -func TestAuditEntry_GetTeam(tt *testing.T) { - var zeroValue string - a := &AuditEntry{Team: &zeroValue} - a.GetTeam() - a = &AuditEntry{} - a.GetTeam() - a = nil - a.GetTeam() -} - func TestAuditEntry_GetTimestamp(tt *testing.T) { var zeroValue Timestamp a := &AuditEntry{Timestamp: &zeroValue} @@ -1911,46 +1410,6 @@ func TestAuditEntry_GetTokenScopes(tt *testing.T) { a.GetTokenScopes() } -func TestAuditEntry_GetTopic(tt *testing.T) { - var zeroValue string - a := &AuditEntry{Topic: &zeroValue} - a.GetTopic() - a = &AuditEntry{} - a.GetTopic() - a = nil - a.GetTopic() -} - -func TestAuditEntry_GetTransportProtocol(tt *testing.T) { - var zeroValue int - a := &AuditEntry{TransportProtocol: &zeroValue} - a.GetTransportProtocol() - a = &AuditEntry{} - a.GetTransportProtocol() - a = nil - a.GetTransportProtocol() -} - -func TestAuditEntry_GetTransportProtocolName(tt *testing.T) { - var zeroValue string - a := &AuditEntry{TransportProtocolName: &zeroValue} - a.GetTransportProtocolName() - a = &AuditEntry{} - a.GetTransportProtocolName() - a = nil - a.GetTransportProtocolName() -} - -func TestAuditEntry_GetTriggerID(tt *testing.T) { - var zeroValue int64 - a := &AuditEntry{TriggerID: &zeroValue} - a.GetTriggerID() - a = &AuditEntry{} - a.GetTriggerID() - a = nil - a.GetTriggerID() -} - func TestAuditEntry_GetUser(tt *testing.T) { var zeroValue string a := &AuditEntry{User: &zeroValue} @@ -1961,64 +1420,14 @@ func TestAuditEntry_GetUser(tt *testing.T) { a.GetUser() } -func TestAuditEntry_GetUserAgent(tt *testing.T) { - var zeroValue string - a := &AuditEntry{UserAgent: &zeroValue} - a.GetUserAgent() - a = &AuditEntry{} - a.GetUserAgent() - a = nil - a.GetUserAgent() -} - -func TestAuditEntry_GetVisibility(tt *testing.T) { - var zeroValue string - a := &AuditEntry{Visibility: &zeroValue} - a.GetVisibility() - a = &AuditEntry{} - a.GetVisibility() - a = nil - a.GetVisibility() -} - -func TestAuditEntry_GetWorkflowID(tt *testing.T) { +func TestAuditEntry_GetUserID(tt *testing.T) { var zeroValue int64 - a := &AuditEntry{WorkflowID: &zeroValue} - a.GetWorkflowID() + a := &AuditEntry{UserID: &zeroValue} + a.GetUserID() a = &AuditEntry{} - a.GetWorkflowID() + a.GetUserID() a = nil - a.GetWorkflowID() -} - -func TestAuditEntry_GetWorkflowRunID(tt *testing.T) { - var zeroValue int64 - a := &AuditEntry{WorkflowRunID: &zeroValue} - a.GetWorkflowRunID() - a = &AuditEntry{} - a.GetWorkflowRunID() - a = nil - a.GetWorkflowRunID() -} - -func TestAuditEntryData_GetOldLogin(tt *testing.T) { - var zeroValue string - a := &AuditEntryData{OldLogin: &zeroValue} - a.GetOldLogin() - a = &AuditEntryData{} - a.GetOldLogin() - a = nil - a.GetOldLogin() -} - -func TestAuditEntryData_GetOldName(tt *testing.T) { - var zeroValue string - a := &AuditEntryData{OldName: &zeroValue} - a.GetOldName() - a = &AuditEntryData{} - a.GetOldName() - a = nil - a.GetOldName() + a.GetUserID() } func TestAuthorization_GetApp(tt *testing.T) { @@ -16949,26 +16358,6 @@ func TestPlan_GetSpace(tt *testing.T) { p.GetSpace() } -func TestPolicyOverrideReason_GetCode(tt *testing.T) { - var zeroValue string - p := &PolicyOverrideReason{Code: &zeroValue} - p.GetCode() - p = &PolicyOverrideReason{} - p.GetCode() - p = nil - p.GetCode() -} - -func TestPolicyOverrideReason_GetMessage(tt *testing.T) { - var zeroValue string - p := &PolicyOverrideReason{Message: &zeroValue} - p.GetMessage() - p = &PolicyOverrideReason{} - p.GetMessage() - p = nil - p.GetMessage() -} - func TestPreReceiveHook_GetConfigURL(tt *testing.T) { var zeroValue string p := &PreReceiveHook{ConfigURL: &zeroValue} diff --git a/github/github_test.go b/github/github_test.go index 4d672f6096f..45ac57c0019 100644 --- a/github/github_test.go +++ b/github/github_test.go @@ -275,6 +275,13 @@ func testErrorResponseForStatusCode(t *testing.T, code int) { } } +func assertNoDiff(t *testing.T, want, got interface{}) { + t.Helper() + if diff := cmp.Diff(want, got); diff != "" { + t.Errorf("diff mismatch (-want +got):\n%v", diff) + } +} + func assertNilError(t *testing.T, err error) { t.Helper() if err != nil { diff --git a/github/orgs_audit_log.go b/github/orgs_audit_log.go index aa3591359ef..28ac079bb3b 100644 --- a/github/orgs_audit_log.go +++ b/github/orgs_audit_log.go @@ -7,6 +7,7 @@ package github import ( "context" + "encoding/json" "fmt" ) @@ -34,104 +35,94 @@ type ActorLocation struct { CountryCode *string `json:"country_code,omitempty"` } -// PolicyOverrideReason contains user-supplied information about why a policy was overridden. -type PolicyOverrideReason struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` -} - // AuditEntry describes the fields that may be represented by various audit-log "action" entries. +// There are many other fields that may be present depending on the action. You can access those +// in AdditionalFields. // For a list of actions see - https://docs.github.com/github/setting-up-and-managing-organizations-and-teams/reviewing-the-audit-log-for-your-organization#audit-log-actions type AuditEntry struct { - ActorIP *string `json:"actor_ip,omitempty"` - Action *string `json:"action,omitempty"` // The name of the action that was performed, for example `user.login` or `repo.create`. - Active *bool `json:"active,omitempty"` - ActiveWas *bool `json:"active_was,omitempty"` - Actor *string `json:"actor,omitempty"` // The actor who performed the action. - ActorLocation *ActorLocation `json:"actor_location,omitempty"` - BlockedUser *string `json:"blocked_user,omitempty"` - Business *string `json:"business,omitempty"` - CancelledAt *Timestamp `json:"cancelled_at,omitempty"` - CompletedAt *Timestamp `json:"completed_at,omitempty"` - Conclusion *string `json:"conclusion,omitempty"` - Config *HookConfig `json:"config,omitempty"` - ConfigWas *HookConfig `json:"config_was,omitempty"` - ContentType *string `json:"content_type,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - DeployKeyFingerprint *string `json:"deploy_key_fingerprint,omitempty"` - DocumentID *string `json:"_document_id,omitempty"` - Emoji *string `json:"emoji,omitempty"` - EnvironmentName *string `json:"environment_name,omitempty"` - Event *string `json:"event,omitempty"` - Events []string `json:"events,omitempty"` - EventsWere []string `json:"events_were,omitempty"` - Explanation *string `json:"explanation,omitempty"` - ExternalIdentityNameID *string `json:"external_identity_nameid,omitempty"` - ExternalIdentityUsername *string `json:"external_identity_username,omitempty"` - Fingerprint *string `json:"fingerprint,omitempty"` - HashedToken *string `json:"hashed_token,omitempty"` - HeadBranch *string `json:"head_branch,omitempty"` - HeadSHA *string `json:"head_sha,omitempty"` - HookID *int64 `json:"hook_id,omitempty"` - IsHostedRunner *bool `json:"is_hosted_runner,omitempty"` - JobName *string `json:"job_name,omitempty"` - JobWorkflowRef *string `json:"job_workflow_ref,omitempty"` - LimitedAvailability *bool `json:"limited_availability,omitempty"` - Message *string `json:"message,omitempty"` - Name *string `json:"name,omitempty"` - OAuthApplicationID *int64 `json:"oauth_application_id,omitempty"` - OldUser *string `json:"old_user,omitempty"` - OldPermission *string `json:"old_permission,omitempty"` // The permission level for membership changes, for example `admin` or `read`. - OpenSSHPublicKey *string `json:"openssh_public_key,omitempty"` - OperationType *string `json:"operation_type,omitempty"` - Org *string `json:"org,omitempty"` - OrgID *int64 `json:"org_id,omitempty"` - OverriddenCodes []string `json:"overridden_codes,omitempty"` - Permission *string `json:"permission,omitempty"` // The permission level for membership changes, for example `admin` or `read`. - PreviousVisibility *string `json:"previous_visibility,omitempty"` - ProgrammaticAccessType *string `json:"programmatic_access_type,omitempty"` - PullRequestID *int64 `json:"pull_request_id,omitempty"` - PullRequestTitle *string `json:"pull_request_title,omitempty"` - PullRequestURL *string `json:"pull_request_url,omitempty"` - ReadOnly *string `json:"read_only,omitempty"` - Reasons []*PolicyOverrideReason `json:"reasons,omitempty"` - Referrer *string `json:"referrer,omitempty"` - Repo *string `json:"repo,omitempty"` - Repository *string `json:"repository,omitempty"` - RepositoryPublic *bool `json:"repository_public,omitempty"` - RunAttempt *int64 `json:"run_attempt,omitempty"` - RunnerGroupID *int64 `json:"runner_group_id,omitempty"` - RunnerGroupName *string `json:"runner_group_name,omitempty"` - RunnerID *int64 `json:"runner_id,omitempty"` - RunnerLabels []string `json:"runner_labels,omitempty"` - RunnerName *string `json:"runner_name,omitempty"` - RunNumber *int64 `json:"run_number,omitempty"` - SecretsPassed []string `json:"secrets_passed,omitempty"` - SourceVersion *string `json:"source_version,omitempty"` - StartedAt *Timestamp `json:"started_at,omitempty"` - TargetLogin *string `json:"target_login,omitempty"` - TargetVersion *string `json:"target_version,omitempty"` - Team *string `json:"team,omitempty"` - Timestamp *Timestamp `json:"@timestamp,omitempty"` // The time the audit log event occurred, given as a [Unix timestamp](http://en.wikipedia.org/wiki/Unix_time). - TokenID *int64 `json:"token_id,omitempty"` - TokenScopes *string `json:"token_scopes,omitempty"` - Topic *string `json:"topic,omitempty"` - TransportProtocolName *string `json:"transport_protocol_name,omitempty"` // A human readable name for the protocol (for example, HTTP or SSH) used to transfer Git data. - TransportProtocol *int `json:"transport_protocol,omitempty"` // The type of protocol (for example, HTTP=1 or SSH=2) used to transfer Git data. - TriggerID *int64 `json:"trigger_id,omitempty"` - User *string `json:"user,omitempty"` // The user that was affected by the action performed (if available). - UserAgent *string `json:"user_agent,omitempty"` - Visibility *string `json:"visibility,omitempty"` // The repository visibility, for example `public` or `private`. - WorkflowID *int64 `json:"workflow_id,omitempty"` - WorkflowRunID *int64 `json:"workflow_run_id,omitempty"` - - Data *AuditEntryData `json:"data,omitempty"` + Action *string `json:"action,omitempty"` // The name of the action that was performed, for example `user.login` or `repo.create`. + Actor *string `json:"actor,omitempty"` // The actor who performed the action. + ActorID *int64 `json:"actor_id,omitempty"` + ActorLocation *ActorLocation `json:"actor_location,omitempty"` + Business *string `json:"business,omitempty"` + BusinessID *int64 `json:"business_id,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + DocumentID *string `json:"_document_id,omitempty"` + ExternalIdentityNameID *string `json:"external_identity_nameid,omitempty"` + ExternalIdentityUsername *string `json:"external_identity_username,omitempty"` + HashedToken *string `json:"hashed_token,omitempty"` + Org *string `json:"org,omitempty"` + OrgID *int64 `json:"org_id,omitempty"` + Timestamp *Timestamp `json:"@timestamp,omitempty"` // The time the audit log event occurred, given as a [Unix timestamp](http://en.wikipedia.org/wiki/Unix_time). + TokenID *int64 `json:"token_id,omitempty"` + TokenScopes *string `json:"token_scopes,omitempty"` + User *string `json:"user,omitempty"` // The user that was affected by the action performed (if available). + UserID *int64 `json:"user_id,omitempty"` + + // Some events types have a data field that contains additional information about the event. + Data map[string]interface{} `json:"data,omitempty"` + + // All fields that are not explicitly defined in the struct are captured here. + AdditionalFields map[string]interface{} `json:"-"` +} + +func (a *AuditEntry) UnmarshalJSON(data []byte) error { + type entryAlias AuditEntry + var v entryAlias + if err := json.Unmarshal(data, &v); err != nil { + return err + } + + rawDefinedFields, err := json.Marshal(v) + if err != nil { + return err + } + definedFields := map[string]interface{}{} + if err := json.Unmarshal(rawDefinedFields, &definedFields); err != nil { + return err + } + + if err := json.Unmarshal(data, &v.AdditionalFields); err != nil { + return err + } + + for key, val := range v.AdditionalFields { + if _, ok := definedFields[key]; ok || val == nil { + delete(v.AdditionalFields, key) + } + } + + *a = AuditEntry(v) + if len(v.AdditionalFields) == 0 { + a.AdditionalFields = nil + } + return nil } -// AuditEntryData represents additional information stuffed into a `data` field. -type AuditEntryData struct { - OldName *string `json:"old_name,omitempty"` // The previous name of the repository, for a name change - OldLogin *string `json:"old_login,omitempty"` // The previous name of the organization, for a name change +func (a *AuditEntry) MarshalJSON() ([]byte, error) { + type entryAlias AuditEntry + v := entryAlias(*a) + defBytes, err := json.Marshal(v) + if err != nil { + return nil, err + } + if len(a.AdditionalFields) == 0 { + return defBytes, err + } + resMap := map[string]interface{}{} + if err := json.Unmarshal(defBytes, &resMap); err != nil { + return nil, err + } + for key, val := range a.AdditionalFields { + if val == nil { + continue + } + if _, ok := resMap[key]; ok { + return nil, fmt.Errorf("unexpected field in AdditionalFields: %v", key) + } + resMap[key] = val + } + return json.Marshal(resMap) } // GetAuditLog gets the audit-log entries for an organization. diff --git a/github/orgs_audit_log_test.go b/github/orgs_audit_log_test.go index 1a82471face..7c8de74c650 100644 --- a/github/orgs_audit_log_test.go +++ b/github/orgs_audit_log_test.go @@ -12,8 +12,6 @@ import ( "strings" "testing" "time" - - "github.com/google/go-cmp/cmp" ) func TestOrganizationService_GetAuditLog(t *testing.T) { @@ -24,46 +22,43 @@ func TestOrganizationService_GetAuditLog(t *testing.T) { testMethod(t, r, "GET") fmt.Fprint(w, `[ - { + { + "@timestamp": 1615077308538, + "_document_id": "beeZYapIUe-wKg5-beadb33", + "action": "workflows.completed_workflow_run", + "active": true, + "actor": "testactor", "actor_ip": "10.0.0.1", "actor_location": { "country_code": "US" }, - "active": true, - "workflow_id": 123456, - "head_branch": "master", - "org": "o", - "trigger_id": null, - "repo": "o/blue-crayon-1", - "created_at": 1615077308538, + "cancelled_at": "2021-03-07T00:35:08.000Z", + "completed_at": "2021-03-07T00:35:08.000Z", + "conclusion": "success", + "config": { + "content_type": "json", + "insecure_ssl": "0", + "url": "https://example.com/deadbeef-new-hook" + }, + "created_at": 1615077308538, + "event": "schedule", + "events": ["code_scanning_alert"], "hashed_token": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=", - "head_sha": "5acdeadbeef64d1a62388e901e5cdc9358644b37", - "conclusion": "success", - "old_permission": "read", - "permission": "admin", - "actor": "testactor", - "completed_at": "2021-03-07T00:35:08.000Z", - "@timestamp": 1615077308538, - "name": "Code scanning - action", - "action": "workflows.completed_workflow_run", - "started_at": "2021-03-07T00:33:04.000Z", - "event": "schedule", - "workflow_run_id": 628312345, - "_document_id": "beeZYapIUe-wKg5-beadb33", - "run_attempt": 1, - "run_number": 1, - "token_id": 1, - "token_scopes": "gist,repo:read", - "topic": "cp1-iad.ingest.github.actions.v0.WorkflowUpdate", + "head_branch": "master", + "head_sha": "5acdeadbeef64d1a62388e901e5cdc9358644b37", "job_workflow_ref": "testorg/testrepo/.github/workflows/testjob.yml@refs/pull/1/merge", + "name": "Code scanning - action", "oauth_application_id": 1, + "old_permission": "read", + "org": "o", "org_id": 1, - "pull_request_id": 1, - "pull_request_title": "a pr title", - "pull_request_url": "https://github.com/testorg/testrepo/pull/1", "overridden_codes": [ "review_policy_not_satisfied" ], + "permission": "admin", + "pull_request_id": 1, + "pull_request_title": "a pr title", + "pull_request_url": "https://github.com/testorg/testrepo/pull/1", "reasons": [ { "code": "a code", @@ -71,14 +66,19 @@ func TestOrganizationService_GetAuditLog(t *testing.T) { } ], "programmatic_access_type": "GitHub App server-to-server token", + "referrer": "a referrer", + "repo": "o/blue-crayon-1", + "run_attempt": 1, + "run_number": 1, + "started_at": "2021-03-07T00:33:04.000Z", + "token_id": 1, + "token_scopes": "gist,repo:read", + "topic": "cp1-iad.ingest.github.actions.v0.WorkflowUpdate", + "trigger_id": null, "user_agent": "a user agent", - "config": { - "content_type": "json", - "insecure_ssl": "0", - "url": "https://example.com/deadbeef-new-hook" - }, - "events": ["code_scanning_alert"] - }]`) + "workflow_id": 123456, + "workflow_run_id": 628312345 + }]`) }) ctx := context.Background() getOpts := GetAuditLogOptions{ @@ -91,8 +91,6 @@ func TestOrganizationService_GetAuditLog(t *testing.T) { if err != nil { t.Errorf("Organizations.GetAuditLog returned error: %v", err) } - startedAt, _ := time.Parse(time.RFC3339, "2021-03-07T00:33:04.000Z") - completedAt, _ := time.Parse(time.RFC3339, "2021-03-07T00:35:08.000Z") timestamp := time.Unix(0, 1615077308538*1e6) want := []*AuditEntry{ @@ -101,56 +99,58 @@ func TestOrganizationService_GetAuditLog(t *testing.T) { DocumentID: String("beeZYapIUe-wKg5-beadb33"), Action: String("workflows.completed_workflow_run"), Actor: String("testactor"), - ActorIP: String("10.0.0.1"), ActorLocation: &ActorLocation{ CountryCode: String("US"), }, - Active: Bool(true), - CompletedAt: &Timestamp{completedAt}, - Conclusion: String("success"), - CreatedAt: &Timestamp{timestamp}, - Event: String("schedule"), - HashedToken: String("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="), - HeadBranch: String("master"), - HeadSHA: String("5acdeadbeef64d1a62388e901e5cdc9358644b37"), - JobWorkflowRef: String("testorg/testrepo/.github/workflows/testjob.yml@refs/pull/1/merge"), - Name: String("Code scanning - action"), - OAuthApplicationID: Int64(1), - OldPermission: String("read"), - Org: String("o"), - OrgID: Int64(1), - OverriddenCodes: []string{"review_policy_not_satisfied"}, - Permission: String("admin"), - ProgrammaticAccessType: String("GitHub App server-to-server token"), - PullRequestID: Int64(1), - PullRequestTitle: String("a pr title"), - PullRequestURL: String("https://github.com/testorg/testrepo/pull/1"), - Reasons: []*PolicyOverrideReason{{ - Code: String("a code"), - Message: String("a message"), - }}, - Repo: String("o/blue-crayon-1"), - RunAttempt: Int64(1), - RunNumber: Int64(1), - StartedAt: &Timestamp{startedAt}, - TokenID: Int64(1), - TokenScopes: String("gist,repo:read"), - Topic: String("cp1-iad.ingest.github.actions.v0.WorkflowUpdate"), - UserAgent: String("a user agent"), - WorkflowID: Int64(123456), - WorkflowRunID: Int64(628312345), - Events: []string{"code_scanning_alert"}, - Config: &HookConfig{ - ContentType: String("json"), - InsecureSSL: String("0"), - URL: String("https://example.com/deadbeef-new-hook"), + CreatedAt: &Timestamp{timestamp}, + HashedToken: String("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="), + Org: String("o"), + OrgID: Int64(1), + TokenID: Int64(1), + TokenScopes: String("gist,repo:read"), + AdditionalFields: map[string]interface{}{ + "actor_ip": "10.0.0.1", + "active": true, + "cancelled_at": "2021-03-07T00:35:08.000Z", + "completed_at": "2021-03-07T00:35:08.000Z", + "conclusion": "success", + "event": "schedule", + "head_branch": "master", + "head_sha": "5acdeadbeef64d1a62388e901e5cdc9358644b37", + "job_workflow_ref": "testorg/testrepo/.github/workflows/testjob.yml@refs/pull/1/merge", + "name": "Code scanning - action", + "oauth_application_id": float64(1), + "old_permission": "read", + "overridden_codes": []interface{}{"review_policy_not_satisfied"}, + "permission": "admin", + "programmatic_access_type": "GitHub App server-to-server token", + "pull_request_id": float64(1), + "pull_request_title": "a pr title", + "pull_request_url": "https://github.com/testorg/testrepo/pull/1", + "reasons": []interface{}{map[string]interface{}{ + "code": "a code", + "message": "a message", + }}, + "referrer": "a referrer", + "repo": "o/blue-crayon-1", + "run_attempt": float64(1), + "run_number": float64(1), + "started_at": "2021-03-07T00:33:04.000Z", + "topic": "cp1-iad.ingest.github.actions.v0.WorkflowUpdate", + "user_agent": "a user agent", + "workflow_id": float64(123456), + "workflow_run_id": float64(628312345), + "events": []interface{}{"code_scanning_alert"}, + "config": map[string]interface{}{ + "content_type": "json", + "insecure_ssl": "0", + "url": "https://example.com/deadbeef-new-hook", + }, }, }, } - if !cmp.Equal(auditEntries, want) { - t.Errorf("Organizations.GetAuditLog return \ngot: %+v,\nwant:%+v", auditEntries, want) - } + assertNoDiff(t, want, auditEntries) // assert query string has lower case params requestedQuery := resp.Request.URL.RawQuery @@ -224,86 +224,95 @@ func TestAuditEntry_Marshal(t *testing.T) { u := &AuditEntry{ Action: String("a"), - Active: Bool(false), - ActiveWas: Bool(false), Actor: String("ac"), - ActorIP: String("aip"), ActorLocation: &ActorLocation{CountryCode: String("alcc")}, - BlockedUser: String("bu"), Business: String("b"), - CancelledAt: &Timestamp{referenceTime}, - CompletedAt: &Timestamp{referenceTime}, - Conclusion: String("c"), - Config: &HookConfig{URL: String("s")}, - ConfigWas: &HookConfig{URL: String("s")}, - ContentType: String("ct"), CreatedAt: &Timestamp{referenceTime}, - DeployKeyFingerprint: String("dkf"), DocumentID: String("did"), - Emoji: String("e"), - EnvironmentName: String("en"), - Event: String("e"), - Events: []string{"s"}, - EventsWere: []string{"s"}, - Explanation: String("e"), ExternalIdentityNameID: String("ein"), ExternalIdentityUsername: String("eiu"), - Fingerprint: String("f"), HashedToken: String("ht"), - HeadBranch: String("hb"), - HeadSHA: String("hsha"), - HookID: Int64(1), - IsHostedRunner: Bool(false), - JobName: String("jn"), - LimitedAvailability: Bool(false), - Message: String("m"), - Name: String("n"), - OldPermission: String("op"), - OldUser: String("ou"), - OpenSSHPublicKey: String("osshpk"), Org: String("o"), OrgID: Int64(1), - Permission: String("p"), - PreviousVisibility: String("pv"), - ProgrammaticAccessType: String("pat"), - PullRequestID: Int64(1), - PullRequestTitle: String("prt"), - PullRequestURL: String("pru"), - Reasons: []*PolicyOverrideReason{{ - Code: String("c"), - Message: String("m"), - }}, - ReadOnly: String("ro"), - Repo: String("r"), - Repository: String("repo"), - RepositoryPublic: Bool(false), - RunAttempt: Int64(1), - RunnerGroupID: Int64(1), - RunnerGroupName: String("rgn"), - RunnerID: Int64(1), - RunnerLabels: []string{"s"}, - RunnerName: String("rn"), - SecretsPassed: []string{"s"}, - SourceVersion: String("sv"), - StartedAt: &Timestamp{referenceTime}, - TargetLogin: String("tl"), - TargetVersion: String("tv"), - Team: String("t"), - Timestamp: &Timestamp{referenceTime}, - TokenID: Int64(1), - TokenScopes: String("ts"), - Topic: String("tp"), - TransportProtocolName: String("tpn"), - TransportProtocol: Int(1), - TriggerID: Int64(1), - User: String("u"), - UserAgent: String("ua"), - Visibility: String("v"), - WorkflowID: Int64(1), - WorkflowRunID: Int64(1), - Data: &AuditEntryData{ - OldName: String("on"), - OldLogin: String("ol"), + Timestamp: &Timestamp{referenceTime}, + TokenID: Int64(1), + TokenScopes: String("ts"), + User: String("u"), + Data: map[string]interface{}{ + "old_name": "on", + "old_login": "ol", + }, + AdditionalFields: map[string]interface{}{ + "active": false, + "active_was": false, + "actor_ip": "aip", + "blocked_user": "bu", + "cancelled_at": "2021-03-07T00:35:08.000Z", + "completed_at": "2021-03-07T00:35:08.000Z", + "conclusion": "c", + "config": map[string]interface{}{ + "url": "s", + }, + "config_was": map[string]interface{}{ + "url": "s", + }, + "content_type": "ct", + "deploy_key_fingerprint": "dkf", + "emoji": "e", + "environment_name": "en", + "event": "e", + "events": []interface{}{"s"}, + "events_were": []interface{}{"s"}, + "explanation": "e", + "fingerprint": "f", + "head_branch": "hb", + "head_sha": "hsha", + "hook_id": float64(1), + "is_hosted_runner": false, + "job_name": "jn", + "limited_availability": false, + "message": "m", + "name": "n", + "old_permission": "op", + "old_user": "ou", + "openssh_public_key": "osshpk", + "permission": "p", + "previous_visibility": "pv", + "programmatic_access_type": "pat", + "pull_request_id": float64(1), + "pull_request_title": "prt", + "pull_request_url": "pru", + "read_only": "ro", + "reasons": []interface{}{ + map[string]interface{}{ + "code": "c", + "message": "m", + }, + }, + "referrer": "a referrer", + "repo": "r", + "repository": "repo", + "repository_public": false, + "run_attempt": 1, + "runner_group_id": 1, + "runner_group_name": "rgn", + "runner_id": 1, + "runner_labels": []interface{}{"s"}, + "runner_name": "rn", + "secrets_passed": []interface{}{"s"}, + "source_version": "sv", + "started_at": "2006-01-02T15:04:05Z", + "target_login": "tl", + "target_version": "tv", + "team": "t", + "topic": "cp1-iad.ingest.github.actions.v0.WorkflowUpdate", + "transport_protocol": 1, + "transport_protocol_name": "tpn", + "trigger_id": 1, + "user_agent": "ua", + "visibility": "v", + "workflow_id": 1, + "workflow_run_id": 1, }, } @@ -318,8 +327,8 @@ func TestAuditEntry_Marshal(t *testing.T) { }, "blocked_user": "bu", "business": "b", - "cancelled_at": ` + referenceTimeStr + `, - "completed_at": ` + referenceTimeStr + `, + "cancelled_at": "2021-03-07T00:35:08.000Z", + "completed_at": "2021-03-07T00:35:08.000Z", "conclusion": "c", "config": { "url": "s" @@ -368,6 +377,7 @@ func TestAuditEntry_Marshal(t *testing.T) { "code": "c", "message": "m" }], + "referrer": "a referrer", "read_only": "ro", "repo": "r", "repository": "repo", @@ -391,7 +401,7 @@ func TestAuditEntry_Marshal(t *testing.T) { "@timestamp": ` + referenceTimeStr + `, "token_id": 1, "token_scopes": "ts", - "topic": "tp", + "topic": "cp1-iad.ingest.github.actions.v0.WorkflowUpdate", "transport_protocol_name": "tpn", "transport_protocol": 1, "trigger_id": 1, diff --git a/test/integration/audit_log_test.go b/test/integration/audit_log_test.go index 7819f9292ff..639ea7a6780 100644 --- a/test/integration/audit_log_test.go +++ b/test/integration/audit_log_test.go @@ -28,6 +28,6 @@ func TestOrganizationAuditLog(t *testing.T) { } for _, e := range entries { - t.Log(e.GetAction(), e.GetActor(), e.GetTimestamp(), e.GetUser(), e.GetActive()) + t.Log(e.GetAction(), e.GetActor(), e.GetTimestamp(), e.GetUser()) } } From 9d6658a678d61dcbb8b63b53eb12f519a221c749 Mon Sep 17 00:00:00 2001 From: Osama Faqhruldin Date: Tue, 19 Dec 2023 09:31:54 -0500 Subject: [PATCH 078/145] Add Copilot endpoints (#2973) Fixes: #2938. --- github/copilot.go | 311 +++++++++++ github/copilot_test.go | 887 ++++++++++++++++++++++++++++++++ github/github-accessors.go | 56 ++ github/github-accessors_test.go | 64 +++ github/github.go | 2 + 5 files changed, 1320 insertions(+) create mode 100644 github/copilot.go create mode 100644 github/copilot_test.go diff --git a/github/copilot.go b/github/copilot.go new file mode 100644 index 00000000000..3f3d73b25bc --- /dev/null +++ b/github/copilot.go @@ -0,0 +1,311 @@ +// Copyright 2023 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "encoding/json" + "fmt" +) + +// CopilotService provides access to the Copilot-related functions +// in the GitHub API. +// +// GitHub API docs: https://docs.github.com/en/rest/copilot/ +type CopilotService service + +// CopilotOrganizationDetails represents the details of an organization's Copilot for Business subscription. +type CopilotOrganizationDetails struct { + SeatBreakdown *CopilotSeatBreakdown `json:"seat_breakdown"` + PublicCodeSuggestions string `json:"public_code_suggestions"` + CopilotChat string `json:"copilot_chat"` + SeatManagementSetting string `json:"seat_management_setting"` +} + +// CopilotSeatBreakdown represents the breakdown of Copilot for Business seats for the organization. +type CopilotSeatBreakdown struct { + Total int `json:"total"` + AddedThisCycle int `json:"added_this_cycle"` + PendingCancellation int `json:"pending_cancellation"` + PendingInvitation int `json:"pending_invitation"` + ActiveThisCycle int `json:"active_this_cycle"` + InactiveThisCycle int `json:"inactive_this_cycle"` +} + +// ListCopilotSeatsResponse represents the Copilot for Business seat assignments for an organization. +type ListCopilotSeatsResponse struct { + TotalSeats int64 `json:"total_seats"` + Seats []*CopilotSeatDetails `json:"seats"` +} + +// CopilotSeatDetails represents the details of a Copilot for Business seat. +type CopilotSeatDetails struct { + // Assignee can either be a User, Team, or Organization. + Assignee interface{} `json:"assignee"` + AssigningTeam *Team `json:"assigning_team,omitempty"` + PendingCancellationDate *string `json:"pending_cancellation_date,omitempty"` + LastActivityAt *Timestamp `json:"last_activity_at,omitempty"` + LastActivityEditor *string `json:"last_activity_editor,omitempty"` + CreatedAt *Timestamp `json:"created_at"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` +} + +// SeatAssignments represents the number of seats assigned. +type SeatAssignments struct { + SeatsCreated int `json:"seats_created"` +} + +// SeatCancellations represents the number of seats cancelled. +type SeatCancellations struct { + SeatsCancelled int `json:"seats_cancelled"` +} + +func (cp *CopilotSeatDetails) UnmarshalJSON(data []byte) error { + // Using an alias to avoid infinite recursion when calling json.Unmarshal + type alias CopilotSeatDetails + var seatDetail alias + + if err := json.Unmarshal(data, &seatDetail); err != nil { + return err + } + + cp.AssigningTeam = seatDetail.AssigningTeam + cp.PendingCancellationDate = seatDetail.PendingCancellationDate + cp.LastActivityAt = seatDetail.LastActivityAt + cp.LastActivityEditor = seatDetail.LastActivityEditor + cp.CreatedAt = seatDetail.CreatedAt + cp.UpdatedAt = seatDetail.UpdatedAt + + switch v := seatDetail.Assignee.(type) { + case map[string]interface{}: + jsonData, err := json.Marshal(seatDetail.Assignee) + if err != nil { + return err + } + + if v["type"] == nil { + return fmt.Errorf("assignee type field is not set") + } + + if t, ok := v["type"].(string); ok && t == "User" { + user := &User{} + if err := json.Unmarshal(jsonData, user); err != nil { + return err + } + cp.Assignee = user + } else if t, ok := v["type"].(string); ok && t == "Team" { + team := &Team{} + if err := json.Unmarshal(jsonData, team); err != nil { + return err + } + cp.Assignee = team + } else if t, ok := v["type"].(string); ok && t == "Organization" { + organization := &Organization{} + if err := json.Unmarshal(jsonData, organization); err != nil { + return err + } + cp.Assignee = organization + } else { + return fmt.Errorf("unsupported assignee type %v", v["type"]) + } + default: + return fmt.Errorf("unsupported assignee type %T", v) + } + + return nil +} + +// GetUser gets the User from the CopilotSeatDetails if the assignee is a user. +func (cp *CopilotSeatDetails) GetUser() (*User, bool) { u, ok := cp.Assignee.(*User); return u, ok } + +// GetTeam gets the Team from the CopilotSeatDetails if the assignee is a team. +func (cp *CopilotSeatDetails) GetTeam() (*Team, bool) { t, ok := cp.Assignee.(*Team); return t, ok } + +// GetOrganization gets the Organization from the CopilotSeatDetails if the assignee is an organization. +func (cp *CopilotSeatDetails) GetOrganization() (*Organization, bool) { + o, ok := cp.Assignee.(*Organization) + return o, ok +} + +// GetCopilotBilling gets Copilot for Business billing information and settings for an organization. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-business#get-copilot-business-seat-information-and-settings-for-an-organization +// +//meta:operation GET /orgs/{org}/copilot/billing +func (s *CopilotService) GetCopilotBilling(ctx context.Context, org string) (*CopilotOrganizationDetails, *Response, error) { + u := fmt.Sprintf("orgs/%v/copilot/billing", org) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var copilotDetails *CopilotOrganizationDetails + resp, err := s.client.Do(ctx, req, &copilotDetails) + if err != nil { + return nil, resp, err + } + + return copilotDetails, resp, nil +} + +// ListCopilotSeats lists Copilot for Business seat assignments for an organization. +// +// To paginate through all seats, populate 'Page' with the number of the last page. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-business#list-all-copilot-business-seat-assignments-for-an-organization +// +//meta:operation GET /orgs/{org}/copilot/billing/seats +func (s *CopilotService) ListCopilotSeats(ctx context.Context, org string, opts *ListOptions) (*ListCopilotSeatsResponse, *Response, error) { + u := fmt.Sprintf("orgs/%v/copilot/billing/seats", org) + + req, err := s.client.NewRequest("GET", u, opts) + if err != nil { + return nil, nil, err + } + + var copilotSeats *ListCopilotSeatsResponse + resp, err := s.client.Do(ctx, req, &copilotSeats) + if err != nil { + return nil, resp, err + } + + return copilotSeats, resp, nil +} + +// AddCopilotTeams adds teams to the Copilot for Business subscription for an organization. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-business#add-teams-to-the-copilot-business-subscription-for-an-organization +// +//meta:operation POST /orgs/{org}/copilot/billing/selected_teams +func (s *CopilotService) AddCopilotTeams(ctx context.Context, org string, teamNames []string) (*SeatAssignments, *Response, error) { + u := fmt.Sprintf("orgs/%v/copilot/billing/selected_teams", org) + + body := struct { + SelectedTeams []string `json:"selected_teams"` + }{ + SelectedTeams: teamNames, + } + + req, err := s.client.NewRequest("POST", u, body) + if err != nil { + return nil, nil, err + } + + var seatAssignments *SeatAssignments + resp, err := s.client.Do(ctx, req, &seatAssignments) + if err != nil { + return nil, resp, err + } + + return seatAssignments, resp, nil +} + +// RemoveCopilotTeams removes teams from the Copilot for Business subscription for an organization. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-business#remove-teams-from-the-copilot-business-subscription-for-an-organization +// +//meta:operation DELETE /orgs/{org}/copilot/billing/selected_teams +func (s *CopilotService) RemoveCopilotTeams(ctx context.Context, org string, teamNames []string) (*SeatCancellations, *Response, error) { + u := fmt.Sprintf("orgs/%v/copilot/billing/selected_teams", org) + + body := struct { + SelectedTeams []string `json:"selected_teams"` + }{ + SelectedTeams: teamNames, + } + + req, err := s.client.NewRequest("DELETE", u, body) + if err != nil { + return nil, nil, err + } + + var seatCancellations *SeatCancellations + resp, err := s.client.Do(ctx, req, &seatCancellations) + if err != nil { + return nil, resp, err + } + + return seatCancellations, resp, nil +} + +// AddCopilotUsers adds users to the Copilot for Business subscription for an organization +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-business#add-users-to-the-copilot-business-subscription-for-an-organization +// +//meta:operation POST /orgs/{org}/copilot/billing/selected_users +func (s *CopilotService) AddCopilotUsers(ctx context.Context, org string, users []string) (*SeatAssignments, *Response, error) { + u := fmt.Sprintf("orgs/%v/copilot/billing/selected_users", org) + + body := struct { + SelectedUsers []string `json:"selected_users"` + }{ + SelectedUsers: users, + } + + req, err := s.client.NewRequest("POST", u, body) + if err != nil { + return nil, nil, err + } + + var seatAssignments *SeatAssignments + resp, err := s.client.Do(ctx, req, &seatAssignments) + if err != nil { + return nil, resp, err + } + + return seatAssignments, resp, nil +} + +// RemoveCopilotUsers removes users from the Copilot for Business subscription for an organization. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-business#remove-users-from-the-copilot-business-subscription-for-an-organization +// +//meta:operation DELETE /orgs/{org}/copilot/billing/selected_users +func (s *CopilotService) RemoveCopilotUsers(ctx context.Context, org string, users []string) (*SeatCancellations, *Response, error) { + u := fmt.Sprintf("orgs/%v/copilot/billing/selected_users", org) + + body := struct { + SelectedUsers []string `json:"selected_users"` + }{ + SelectedUsers: users, + } + + req, err := s.client.NewRequest("DELETE", u, body) + if err != nil { + return nil, nil, err + } + + var seatCancellations *SeatCancellations + resp, err := s.client.Do(ctx, req, &seatCancellations) + if err != nil { + return nil, resp, err + } + + return seatCancellations, resp, nil +} + +// GetSeatDetails gets Copilot for Business seat assignment details for a user. +// +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-business#get-copilot-business-seat-assignment-details-for-a-user +// +//meta:operation GET /orgs/{org}/members/{username}/copilot +func (s *CopilotService) GetSeatDetails(ctx context.Context, org, user string) (*CopilotSeatDetails, *Response, error) { + u := fmt.Sprintf("orgs/%v/members/%v/copilot", org, user) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var seatDetails *CopilotSeatDetails + resp, err := s.client.Do(ctx, req, &seatDetails) + if err != nil { + return nil, resp, err + } + + return seatDetails, resp, nil +} diff --git a/github/copilot_test.go b/github/copilot_test.go new file mode 100644 index 00000000000..9df2c9a497d --- /dev/null +++ b/github/copilot_test.go @@ -0,0 +1,887 @@ +// Copyright 2023 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + "testing" + "time" + + "github.com/google/go-cmp/cmp" +) + +// Test invalid JSON responses, vlaid responses are covered in the other tests +func TestCopilotSeatDetails_UnmarshalJSON(t *testing.T) { + tests := []struct { + name string + data string + want *CopilotSeatDetails + wantErr bool + }{ + { + name: "Invalid JSON", + data: `{`, + want: &CopilotSeatDetails{ + Assignee: nil, + }, + wantErr: true, + }, + { + name: "Invalid top level type", + data: `{ + "assignee": { + "type": "User", + "name": "octokittens", + "id": 1 + }, + "assigning_team": "this should be an object" + }`, + want: &CopilotSeatDetails{}, + wantErr: true, + }, + { + name: "No Type Field", + data: `{ + "assignee": { + "name": "octokittens", + "id": 1 + } + }`, + want: &CopilotSeatDetails{}, + wantErr: true, + }, + { + name: "Invalid Assignee Field Type", + data: `{ + "assignee": "test" + }`, + want: &CopilotSeatDetails{}, + wantErr: true, + }, + { + name: "Invalid Assignee Type", + data: `{ + "assignee": { + "name": "octokittens", + "id": 1, + "type": [] + } + }`, + want: &CopilotSeatDetails{}, + wantErr: true, + }, + { + name: "Invalid User", + data: `{ + "assignee": { + "type": "User", + "id": "bad" + } + }`, + want: &CopilotSeatDetails{}, + wantErr: true, + }, + { + name: "Invalid Team", + data: `{ + "assignee": { + "type": "Team", + "id": "bad" + } + }`, + want: &CopilotSeatDetails{}, + wantErr: true, + }, + { + name: "Invalid Organization", + data: `{ + "assignee": { + "type": "Organization", + "id": "bad" + } + }`, + want: &CopilotSeatDetails{}, + wantErr: true, + }, + } + + for _, tc := range tests { + seatDetails := &CopilotSeatDetails{} + + t.Run(tc.name, func(t *testing.T) { + err := json.Unmarshal([]byte(tc.data), seatDetails) + if err == nil && tc.wantErr { + t.Errorf("CopilotSeatDetails.UnmarshalJSON returned nil instead of an error") + } + if err != nil && !tc.wantErr { + t.Errorf("CopilotSeatDetails.UnmarshalJSON returned an unexpected error: %v", err) + } + if !cmp.Equal(tc.want, seatDetails) { + t.Errorf("CopilotSeatDetails.UnmarshalJSON expected %+v, got %+v", tc.want, seatDetails) + } + }) + } +} + +func TestCopilotService_GetSeatDetailsUser(t *testing.T) { + data := `{ + "assignee": { + "type": "User", + "id": 1 + } + }` + + seatDetails := &CopilotSeatDetails{} + + err := json.Unmarshal([]byte(data), seatDetails) + if err != nil { + t.Errorf("CopilotSeatDetails.UnmarshalJSON returned an unexpected error: %v", err) + } + + want := &User{ + ID: Int64(1), + Type: String("User"), + } + + if got, ok := seatDetails.GetUser(); ok && !cmp.Equal(got, want) { + t.Errorf("CopilotSeatDetails.GetTeam returned %+v, want %+v", got, want) + } else if !ok { + t.Errorf("CopilotSeatDetails.GetUser returned false, expected true") + } + + data = `{ + "assignee": { + "type": "Organization", + "id": 1 + } + }` + + bad := &Organization{ + ID: Int64(1), + Type: String("Organization"), + } + + err = json.Unmarshal([]byte(data), seatDetails) + if err != nil { + t.Errorf("CopilotSeatDetails.UnmarshalJSON returned an unexpected error: %v", err) + } + + if got, ok := seatDetails.GetUser(); ok { + t.Errorf("CopilotSeatDetails.GetUser returned true, expected false. Returned %v, expected %v", got, bad) + } +} + +func TestCopilotService_GetSeatDetailsTeam(t *testing.T) { + data := `{ + "assignee": { + "type": "Team", + "id": 1 + } + }` + + seatDetails := &CopilotSeatDetails{} + + err := json.Unmarshal([]byte(data), seatDetails) + if err != nil { + t.Errorf("CopilotSeatDetails.UnmarshalJSON returned an unexpected error: %v", err) + } + + want := &Team{ + ID: Int64(1), + } + + if got, ok := seatDetails.GetTeam(); ok && !cmp.Equal(got, want) { + t.Errorf("CopilotSeatDetails.GetTeam returned %+v, want %+v", got, want) + } else if !ok { + t.Errorf("CopilotSeatDetails.GetTeam returned false, expected true") + } + + data = `{ + "assignee": { + "type": "User", + "id": 1 + } + }` + + bad := &User{ + ID: Int64(1), + Type: String("User"), + } + + err = json.Unmarshal([]byte(data), seatDetails) + if err != nil { + t.Errorf("CopilotSeatDetails.UnmarshalJSON returned an unexpected error: %v", err) + } + + if got, ok := seatDetails.GetTeam(); ok { + t.Errorf("CopilotSeatDetails.GetTeam returned true, expected false. Returned %v, expected %v", got, bad) + } +} + +func TestCopilotService_GetSeatDetailsOrganization(t *testing.T) { + data := `{ + "assignee": { + "type": "Organization", + "id": 1 + } + }` + + seatDetails := &CopilotSeatDetails{} + + err := json.Unmarshal([]byte(data), seatDetails) + if err != nil { + t.Errorf("CopilotSeatDetails.UnmarshalJSON returned an unexpected error: %v", err) + } + + want := &Organization{ + ID: Int64(1), + Type: String("Organization"), + } + + if got, ok := seatDetails.GetOrganization(); ok && !cmp.Equal(got, want) { + t.Errorf("CopilotSeatDetails.GetOrganization returned %+v, want %+v", got, want) + } else if !ok { + t.Errorf("CopilotSeatDetails.GetOrganization returned false, expected true") + } + + data = `{ + "assignee": { + "type": "Team", + "id": 1 + } + }` + + bad := &Team{ + ID: Int64(1), + } + + err = json.Unmarshal([]byte(data), seatDetails) + if err != nil { + t.Errorf("CopilotSeatDetails.UnmarshalJSON returned an unexpected error: %v", err) + } + + if got, ok := seatDetails.GetOrganization(); ok { + t.Errorf("CopilotSeatDetails.GetOrganization returned true, expected false. Returned %v, expected %v", got, bad) + } +} + +func TestCopilotService_GetCopilotBilling(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/orgs/o/copilot/billing", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + fmt.Fprint(w, `{ + "seat_breakdown": { + "total": 12, + "added_this_cycle": 9, + "pending_invitation": 0, + "pending_cancellation": 0, + "active_this_cycle": 12, + "inactive_this_cycle": 11 + }, + "seat_management_setting": "assign_selected", + "public_code_suggestions": "block" + }`) + }) + + ctx := context.Background() + got, _, err := client.Copilot.GetCopilotBilling(ctx, "o") + if err != nil { + t.Errorf("Copilot.GetCopilotBilling returned error: %v", err) + } + + want := &CopilotOrganizationDetails{ + SeatBreakdown: &CopilotSeatBreakdown{ + Total: 12, + AddedThisCycle: 9, + PendingInvitation: 0, + PendingCancellation: 0, + ActiveThisCycle: 12, + InactiveThisCycle: 11, + }, + PublicCodeSuggestions: "block", + CopilotChat: "", + SeatManagementSetting: "assign_selected", + } + if !cmp.Equal(got, want) { + t.Errorf("Copilot.GetCopilotBilling returned %+v, want %+v", got, want) + } + + const methodName = "GetCopilotBilling" + + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Copilot.GetCopilotBilling(ctx, "\n") + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Copilot.GetCopilotBilling(ctx, "o") + if got != nil { + t.Errorf("Copilot.GetCopilotBilling returned %+v, want nil", got) + } + return resp, err + }) +} + +func TestCopilotService_ListCopilotSeats(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/orgs/o/copilot/billing/seats", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + fmt.Fprint(w, `{ + "total_seats": 4, + "seats": [ + { + "created_at": "2021-08-03T18:00:00-06:00", + "updated_at": "2021-09-23T15:00:00-06:00", + "pending_cancellation_date": null, + "last_activity_at": "2021-10-14T00:53:32-06:00", + "last_activity_editor": "vscode/1.77.3/copilot/1.86.82", + "assignee": { + "login": "octocat", + "id": 1, + "node_id": "MDQ6VXNlcjE=", + "avatar_url": "https://github.com/images/error/octocat_happy.gif", + "gravatar_id": "", + "url": "https://api.github.com/users/octocat", + "html_url": "https://github.com/octocat", + "followers_url": "https://api.github.com/users/octocat/followers", + "following_url": "https://api.github.com/users/octocat/following{/other_user}", + "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", + "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", + "organizations_url": "https://api.github.com/users/octocat/orgs", + "repos_url": "https://api.github.com/users/octocat/repos", + "events_url": "https://api.github.com/users/octocat/events{/privacy}", + "received_events_url": "https://api.github.com/users/octocat/received_events", + "type": "User", + "site_admin": false + }, + "assigning_team": { + "id": 1, + "node_id": "MDQ6VGVhbTE=", + "url": "https://api.github.com/teams/1", + "html_url": "https://github.com/orgs/github/teams/justice-league", + "name": "Justice League", + "slug": "justice-league", + "description": "A great team.", + "privacy": "closed", + "notification_setting": "notifications_enabled", + "permission": "admin", + "members_url": "https://api.github.com/teams/1/members{/member}", + "repositories_url": "https://api.github.com/teams/1/repos", + "parent": null + } + }, + { + "created_at": "2021-09-23T18:00:00-06:00", + "updated_at": "2021-09-23T15:00:00-06:00", + "pending_cancellation_date": "2021-11-01", + "last_activity_at": "2021-10-13T00:53:32-06:00", + "last_activity_editor": "vscode/1.77.3/copilot/1.86.82", + "assignee": { + "login": "octokitten", + "id": 1, + "node_id": "MDQ76VNlcjE=", + "avatar_url": "https://github.com/images/error/octokitten_happy.gif", + "gravatar_id": "", + "url": "https://api.github.com/users/octokitten", + "html_url": "https://github.com/octokitten", + "followers_url": "https://api.github.com/users/octokitten/followers", + "following_url": "https://api.github.com/users/octokitten/following{/other_user}", + "gists_url": "https://api.github.com/users/octokitten/gists{/gist_id}", + "starred_url": "https://api.github.com/users/octokitten/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/octokitten/subscriptions", + "organizations_url": "https://api.github.com/users/octokitten/orgs", + "repos_url": "https://api.github.com/users/octokitten/repos", + "events_url": "https://api.github.com/users/octokitten/events{/privacy}", + "received_events_url": "https://api.github.com/users/octokitten/received_events", + "type": "User", + "site_admin": false + } + }, + { + "created_at": "2021-09-23T18:00:00-06:00", + "updated_at": "2021-09-23T15:00:00-06:00", + "pending_cancellation_date": "2021-11-01", + "last_activity_at": "2021-10-13T00:53:32-06:00", + "last_activity_editor": "vscode/1.77.3/copilot/1.86.82", + "assignee": { + "name": "octokittens", + "id": 1, + "type": "Team" + } + }, + { + "created_at": "2021-09-23T18:00:00-06:00", + "updated_at": "2021-09-23T15:00:00-06:00", + "pending_cancellation_date": "2021-11-01", + "last_activity_at": "2021-10-13T00:53:32-06:00", + "last_activity_editor": "vscode/1.77.3/copilot/1.86.82", + "assignee": { + "name": "octocats", + "id": 1, + "type": "Organization" + } + } + ] + }`) + }) + + tmp, err := time.Parse(time.RFC3339, "2021-08-03T18:00:00-06:00") + if err != nil { + panic(err) + } + createdAt1 := Timestamp{tmp} + + tmp, err = time.Parse(time.RFC3339, "2021-09-23T15:00:00-06:00") + if err != nil { + panic(err) + } + updatedAt1 := Timestamp{tmp} + + tmp, err = time.Parse(time.RFC3339, "2021-10-14T00:53:32-06:00") + if err != nil { + panic(err) + } + lastActivityAt1 := Timestamp{tmp} + + tmp, err = time.Parse(time.RFC3339, "2021-09-23T18:00:00-06:00") + if err != nil { + panic(err) + } + createdAt2 := Timestamp{tmp} + + tmp, err = time.Parse(time.RFC3339, "2021-09-23T15:00:00-06:00") + if err != nil { + panic(err) + } + updatedAt2 := Timestamp{tmp} + + tmp, err = time.Parse(time.RFC3339, "2021-10-13T00:53:32-06:00") + if err != nil { + panic(err) + } + lastActivityAt2 := Timestamp{tmp} + + ctx := context.Background() + got, _, err := client.Copilot.ListCopilotSeats(ctx, "o", nil) + if err != nil { + t.Errorf("Copilot.ListCopilotSeats returned error: %v", err) + } + + want := &ListCopilotSeatsResponse{ + TotalSeats: 4, + Seats: []*CopilotSeatDetails{ + { + Assignee: &User{ + Login: String("octocat"), + ID: Int64(1), + NodeID: String("MDQ6VXNlcjE="), + AvatarURL: String("https://github.com/images/error/octocat_happy.gif"), + GravatarID: String(""), + URL: String("https://api.github.com/users/octocat"), + HTMLURL: String("https://github.com/octocat"), + FollowersURL: String("https://api.github.com/users/octocat/followers"), + FollowingURL: String("https://api.github.com/users/octocat/following{/other_user}"), + GistsURL: String("https://api.github.com/users/octocat/gists{/gist_id}"), + StarredURL: String("https://api.github.com/users/octocat/starred{/owner}{/repo}"), + SubscriptionsURL: String("https://api.github.com/users/octocat/subscriptions"), + OrganizationsURL: String("https://api.github.com/users/octocat/orgs"), + ReposURL: String("https://api.github.com/users/octocat/repos"), + EventsURL: String("https://api.github.com/users/octocat/events{/privacy}"), + ReceivedEventsURL: String("https://api.github.com/users/octocat/received_events"), + Type: String("User"), + SiteAdmin: Bool(false), + }, + AssigningTeam: &Team{ + ID: Int64(1), + NodeID: String("MDQ6VGVhbTE="), + URL: String("https://api.github.com/teams/1"), + HTMLURL: String("https://github.com/orgs/github/teams/justice-league"), + Name: String("Justice League"), + Slug: String("justice-league"), + Description: String("A great team."), + Privacy: String("closed"), + Permission: String("admin"), + MembersURL: String("https://api.github.com/teams/1/members{/member}"), + RepositoriesURL: String("https://api.github.com/teams/1/repos"), + Parent: nil, + }, + CreatedAt: &createdAt1, + UpdatedAt: &updatedAt1, + PendingCancellationDate: nil, + LastActivityAt: &lastActivityAt1, + LastActivityEditor: String("vscode/1.77.3/copilot/1.86.82"), + }, + { + Assignee: &User{ + Login: String("octokitten"), + ID: Int64(1), + NodeID: String("MDQ76VNlcjE="), + AvatarURL: String("https://github.com/images/error/octokitten_happy.gif"), + GravatarID: String(""), + URL: String("https://api.github.com/users/octokitten"), + HTMLURL: String("https://github.com/octokitten"), + FollowersURL: String("https://api.github.com/users/octokitten/followers"), + FollowingURL: String("https://api.github.com/users/octokitten/following{/other_user}"), + GistsURL: String("https://api.github.com/users/octokitten/gists{/gist_id}"), + StarredURL: String("https://api.github.com/users/octokitten/starred{/owner}{/repo}"), + SubscriptionsURL: String("https://api.github.com/users/octokitten/subscriptions"), + OrganizationsURL: String("https://api.github.com/users/octokitten/orgs"), + ReposURL: String("https://api.github.com/users/octokitten/repos"), + EventsURL: String("https://api.github.com/users/octokitten/events{/privacy}"), + ReceivedEventsURL: String("https://api.github.com/users/octokitten/received_events"), + Type: String("User"), + SiteAdmin: Bool(false), + }, + AssigningTeam: nil, + CreatedAt: &createdAt2, + UpdatedAt: &updatedAt2, + PendingCancellationDate: String("2021-11-01"), + LastActivityAt: &lastActivityAt2, + LastActivityEditor: String("vscode/1.77.3/copilot/1.86.82"), + }, + { + Assignee: &Team{ + ID: Int64(1), + Name: String("octokittens"), + }, + AssigningTeam: nil, + CreatedAt: &createdAt2, + UpdatedAt: &updatedAt2, + PendingCancellationDate: String("2021-11-01"), + LastActivityAt: &lastActivityAt2, + LastActivityEditor: String("vscode/1.77.3/copilot/1.86.82"), + }, + { + Assignee: &Organization{ + ID: Int64(1), + Name: String("octocats"), + Type: String("Organization"), + }, + AssigningTeam: nil, + CreatedAt: &createdAt2, + UpdatedAt: &updatedAt2, + PendingCancellationDate: String("2021-11-01"), + LastActivityAt: &lastActivityAt2, + LastActivityEditor: String("vscode/1.77.3/copilot/1.86.82"), + }, + }, + } + + if !cmp.Equal(got, want) { + t.Errorf("Copilot.ListCopilotSeats returned %+v, want %+v", got, want) + } + + const methodName = "ListCopilotSeats" + + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Copilot.ListCopilotSeats(ctx, "\n", nil) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Copilot.ListCopilotSeats(ctx, "", nil) + if got != nil { + t.Errorf("Copilot.ListCopilotSeats returned %+v, want nil", got) + } + return resp, err + }) +} + +func TestCopilotService_AddCopilotTeams(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/orgs/o/copilot/billing/selected_teams", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "POST") + testBody(t, r, `{"selected_teams":["team1","team2"]}`+"\n") + fmt.Fprint(w, `{"seats_created": 2}`) + }) + + ctx := context.Background() + got, _, err := client.Copilot.AddCopilotTeams(ctx, "o", []string{"team1", "team2"}) + if err != nil { + t.Errorf("Copilot.AddCopilotTeams returned error: %v", err) + } + + want := &SeatAssignments{SeatsCreated: 2} + + if !cmp.Equal(got, want) { + t.Errorf("Copilot.AddCopilotTeams returned %+v, want %+v", got, want) + } + + const methodName = "AddCopilotTeams" + + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Copilot.AddCopilotTeams(ctx, "\n", []string{"team1", "team2"}) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Copilot.AddCopilotTeams(ctx, "o", []string{"team1", "team2"}) + if got != nil { + t.Errorf("Copilot.AddCopilotTeams returned %+v, want nil", got) + } + return resp, err + }) +} + +func TestCopilotService_RemoveCopilotTeams(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/orgs/o/copilot/billing/selected_teams", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "DELETE") + testBody(t, r, `{"selected_teams":["team1","team2"]}`+"\n") + fmt.Fprint(w, `{"seats_cancelled": 2}`) + }) + + ctx := context.Background() + got, _, err := client.Copilot.RemoveCopilotTeams(ctx, "o", []string{"team1", "team2"}) + if err != nil { + t.Errorf("Copilot.RemoveCopilotTeams returned error: %v", err) + } + + want := &SeatCancellations{SeatsCancelled: 2} + + if !cmp.Equal(got, want) { + t.Errorf("Copilot.RemoveCopilotTeams returned %+v, want %+v", got, want) + } + + const methodName = "RemoveCopilotTeams" + + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Copilot.RemoveCopilotTeams(ctx, "\n", []string{"team1", "team2"}) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Copilot.RemoveCopilotTeams(ctx, "o", []string{"team1", "team2"}) + if got != nil { + t.Errorf("Copilot.RemoveCopilotTeams returned %+v, want nil", got) + } + return resp, err + }) +} + +func TestCopilotService_AddCopilotUsers(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/orgs/o/copilot/billing/selected_users", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "POST") + testBody(t, r, `{"selected_users":["user1","user2"]}`+"\n") + fmt.Fprint(w, `{"seats_created": 2}`) + }) + + ctx := context.Background() + got, _, err := client.Copilot.AddCopilotUsers(ctx, "o", []string{"user1", "user2"}) + if err != nil { + t.Errorf("Copilot.AddCopilotUsers returned error: %v", err) + } + + want := &SeatAssignments{SeatsCreated: 2} + + if !cmp.Equal(got, want) { + t.Errorf("Copilot.AddCopilotUsers returned %+v, want %+v", got, want) + } + + const methodName = "AddCopilotUsers" + + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Copilot.AddCopilotUsers(ctx, "\n", []string{"user1", "user2"}) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Copilot.AddCopilotUsers(ctx, "o", []string{"user1", "user2"}) + if got != nil { + t.Errorf("Copilot.AddCopilotUsers returned %+v, want nil", got) + } + return resp, err + }) +} + +func TestCopilotService_RemoveCopilotUsers(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/orgs/o/copilot/billing/selected_users", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "DELETE") + testBody(t, r, `{"selected_users":["user1","user2"]}`+"\n") + fmt.Fprint(w, `{"seats_cancelled": 2}`) + }) + + ctx := context.Background() + got, _, err := client.Copilot.RemoveCopilotUsers(ctx, "o", []string{"user1", "user2"}) + if err != nil { + t.Errorf("Copilot.RemoveCopilotUsers returned error: %v", err) + } + + want := &SeatCancellations{SeatsCancelled: 2} + + if !cmp.Equal(got, want) { + t.Errorf("Copilot.RemoveCopilotUsers returned %+v, want %+v", got, want) + } + + const methodName = "RemoveCopilotUsers" + + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Copilot.RemoveCopilotUsers(ctx, "\n", []string{"user1", "user2"}) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Copilot.RemoveCopilotUsers(ctx, "o", []string{"user1", "user2"}) + if got != nil { + t.Errorf("Copilot.RemoveCopilotUsers returned %+v, want nil", got) + } + return resp, err + }) +} + +func TestCopilotService_GetSeatDetails(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/orgs/o/members/u/copilot", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + fmt.Fprint(w, `{ + "created_at": "2021-08-03T18:00:00-06:00", + "updated_at": "2021-09-23T15:00:00-06:00", + "pending_cancellation_date": null, + "last_activity_at": "2021-10-14T00:53:32-06:00", + "last_activity_editor": "vscode/1.77.3/copilot/1.86.82", + "assignee": { + "login": "octocat", + "id": 1, + "node_id": "MDQ6VXNlcjE=", + "avatar_url": "https://github.com/images/error/octocat_happy.gif", + "gravatar_id": "", + "url": "https://api.github.com/users/octocat", + "html_url": "https://github.com/octocat", + "followers_url": "https://api.github.com/users/octocat/followers", + "following_url": "https://api.github.com/users/octocat/following{/other_user}", + "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", + "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", + "organizations_url": "https://api.github.com/users/octocat/orgs", + "repos_url": "https://api.github.com/users/octocat/repos", + "events_url": "https://api.github.com/users/octocat/events{/privacy}", + "received_events_url": "https://api.github.com/users/octocat/received_events", + "type": "User", + "site_admin": false + }, + "assigning_team": { + "id": 1, + "node_id": "MDQ6VGVhbTE=", + "url": "https://api.github.com/teams/1", + "html_url": "https://github.com/orgs/github/teams/justice-league", + "name": "Justice League", + "slug": "justice-league", + "description": "A great team.", + "privacy": "closed", + "notification_setting": "notifications_enabled", + "permission": "admin", + "members_url": "https://api.github.com/teams/1/members{/member}", + "repositories_url": "https://api.github.com/teams/1/repos", + "parent": null + } + }`) + }) + + tmp, err := time.Parse(time.RFC3339, "2021-08-03T18:00:00-06:00") + if err != nil { + panic(err) + } + createdAt := Timestamp{tmp} + + tmp, err = time.Parse(time.RFC3339, "2021-09-23T15:00:00-06:00") + if err != nil { + panic(err) + } + updatedAt := Timestamp{tmp} + + tmp, err = time.Parse(time.RFC3339, "2021-10-14T00:53:32-06:00") + if err != nil { + panic(err) + } + lastActivityAt := Timestamp{tmp} + + ctx := context.Background() + got, _, err := client.Copilot.GetSeatDetails(ctx, "o", "u") + if err != nil { + t.Errorf("Copilot.GetSeatDetails returned error: %v", err) + } + + want := &CopilotSeatDetails{ + Assignee: &User{ + Login: String("octocat"), + ID: Int64(1), + NodeID: String("MDQ6VXNlcjE="), + AvatarURL: String("https://github.com/images/error/octocat_happy.gif"), + GravatarID: String(""), + URL: String("https://api.github.com/users/octocat"), + HTMLURL: String("https://github.com/octocat"), + FollowersURL: String("https://api.github.com/users/octocat/followers"), + FollowingURL: String("https://api.github.com/users/octocat/following{/other_user}"), + GistsURL: String("https://api.github.com/users/octocat/gists{/gist_id}"), + StarredURL: String("https://api.github.com/users/octocat/starred{/owner}{/repo}"), + SubscriptionsURL: String("https://api.github.com/users/octocat/subscriptions"), + OrganizationsURL: String("https://api.github.com/users/octocat/orgs"), + ReposURL: String("https://api.github.com/users/octocat/repos"), + EventsURL: String("https://api.github.com/users/octocat/events{/privacy}"), + ReceivedEventsURL: String("https://api.github.com/users/octocat/received_events"), + Type: String("User"), + SiteAdmin: Bool(false), + }, + AssigningTeam: &Team{ + ID: Int64(1), + NodeID: String("MDQ6VGVhbTE="), + URL: String("https://api.github.com/teams/1"), + HTMLURL: String("https://github.com/orgs/github/teams/justice-league"), + Name: String("Justice League"), + Slug: String("justice-league"), + Description: String("A great team."), + Privacy: String("closed"), + Permission: String("admin"), + MembersURL: String("https://api.github.com/teams/1/members{/member}"), + RepositoriesURL: String("https://api.github.com/teams/1/repos"), + Parent: nil, + }, + CreatedAt: &createdAt, + UpdatedAt: &updatedAt, + PendingCancellationDate: nil, + LastActivityAt: &lastActivityAt, + LastActivityEditor: String("vscode/1.77.3/copilot/1.86.82"), + } + + if !cmp.Equal(got, want) { + t.Errorf("Copilot.GetSeatDetails returned %+v, want %+v", got, want) + } + + const methodName = "GetSeatDetails" + + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Copilot.GetSeatDetails(ctx, "\n", "u") + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Copilot.GetSeatDetails(ctx, "o", "u") + if got != nil { + t.Errorf("Copilot.GetSeatDetails returned %+v, want nil", got) + } + return resp, err + }) +} diff --git a/github/github-accessors.go b/github/github-accessors.go index f41409f9e6c..3f24a795e5c 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -4014,6 +4014,62 @@ func (c *ContributorStats) GetTotal() int { return *c.Total } +// GetSeatBreakdown returns the SeatBreakdown field. +func (c *CopilotOrganizationDetails) GetSeatBreakdown() *CopilotSeatBreakdown { + if c == nil { + return nil + } + return c.SeatBreakdown +} + +// GetAssigningTeam returns the AssigningTeam field. +func (c *CopilotSeatDetails) GetAssigningTeam() *Team { + if c == nil { + return nil + } + return c.AssigningTeam +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (c *CopilotSeatDetails) GetCreatedAt() Timestamp { + if c == nil || c.CreatedAt == nil { + return Timestamp{} + } + return *c.CreatedAt +} + +// GetLastActivityAt returns the LastActivityAt field if it's non-nil, zero value otherwise. +func (c *CopilotSeatDetails) GetLastActivityAt() Timestamp { + if c == nil || c.LastActivityAt == nil { + return Timestamp{} + } + return *c.LastActivityAt +} + +// GetLastActivityEditor returns the LastActivityEditor field if it's non-nil, zero value otherwise. +func (c *CopilotSeatDetails) GetLastActivityEditor() string { + if c == nil || c.LastActivityEditor == nil { + return "" + } + return *c.LastActivityEditor +} + +// GetPendingCancellationDate returns the PendingCancellationDate field if it's non-nil, zero value otherwise. +func (c *CopilotSeatDetails) GetPendingCancellationDate() string { + if c == nil || c.PendingCancellationDate == nil { + return "" + } + return *c.PendingCancellationDate +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (c *CopilotSeatDetails) GetUpdatedAt() Timestamp { + if c == nil || c.UpdatedAt == nil { + return Timestamp{} + } + return *c.UpdatedAt +} + // GetCompletedAt returns the CompletedAt field if it's non-nil, zero value otherwise. func (c *CreateCheckRunOptions) GetCompletedAt() Timestamp { if c == nil || c.CompletedAt == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 5b0b9911bdb..e575fea2526 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -4709,6 +4709,70 @@ func TestContributorStats_GetTotal(tt *testing.T) { c.GetTotal() } +func TestCopilotOrganizationDetails_GetSeatBreakdown(tt *testing.T) { + c := &CopilotOrganizationDetails{} + c.GetSeatBreakdown() + c = nil + c.GetSeatBreakdown() +} + +func TestCopilotSeatDetails_GetAssigningTeam(tt *testing.T) { + c := &CopilotSeatDetails{} + c.GetAssigningTeam() + c = nil + c.GetAssigningTeam() +} + +func TestCopilotSeatDetails_GetCreatedAt(tt *testing.T) { + var zeroValue Timestamp + c := &CopilotSeatDetails{CreatedAt: &zeroValue} + c.GetCreatedAt() + c = &CopilotSeatDetails{} + c.GetCreatedAt() + c = nil + c.GetCreatedAt() +} + +func TestCopilotSeatDetails_GetLastActivityAt(tt *testing.T) { + var zeroValue Timestamp + c := &CopilotSeatDetails{LastActivityAt: &zeroValue} + c.GetLastActivityAt() + c = &CopilotSeatDetails{} + c.GetLastActivityAt() + c = nil + c.GetLastActivityAt() +} + +func TestCopilotSeatDetails_GetLastActivityEditor(tt *testing.T) { + var zeroValue string + c := &CopilotSeatDetails{LastActivityEditor: &zeroValue} + c.GetLastActivityEditor() + c = &CopilotSeatDetails{} + c.GetLastActivityEditor() + c = nil + c.GetLastActivityEditor() +} + +func TestCopilotSeatDetails_GetPendingCancellationDate(tt *testing.T) { + var zeroValue string + c := &CopilotSeatDetails{PendingCancellationDate: &zeroValue} + c.GetPendingCancellationDate() + c = &CopilotSeatDetails{} + c.GetPendingCancellationDate() + c = nil + c.GetPendingCancellationDate() +} + +func TestCopilotSeatDetails_GetUpdatedAt(tt *testing.T) { + var zeroValue Timestamp + c := &CopilotSeatDetails{UpdatedAt: &zeroValue} + c.GetUpdatedAt() + c = &CopilotSeatDetails{} + c.GetUpdatedAt() + c = nil + c.GetUpdatedAt() +} + func TestCreateCheckRunOptions_GetCompletedAt(tt *testing.T) { var zeroValue Timestamp c := &CreateCheckRunOptions{CompletedAt: &zeroValue} diff --git a/github/github.go b/github/github.go index da4f2d067ee..0b00655243e 100644 --- a/github/github.go +++ b/github/github.go @@ -186,6 +186,7 @@ type Client struct { CodeScanning *CodeScanningService CodesOfConduct *CodesOfConductService Codespaces *CodespacesService + Copilot *CopilotService Dependabot *DependabotService DependencyGraph *DependencyGraphService Emojis *EmojisService @@ -414,6 +415,7 @@ func (c *Client) initialize() { c.CodeScanning = (*CodeScanningService)(&c.common) c.Codespaces = (*CodespacesService)(&c.common) c.CodesOfConduct = (*CodesOfConductService)(&c.common) + c.Copilot = (*CopilotService)(&c.common) c.Dependabot = (*DependabotService)(&c.common) c.DependencyGraph = (*DependencyGraphService)(&c.common) c.Emojis = (*EmojisService)(&c.common) From a6f50f1b02b66fb31671a4ecc5ab75d07dc791ed Mon Sep 17 00:00:00 2001 From: Jesse Haka Date: Tue, 19 Dec 2023 22:30:31 +0200 Subject: [PATCH 079/145] Fix copilot API payload (#3034) --- github/copilot.go | 8 ++++---- github/copilot_test.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/github/copilot.go b/github/copilot.go index 3f3d73b25bc..51c938c9748 100644 --- a/github/copilot.go +++ b/github/copilot.go @@ -241,9 +241,9 @@ func (s *CopilotService) AddCopilotUsers(ctx context.Context, org string, users u := fmt.Sprintf("orgs/%v/copilot/billing/selected_users", org) body := struct { - SelectedUsers []string `json:"selected_users"` + SelectedUsernames []string `json:"selected_usernames"` }{ - SelectedUsers: users, + SelectedUsernames: users, } req, err := s.client.NewRequest("POST", u, body) @@ -269,9 +269,9 @@ func (s *CopilotService) RemoveCopilotUsers(ctx context.Context, org string, use u := fmt.Sprintf("orgs/%v/copilot/billing/selected_users", org) body := struct { - SelectedUsers []string `json:"selected_users"` + SelectedUsernames []string `json:"selected_usernames"` }{ - SelectedUsers: users, + SelectedUsernames: users, } req, err := s.client.NewRequest("DELETE", u, body) diff --git a/github/copilot_test.go b/github/copilot_test.go index 9df2c9a497d..c65fda0f217 100644 --- a/github/copilot_test.go +++ b/github/copilot_test.go @@ -680,7 +680,7 @@ func TestCopilotService_AddCopilotUsers(t *testing.T) { mux.HandleFunc("/orgs/o/copilot/billing/selected_users", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") - testBody(t, r, `{"selected_users":["user1","user2"]}`+"\n") + testBody(t, r, `{"selected_usernames":["user1","user2"]}`+"\n") fmt.Fprint(w, `{"seats_created": 2}`) }) @@ -718,7 +718,7 @@ func TestCopilotService_RemoveCopilotUsers(t *testing.T) { mux.HandleFunc("/orgs/o/copilot/billing/selected_users", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") - testBody(t, r, `{"selected_users":["user1","user2"]}`+"\n") + testBody(t, r, `{"selected_usernames":["user1","user2"]}`+"\n") fmt.Fprint(w, `{"seats_cancelled": 2}`) }) From 2d0bd43a44220ae01f2ea3d179fab16cf57845c2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 19 Dec 2023 19:27:30 -0500 Subject: [PATCH 080/145] Bump golang.org/x/crypto from 0.14.0 to 0.17.0 in /example (#3033) --- example/go.mod | 6 +++--- example/go.sum | 16 +++++++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/example/go.mod b/example/go.mod index a2bfe50f63d..efda4229223 100644 --- a/example/go.mod +++ b/example/go.mod @@ -7,8 +7,8 @@ require ( github.com/bradleyfalzon/ghinstallation/v2 v2.0.4 github.com/gofri/go-github-ratelimit v1.0.3 github.com/google/go-github/v57 v57.0.0 - golang.org/x/crypto v0.14.0 - golang.org/x/term v0.13.0 + golang.org/x/crypto v0.17.0 + golang.org/x/term v0.15.0 google.golang.org/appengine v1.6.7 ) @@ -19,7 +19,7 @@ require ( github.com/google/go-github/v41 v41.0.0 // indirect github.com/google/go-querystring v1.1.0 // indirect golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.13.0 // indirect + golang.org/x/sys v0.15.0 // indirect google.golang.org/protobuf v1.28.0 // indirect ) diff --git a/example/go.sum b/example/go.sum index be6272956d8..567182ec3d7 100644 --- a/example/go.sum +++ b/example/go.sum @@ -18,6 +18,7 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-github/v41 v41.0.0 h1:HseJrM2JFf2vfiZJ8anY2hqBjdfY1Vlj/K27ueww4gg= github.com/google/go-github/v41 v41.0.0/go.mod h1:XgmCA5H323A9rtgExdTcnDkcqp6S30AVACCBDOonIxg= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= @@ -28,8 +29,9 @@ golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= +golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= @@ -39,6 +41,7 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -54,15 +57,19 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= +golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= +golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -70,6 +77,9 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= From a7c8db8ddbc65e8b03516abec383988b0a9ba87d Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Tue, 19 Dec 2023 19:35:37 -0500 Subject: [PATCH 081/145] Fix example/go.sum (#3035) --- example/go.sum | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/example/go.sum b/example/go.sum index 567182ec3d7..4679434efea 100644 --- a/example/go.sum +++ b/example/go.sum @@ -18,7 +18,6 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-github/v41 v41.0.0 h1:HseJrM2JFf2vfiZJ8anY2hqBjdfY1Vlj/K27ueww4gg= github.com/google/go-github/v41 v41.0.0/go.mod h1:XgmCA5H323A9rtgExdTcnDkcqp6S30AVACCBDOonIxg= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= @@ -29,7 +28,6 @@ golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= @@ -41,7 +39,6 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -57,8 +54,6 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -66,8 +61,6 @@ golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuX golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= -golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -77,9 +70,6 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= From 3bb05c23365b24a9a99d692e39c5fde50b88be69 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 19 Dec 2023 20:09:28 -0500 Subject: [PATCH 082/145] Bump github.com/getkin/kin-openapi from 0.120.0 to 0.122.0 in /tools (#3015) --- tools/go.mod | 2 +- tools/go.sum | 4 ++-- tools/metadata/main_test.go | 35 +++++++++++++++-------------------- tools/metadata/openapi.go | 2 +- 4 files changed, 19 insertions(+), 24 deletions(-) diff --git a/tools/go.mod b/tools/go.mod index 25cef1fd110..ce710420ec3 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/alecthomas/kong v0.8.1 - github.com/getkin/kin-openapi v0.120.0 + github.com/getkin/kin-openapi v0.122.0 github.com/google/go-cmp v0.6.0 github.com/google/go-github/v57 v57.0.0 golang.org/x/sync v0.5.0 diff --git a/tools/go.sum b/tools/go.sum index 099ce0450dd..29b5dfebe54 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -6,8 +6,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/getkin/kin-openapi v0.120.0 h1:MqJcNJFrMDFNc07iwE8iFC5eT2k/NPUFDIpNeiZv8Jg= -github.com/getkin/kin-openapi v0.120.0/go.mod h1:PCWw/lfBrJY4HcdqE3jj+QFkaFK8ABoqo7PvqVhXXqw= +github.com/getkin/kin-openapi v0.122.0 h1:WB9Jbl0Hp/T79/JF9xlSW5Kl9uYdk/AWD0yAd9HOM10= +github.com/getkin/kin-openapi v0.122.0/go.mod h1:PCWw/lfBrJY4HcdqE3jj+QFkaFK8ABoqo7PvqVhXXqw= github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= diff --git a/tools/metadata/main_test.go b/tools/metadata/main_test.go index 17de07d79a0..a00c11ba090 100644 --- a/tools/metadata/main_test.go +++ b/tools/metadata/main_test.go @@ -66,59 +66,54 @@ GET /undocumented/{undocumented_id} func TestUpdateOpenAPI(t *testing.T) { testServer := newTestServer(t, "main", map[string]interface{}{ "api.github.com/api.github.com.json": openapi3.T{ - Paths: openapi3.Paths{ - "/a/{a_id}": &openapi3.PathItem{ + Paths: openapi3.NewPaths( + openapi3.WithPath("/a/{a_id}", &openapi3.PathItem{ Get: &openapi3.Operation{ ExternalDocs: &openapi3.ExternalDocs{ URL: "https://docs.github.com/rest/reference/a", }, }, - }, - }, + })), }, "ghec/ghec.json": openapi3.T{ - Paths: openapi3.Paths{ - "/a/b/{a_id}": &openapi3.PathItem{ + Paths: openapi3.NewPaths( + openapi3.WithPath("/a/b/{a_id}", &openapi3.PathItem{ Get: &openapi3.Operation{ ExternalDocs: &openapi3.ExternalDocs{ URL: "https://docs.github.com/rest/reference/a", }, }, - }, - }, + })), }, "ghes-3.9/ghes-3.9.json": openapi3.T{ - Paths: openapi3.Paths{ - "/a/b/{a_id}": &openapi3.PathItem{ + Paths: openapi3.NewPaths( + openapi3.WithPath("/a/b/{a_id}", &openapi3.PathItem{ Get: &openapi3.Operation{ ExternalDocs: &openapi3.ExternalDocs{ URL: "https://docs.github.com/rest/reference/a", }, }, - }, - }, + })), }, "ghes-3.10/ghes-3.10.json": openapi3.T{ - Paths: openapi3.Paths{ - "/a/b/{a_id}": &openapi3.PathItem{ + Paths: openapi3.NewPaths( + openapi3.WithPath("/a/b/{a_id}", &openapi3.PathItem{ Get: &openapi3.Operation{ ExternalDocs: &openapi3.ExternalDocs{ URL: "https://docs.github.com/rest/reference/a", }, }, - }, - }, + })), }, "ghes-2.22/ghes-2.22.json": openapi3.T{ - Paths: openapi3.Paths{ - "/a/b/{a_id}": &openapi3.PathItem{ + Paths: openapi3.NewPaths( + openapi3.WithPath("/a/b/{a_id}", &openapi3.PathItem{ Get: &openapi3.Operation{ ExternalDocs: &openapi3.ExternalDocs{ URL: "https://docs.github.com/rest/reference/a", }, }, - }, - }, + })), }, }) diff --git a/tools/metadata/openapi.go b/tools/metadata/openapi.go index 0804a47020b..327b7afba87 100644 --- a/tools/metadata/openapi.go +++ b/tools/metadata/openapi.go @@ -40,7 +40,7 @@ func getOpsFromGithub(ctx context.Context, client *github.Client, gitRef string) } var ops []*operation for _, desc := range descs { - for p, pathItem := range desc.description.Paths { + for p, pathItem := range desc.description.Paths.Map() { for method, op := range pathItem.Operations() { docURL := "" if op.ExternalDocs != nil { From b40c811fdcd3abbf6423486e8528a86ee7c1cf45 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Jan 2024 13:09:06 -0500 Subject: [PATCH 083/145] Bump github.com/cloudflare/circl from 1.3.3 to 1.3.7 in /example (#3039) --- example/go.mod | 2 +- example/go.sum | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/example/go.mod b/example/go.mod index efda4229223..bc636639439 100644 --- a/example/go.mod +++ b/example/go.mod @@ -13,7 +13,7 @@ require ( ) require ( - github.com/cloudflare/circl v1.3.3 // indirect + github.com/cloudflare/circl v1.3.7 // indirect github.com/golang-jwt/jwt/v4 v4.0.0 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/google/go-github/v41 v41.0.0 // indirect diff --git a/example/go.sum b/example/go.sum index 4679434efea..1bdf8355928 100644 --- a/example/go.sum +++ b/example/go.sum @@ -3,8 +3,9 @@ github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371/go.mod h1:EjA github.com/bradleyfalzon/ghinstallation/v2 v2.0.4 h1:tXKVfhE7FcSkhkv0UwkLvPDeZ4kz6OXd0PKPlFqf81M= github.com/bradleyfalzon/ghinstallation/v2 v2.0.4/go.mod h1:B40qPqJxWE0jDZgOR1JmaMy+4AY1eBP+IByOvqyAKp0= github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= -github.com/cloudflare/circl v1.3.3 h1:fE/Qz0QdIGqeWfnwq0RE0R7MI51s0M2E4Ga9kq5AEMs= github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= +github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU= +github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA= github.com/gofri/go-github-ratelimit v1.0.3 h1:Ocs2jaYokZDzgvqaajX+g04dqFyVqL0JQzoO7d2wmlk= github.com/gofri/go-github-ratelimit v1.0.3/go.mod h1:OnCi5gV+hAG/LMR7llGhU7yHt44se9sYgKPnafoL7RY= github.com/golang-jwt/jwt/v4 v4.0.0 h1:RAqyYixv1p7uEnocuy8P1nru5wprCh/MH2BIlW5z5/o= From c462160a1b9bdc89a7e0b3b111c8a64e0c986f90 Mon Sep 17 00:00:00 2001 From: Noble Varghese Date: Tue, 9 Jan 2024 00:44:09 +0530 Subject: [PATCH 084/145] Add Repo and Action to IssueEvent (#3040) Fixes: #3038. --- github/github-accessors.go | 8 ++++++++ github/github-accessors_test.go | 7 +++++++ github/issues_events.go | 4 ++++ 3 files changed, 19 insertions(+) diff --git a/github/github-accessors.go b/github/github-accessors.go index 3f24a795e5c..256bfacfb50 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -9510,6 +9510,14 @@ func (i *IssueEvent) GetRename() *Rename { return i.Rename } +// GetRepository returns the Repository field. +func (i *IssueEvent) GetRepository() *Repository { + if i == nil { + return nil + } + return i.Repository +} + // GetRequestedReviewer returns the RequestedReviewer field. func (i *IssueEvent) GetRequestedReviewer() *User { if i == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index e575fea2526..461ce8ed7eb 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -11096,6 +11096,13 @@ func TestIssueEvent_GetRename(tt *testing.T) { i.GetRename() } +func TestIssueEvent_GetRepository(tt *testing.T) { + i := &IssueEvent{} + i.GetRepository() + i = nil + i.GetRepository() +} + func TestIssueEvent_GetRequestedReviewer(tt *testing.T) { i := &IssueEvent{} i.GetRequestedReviewer() diff --git a/github/issues_events.go b/github/issues_events.go index 23a16bcdc72..bba3b180311 100644 --- a/github/issues_events.go +++ b/github/issues_events.go @@ -18,6 +18,9 @@ type IssueEvent struct { // The User that generated this event. Actor *User `json:"actor,omitempty"` + // The action corresponding to the event. + Action string `json:"action,omitempty"` + // Event identifies the actual type of Event that occurred. Possible // values are: // @@ -74,6 +77,7 @@ type IssueEvent struct { Issue *Issue `json:"issue,omitempty"` // Only present on certain events; see above. + Repository *Repository `json:"repository,omitempty"` Assignee *User `json:"assignee,omitempty"` Assigner *User `json:"assigner,omitempty"` CommitID *string `json:"commit_id,omitempty"` From 5c8ee0baaeb2b0859a4f58638d78bc9cd46c6be8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Jan 2024 14:43:53 -0500 Subject: [PATCH 085/145] Bump golang.org/x/sync from 0.5.0 to 0.6.0 in /tools (#3041) --- tools/go.mod | 2 +- tools/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/go.mod b/tools/go.mod index ce710420ec3..c0de3b4fade 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -7,7 +7,7 @@ require ( github.com/getkin/kin-openapi v0.122.0 github.com/google/go-cmp v0.6.0 github.com/google/go-github/v57 v57.0.0 - golang.org/x/sync v0.5.0 + golang.org/x/sync v0.6.0 gopkg.in/yaml.v3 v3.0.1 ) diff --git a/tools/go.sum b/tools/go.sum index 29b5dfebe54..7ba38eeec66 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -47,8 +47,8 @@ github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= -golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= -golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= From f5496494e2789e2a3d0c39f771701a2ed7f8105b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Jan 2024 16:01:49 -0500 Subject: [PATCH 086/145] Bump golang.org/x/net from 0.19.0 to 0.20.0 in /scrape (#3042) --- scrape/go.mod | 2 +- scrape/go.sum | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scrape/go.mod b/scrape/go.mod index 08daf2365b9..230c795b6ea 100644 --- a/scrape/go.mod +++ b/scrape/go.mod @@ -7,5 +7,5 @@ require ( github.com/google/go-cmp v0.6.0 github.com/google/go-github/v57 v57.0.0 github.com/xlzd/gotp v0.1.0 - golang.org/x/net v0.19.0 + golang.org/x/net v0.20.0 ) diff --git a/scrape/go.sum b/scrape/go.sum index 44051859775..1b43790fc67 100644 --- a/scrape/go.sum +++ b/scrape/go.sum @@ -14,7 +14,7 @@ github.com/xlzd/gotp v0.1.0/go.mod h1:ndLJ3JKzi3xLmUProq4LLxCuECL93dG9WASNLpHz8q github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -24,8 +24,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= -golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -37,12 +37,12 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= -golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= +golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= From eb3bed00ca77f6e718f034d07008e6f7cfd93b17 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Tue, 9 Jan 2024 22:35:15 -0500 Subject: [PATCH 087/145] Bump version of go-github to v58.0.0 (#3045) --- README.md | 15 ++++++++------- example/actionpermissions/main.go | 2 +- example/appengine/app.go | 2 +- example/basicauth/main.go | 2 +- .../codespaces/newreposecretwithxcrypto/main.go | 2 +- .../codespaces/newusersecretwithxcrypto/main.go | 2 +- example/commitpr/main.go | 2 +- example/go.mod | 6 +++--- example/listenvironments/main.go | 2 +- example/migrations/main.go | 2 +- example/newfilewithappauth/main.go | 2 +- example/newrepo/main.go | 2 +- example/newreposecretwithlibsodium/go.mod | 4 ++-- example/newreposecretwithlibsodium/main.go | 2 +- example/newreposecretwithxcrypto/main.go | 2 +- example/ratelimit/main.go | 2 +- example/simple/main.go | 2 +- example/tagprotection/main.go | 2 +- example/tokenauth/main.go | 2 +- example/topics/main.go | 2 +- github/doc.go | 2 +- github/examples_test.go | 2 +- github/github.go | 2 +- go.mod | 2 +- test/fields/fields.go | 2 +- test/integration/activity_test.go | 2 +- test/integration/authorizations_test.go | 2 +- test/integration/github_test.go | 2 +- test/integration/repos_test.go | 2 +- test/integration/users_test.go | 2 +- tools/go.mod | 4 ++-- tools/metadata/main.go | 2 +- tools/metadata/main_test.go | 2 +- tools/metadata/metadata.go | 2 +- tools/metadata/openapi.go | 2 +- 35 files changed, 46 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index f10c43df8c4..099fd37311d 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # go-github # [![go-github release (latest SemVer)](https://img.shields.io/github/v/release/google/go-github?sort=semver)](https://github.com/google/go-github/releases) -[![GoDoc](https://img.shields.io/static/v1?label=godoc&message=reference&color=blue)](https://pkg.go.dev/github.com/google/go-github/v57/github) +[![GoDoc](https://img.shields.io/static/v1?label=godoc&message=reference&color=blue)](https://pkg.go.dev/github.com/google/go-github/v58/github) [![Test Status](https://github.com/google/go-github/workflows/tests/badge.svg)](https://github.com/google/go-github/actions?query=workflow%3Atests) [![Test Coverage](https://codecov.io/gh/google/go-github/branch/master/graph/badge.svg)](https://codecov.io/gh/google/go-github) [![Discuss at go-github@googlegroups.com](https://img.shields.io/badge/discuss-go--github%40googlegroups.com-blue.svg)](https://groups.google.com/group/go-github) @@ -24,7 +24,7 @@ If you're interested in using the [GraphQL API v4][], the recommended library is go-github is compatible with modern Go releases in module mode, with Go installed: ```bash -go get github.com/google/go-github/v57 +go get github.com/google/go-github/v58 ``` will resolve and add the package to the current development module, along with its dependencies. @@ -32,7 +32,7 @@ will resolve and add the package to the current development module, along with i Alternatively the same can be achieved if you use import in a package: ```go -import "github.com/google/go-github/v57/github" +import "github.com/google/go-github/v58/github" ``` and run `go get` without parameters. @@ -40,13 +40,13 @@ and run `go get` without parameters. Finally, to use the top-of-trunk version of this repo, use the following command: ```bash -go get github.com/google/go-github/v57@master +go get github.com/google/go-github/v58@master ``` ## Usage ## ```go -import "github.com/google/go-github/v57/github" // with go modules enabled (GO111MODULE=on or outside GOPATH) +import "github.com/google/go-github/v58/github" // with go modules enabled (GO111MODULE=on or outside GOPATH) import "github.com/google/go-github/github" // with go modules disabled ``` @@ -117,7 +117,7 @@ import ( "net/http" "github.com/bradleyfalzon/ghinstallation/v2" - "github.com/google/go-github/v57/github" + "github.com/google/go-github/v58/github" ) func main() { @@ -296,7 +296,7 @@ For complete usage of go-github, see the full [package docs][]. [GitHub API v3]: https://docs.github.com/en/rest [personal access token]: https://github.com/blog/1509-personal-api-tokens -[package docs]: https://pkg.go.dev/github.com/google/go-github/v57/github +[package docs]: https://pkg.go.dev/github.com/google/go-github/v58/github [GraphQL API v4]: https://developer.github.com/v4/ [shurcooL/githubv4]: https://github.com/shurcooL/githubv4 [GitHub webhook events]: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads @@ -369,6 +369,7 @@ Versions prior to 48.2.0 are not listed. | go-github Version | GitHub v3 API Version | | ----------------- | --------------------- | +| 58.0.0 | 2022-11-28 | | 57.0.0 | 2022-11-28 | | 56.0.0 | 2022-11-28 | | 55.0.0 | 2022-11-28 | diff --git a/example/actionpermissions/main.go b/example/actionpermissions/main.go index a37c0043209..ab1a4c9413d 100644 --- a/example/actionpermissions/main.go +++ b/example/actionpermissions/main.go @@ -14,7 +14,7 @@ import ( "log" "os" - "github.com/google/go-github/v57/github" + "github.com/google/go-github/v58/github" ) var ( diff --git a/example/appengine/app.go b/example/appengine/app.go index 496bca402b3..998a5271904 100644 --- a/example/appengine/app.go +++ b/example/appengine/app.go @@ -12,7 +12,7 @@ import ( "net/http" "os" - "github.com/google/go-github/v57/github" + "github.com/google/go-github/v58/github" "google.golang.org/appengine" "google.golang.org/appengine/log" ) diff --git a/example/basicauth/main.go b/example/basicauth/main.go index 48f9170b5bc..958ccafb74e 100644 --- a/example/basicauth/main.go +++ b/example/basicauth/main.go @@ -21,7 +21,7 @@ import ( "os" "strings" - "github.com/google/go-github/v57/github" + "github.com/google/go-github/v58/github" "golang.org/x/term" ) diff --git a/example/codespaces/newreposecretwithxcrypto/main.go b/example/codespaces/newreposecretwithxcrypto/main.go index da1dabab76d..0e4afb30bd3 100644 --- a/example/codespaces/newreposecretwithxcrypto/main.go +++ b/example/codespaces/newreposecretwithxcrypto/main.go @@ -36,7 +36,7 @@ import ( "log" "os" - "github.com/google/go-github/v57/github" + "github.com/google/go-github/v58/github" "golang.org/x/crypto/nacl/box" ) diff --git a/example/codespaces/newusersecretwithxcrypto/main.go b/example/codespaces/newusersecretwithxcrypto/main.go index 860c5161b77..e6746fa146f 100644 --- a/example/codespaces/newusersecretwithxcrypto/main.go +++ b/example/codespaces/newusersecretwithxcrypto/main.go @@ -37,7 +37,7 @@ import ( "log" "os" - "github.com/google/go-github/v57/github" + "github.com/google/go-github/v58/github" "golang.org/x/crypto/nacl/box" ) diff --git a/example/commitpr/main.go b/example/commitpr/main.go index 9e4098c916b..8e21f503d80 100644 --- a/example/commitpr/main.go +++ b/example/commitpr/main.go @@ -33,7 +33,7 @@ import ( "time" "github.com/ProtonMail/go-crypto/openpgp" - "github.com/google/go-github/v57/github" + "github.com/google/go-github/v58/github" ) var ( diff --git a/example/go.mod b/example/go.mod index bc636639439..ea991adb3da 100644 --- a/example/go.mod +++ b/example/go.mod @@ -1,4 +1,4 @@ -module github.com/google/go-github/v57/example +module github.com/google/go-github/v58/example go 1.17 @@ -6,7 +6,7 @@ require ( github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 github.com/bradleyfalzon/ghinstallation/v2 v2.0.4 github.com/gofri/go-github-ratelimit v1.0.3 - github.com/google/go-github/v57 v57.0.0 + github.com/google/go-github/v58 v58.0.0 golang.org/x/crypto v0.17.0 golang.org/x/term v0.15.0 google.golang.org/appengine v1.6.7 @@ -24,4 +24,4 @@ require ( ) // Use version at HEAD, not the latest published. -replace github.com/google/go-github/v57 => ../ +replace github.com/google/go-github/v58 => ../ diff --git a/example/listenvironments/main.go b/example/listenvironments/main.go index 936f5470cf2..ce02614cf54 100644 --- a/example/listenvironments/main.go +++ b/example/listenvironments/main.go @@ -18,7 +18,7 @@ import ( "log" "os" - "github.com/google/go-github/v57/github" + "github.com/google/go-github/v58/github" ) func main() { diff --git a/example/migrations/main.go b/example/migrations/main.go index 81872e062f2..39b67d1e2f3 100644 --- a/example/migrations/main.go +++ b/example/migrations/main.go @@ -12,7 +12,7 @@ import ( "context" "fmt" - "github.com/google/go-github/v57/github" + "github.com/google/go-github/v58/github" ) func fetchAllUserMigrations() ([]*github.UserMigration, error) { diff --git a/example/newfilewithappauth/main.go b/example/newfilewithappauth/main.go index 670021a99dd..3162174d451 100644 --- a/example/newfilewithappauth/main.go +++ b/example/newfilewithappauth/main.go @@ -16,7 +16,7 @@ import ( "time" "github.com/bradleyfalzon/ghinstallation/v2" - "github.com/google/go-github/v57/github" + "github.com/google/go-github/v58/github" ) func main() { diff --git a/example/newrepo/main.go b/example/newrepo/main.go index 21cb7f52a9d..405e54d7aeb 100644 --- a/example/newrepo/main.go +++ b/example/newrepo/main.go @@ -16,7 +16,7 @@ import ( "log" "os" - "github.com/google/go-github/v57/github" + "github.com/google/go-github/v58/github" ) var ( diff --git a/example/newreposecretwithlibsodium/go.mod b/example/newreposecretwithlibsodium/go.mod index 81a013ee37a..8b0c2e2ad7c 100644 --- a/example/newreposecretwithlibsodium/go.mod +++ b/example/newreposecretwithlibsodium/go.mod @@ -4,8 +4,8 @@ go 1.15 require ( github.com/GoKillers/libsodium-go v0.0.0-20171022220152-dd733721c3cb - github.com/google/go-github/v57 v57.0.0 + github.com/google/go-github/v58 v58.0.0 ) // Use version at HEAD, not the latest published. -replace github.com/google/go-github/v57 => ../.. +replace github.com/google/go-github/v58 => ../.. diff --git a/example/newreposecretwithlibsodium/main.go b/example/newreposecretwithlibsodium/main.go index c022562d353..a134ffee183 100644 --- a/example/newreposecretwithlibsodium/main.go +++ b/example/newreposecretwithlibsodium/main.go @@ -36,7 +36,7 @@ import ( "os" sodium "github.com/GoKillers/libsodium-go/cryptobox" - "github.com/google/go-github/v57/github" + "github.com/google/go-github/v58/github" ) var ( diff --git a/example/newreposecretwithxcrypto/main.go b/example/newreposecretwithxcrypto/main.go index b7366908e1c..c77455c3174 100644 --- a/example/newreposecretwithxcrypto/main.go +++ b/example/newreposecretwithxcrypto/main.go @@ -36,7 +36,7 @@ import ( "log" "os" - "github.com/google/go-github/v57/github" + "github.com/google/go-github/v58/github" "golang.org/x/crypto/nacl/box" ) diff --git a/example/ratelimit/main.go b/example/ratelimit/main.go index 67a8b0de483..0898c7a8338 100644 --- a/example/ratelimit/main.go +++ b/example/ratelimit/main.go @@ -13,7 +13,7 @@ import ( "fmt" "github.com/gofri/go-github-ratelimit/github_ratelimit" - "github.com/google/go-github/v57/github" + "github.com/google/go-github/v58/github" ) func main() { diff --git a/example/simple/main.go b/example/simple/main.go index 70206e7f00f..f85a6bfcacf 100644 --- a/example/simple/main.go +++ b/example/simple/main.go @@ -12,7 +12,7 @@ import ( "context" "fmt" - "github.com/google/go-github/v57/github" + "github.com/google/go-github/v58/github" ) // Fetch all the public organizations' membership of a user. diff --git a/example/tagprotection/main.go b/example/tagprotection/main.go index 40a00af2b0d..d2bdea046d2 100644 --- a/example/tagprotection/main.go +++ b/example/tagprotection/main.go @@ -18,7 +18,7 @@ import ( "os" "strings" - "github.com/google/go-github/v57/github" + "github.com/google/go-github/v58/github" "golang.org/x/term" ) diff --git a/example/tokenauth/main.go b/example/tokenauth/main.go index e27b72b1a0e..4666dedd19d 100644 --- a/example/tokenauth/main.go +++ b/example/tokenauth/main.go @@ -15,7 +15,7 @@ import ( "log" "os" - "github.com/google/go-github/v57/github" + "github.com/google/go-github/v58/github" "golang.org/x/term" ) diff --git a/example/topics/main.go b/example/topics/main.go index a23f1b3a0d7..d2a5c3f5c1f 100644 --- a/example/topics/main.go +++ b/example/topics/main.go @@ -12,7 +12,7 @@ import ( "context" "fmt" - "github.com/google/go-github/v57/github" + "github.com/google/go-github/v58/github" ) // Fetch and lists all the public topics associated with the specified GitHub topic diff --git a/github/doc.go b/github/doc.go index ca00a4bd049..5fcf8b03691 100644 --- a/github/doc.go +++ b/github/doc.go @@ -8,7 +8,7 @@ Package github provides a client for using the GitHub API. Usage: - import "github.com/google/go-github/v57/github" // with go modules enabled (GO111MODULE=on or outside GOPATH) + import "github.com/google/go-github/v58/github" // with go modules enabled (GO111MODULE=on or outside GOPATH) import "github.com/google/go-github/github" // with go modules disabled Construct a new GitHub client, then use the various services on the client to diff --git a/github/examples_test.go b/github/examples_test.go index d1070be4663..d58c6e41cff 100644 --- a/github/examples_test.go +++ b/github/examples_test.go @@ -12,7 +12,7 @@ import ( "fmt" "log" - "github.com/google/go-github/v57/github" + "github.com/google/go-github/v58/github" ) func ExampleMarkdownService_Render() { diff --git a/github/github.go b/github/github.go index 0b00655243e..7378d3f2039 100644 --- a/github/github.go +++ b/github/github.go @@ -28,7 +28,7 @@ import ( ) const ( - Version = "v57.0.0" + Version = "v58.0.0" defaultAPIVersion = "2022-11-28" defaultBaseURL = "https://api.github.com/" diff --git a/go.mod b/go.mod index 51c7c0e3327..d4fd03ba937 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/google/go-github/v57 +module github.com/google/go-github/v58 require ( github.com/google/go-cmp v0.6.0 diff --git a/test/fields/fields.go b/test/fields/fields.go index fc9f29672c5..6c823364ffe 100644 --- a/test/fields/fields.go +++ b/test/fields/fields.go @@ -25,7 +25,7 @@ import ( "reflect" "strings" - "github.com/google/go-github/v57/github" + "github.com/google/go-github/v58/github" ) var ( diff --git a/test/integration/activity_test.go b/test/integration/activity_test.go index b32bb5a02f7..79131193cb9 100644 --- a/test/integration/activity_test.go +++ b/test/integration/activity_test.go @@ -12,7 +12,7 @@ import ( "context" "testing" - "github.com/google/go-github/v57/github" + "github.com/google/go-github/v58/github" ) const ( diff --git a/test/integration/authorizations_test.go b/test/integration/authorizations_test.go index 61ec0239feb..aa5c4d94580 100644 --- a/test/integration/authorizations_test.go +++ b/test/integration/authorizations_test.go @@ -15,7 +15,7 @@ import ( "testing" "time" - "github.com/google/go-github/v57/github" + "github.com/google/go-github/v58/github" ) const msgEnvMissing = "Skipping test because the required environment variable (%v) is not present." diff --git a/test/integration/github_test.go b/test/integration/github_test.go index 81753b6bbb8..692e9e91466 100644 --- a/test/integration/github_test.go +++ b/test/integration/github_test.go @@ -15,7 +15,7 @@ import ( "net/http" "os" - "github.com/google/go-github/v57/github" + "github.com/google/go-github/v58/github" ) var ( diff --git a/test/integration/repos_test.go b/test/integration/repos_test.go index a4ead783846..32d02cab81d 100644 --- a/test/integration/repos_test.go +++ b/test/integration/repos_test.go @@ -15,7 +15,7 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/google/go-github/v57/github" + "github.com/google/go-github/v58/github" ) func TestRepositories_CRUD(t *testing.T) { diff --git a/test/integration/users_test.go b/test/integration/users_test.go index 448b5af7ffe..fc479b25859 100644 --- a/test/integration/users_test.go +++ b/test/integration/users_test.go @@ -14,7 +14,7 @@ import ( "math/rand" "testing" - "github.com/google/go-github/v57/github" + "github.com/google/go-github/v58/github" ) func TestUsers_Get(t *testing.T) { diff --git a/tools/go.mod b/tools/go.mod index c0de3b4fade..c36b9fecbbc 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -6,7 +6,7 @@ require ( github.com/alecthomas/kong v0.8.1 github.com/getkin/kin-openapi v0.122.0 github.com/google/go-cmp v0.6.0 - github.com/google/go-github/v57 v57.0.0 + github.com/google/go-github/v58 v58.0.0 golang.org/x/sync v0.6.0 gopkg.in/yaml.v3 v3.0.1 ) @@ -24,4 +24,4 @@ require ( ) // Use version at HEAD, not the latest published. -replace github.com/google/go-github/v57 => ../ +replace github.com/google/go-github/v58 => ../ diff --git a/tools/metadata/main.go b/tools/metadata/main.go index 1ab2b7d2d50..1b8d754b90c 100644 --- a/tools/metadata/main.go +++ b/tools/metadata/main.go @@ -15,7 +15,7 @@ import ( "path/filepath" "github.com/alecthomas/kong" - "github.com/google/go-github/v57/github" + "github.com/google/go-github/v58/github" ) var helpVars = kong.Vars{ diff --git a/tools/metadata/main_test.go b/tools/metadata/main_test.go index a00c11ba090..001f2eeead3 100644 --- a/tools/metadata/main_test.go +++ b/tools/metadata/main_test.go @@ -23,7 +23,7 @@ import ( "github.com/alecthomas/kong" "github.com/getkin/kin-openapi/openapi3" "github.com/google/go-cmp/cmp" - "github.com/google/go-github/v57/github" + "github.com/google/go-github/v58/github" ) func TestUpdateGo(t *testing.T) { diff --git a/tools/metadata/metadata.go b/tools/metadata/metadata.go index 079ff5c698b..834ccae8fce 100644 --- a/tools/metadata/metadata.go +++ b/tools/metadata/metadata.go @@ -24,7 +24,7 @@ import ( "strings" "sync" - "github.com/google/go-github/v57/github" + "github.com/google/go-github/v58/github" "gopkg.in/yaml.v3" ) diff --git a/tools/metadata/openapi.go b/tools/metadata/openapi.go index 327b7afba87..55697e389a4 100644 --- a/tools/metadata/openapi.go +++ b/tools/metadata/openapi.go @@ -14,7 +14,7 @@ import ( "strconv" "github.com/getkin/kin-openapi/openapi3" - "github.com/google/go-github/v57/github" + "github.com/google/go-github/v58/github" "golang.org/x/sync/errgroup" ) From 9231a0f0bc205f0535a29361d773a77da5e39294 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Tue, 9 Jan 2024 22:45:20 -0500 Subject: [PATCH 088/145] Bump go-github from v57 to v58 in /scrape (#3046) --- scrape/apps.go | 2 +- scrape/apps_test.go | 2 +- scrape/go.mod | 2 +- scrape/go.sum | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scrape/apps.go b/scrape/apps.go index 0f26fe8f2e5..f2dd84da609 100644 --- a/scrape/apps.go +++ b/scrape/apps.go @@ -17,7 +17,7 @@ import ( "strings" "github.com/PuerkitoBio/goquery" - "github.com/google/go-github/v57/github" + "github.com/google/go-github/v58/github" ) // AppRestrictionsEnabled returns whether the specified organization has diff --git a/scrape/apps_test.go b/scrape/apps_test.go index 9b486e6a535..dd0b006e56d 100644 --- a/scrape/apps_test.go +++ b/scrape/apps_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/google/go-github/v57/github" + "github.com/google/go-github/v58/github" ) func Test_AppRestrictionsEnabled(t *testing.T) { diff --git a/scrape/go.mod b/scrape/go.mod index 230c795b6ea..48a03a23bc4 100644 --- a/scrape/go.mod +++ b/scrape/go.mod @@ -5,7 +5,7 @@ go 1.13 require ( github.com/PuerkitoBio/goquery v1.8.1 github.com/google/go-cmp v0.6.0 - github.com/google/go-github/v57 v57.0.0 + github.com/google/go-github/v58 v58.0.0 github.com/xlzd/gotp v0.1.0 golang.org/x/net v0.20.0 ) diff --git a/scrape/go.sum b/scrape/go.sum index 1b43790fc67..245655f139a 100644 --- a/scrape/go.sum +++ b/scrape/go.sum @@ -5,8 +5,8 @@ github.com/andybalholm/cascadia v1.3.1/go.mod h1:R4bJ1UQfqADjvDa4P6HZHLh/3OxWWEq github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-github/v57 v57.0.0 h1:L+Y3UPTY8ALM8x+TV0lg+IEBI+upibemtBD8Q9u7zHs= -github.com/google/go-github/v57 v57.0.0/go.mod h1:s0omdnye0hvK/ecLvpsGfJMiRt85PimQh4oygmLIxHw= +github.com/google/go-github/v58 v58.0.0 h1:Una7GGERlF/37XfkPwpzYJe0Vp4dt2k1kCjlxwjIvzw= +github.com/google/go-github/v58 v58.0.0/go.mod h1:k4hxDKEfoWpSqFlc8LTpGd9fu2KrV1YAa6Hi6FmDNY4= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/xlzd/gotp v0.1.0 h1:37blvlKCh38s+fkem+fFh7sMnceltoIEBYTVXyoa5Po= From 207a38df70d69be52b461ac124b818d81601c601 Mon Sep 17 00:00:00 2001 From: "M. Ryan Rigdon" Date: Wed, 10 Jan 2024 09:19:09 -0500 Subject: [PATCH 089/145] Fix issue in AcceptedError handling for UploadSarif (#3047) Fixes: #3036. --- github/code-scanning.go | 18 +++++++++++++++--- github/code-scanning_test.go | 14 ++++++++++++-- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/github/code-scanning.go b/github/code-scanning.go index 74a7b6c9b47..a8fca98a92d 100644 --- a/github/code-scanning.go +++ b/github/code-scanning.go @@ -7,6 +7,8 @@ package github import ( "context" + "encoding/json" + "errors" "fmt" "strconv" "strings" @@ -389,11 +391,21 @@ func (s *CodeScanningService) UploadSarif(ctx context.Context, owner, repo strin return nil, nil, err } - sarifID := new(SarifID) - resp, err := s.client.Do(ctx, req, sarifID) - if err != nil { + // This will always return an error without unmarshalling the data + resp, err := s.client.Do(ctx, req, nil) + // Even though there was an error, we still return the response + // in case the caller wants to inspect it further. + // However, if the error is AcceptedError, decode it below before + // returning from this function and closing the response body. + var acceptedError *AcceptedError + if !errors.As(err, &acceptedError) { return nil, resp, err } + sarifID := new(SarifID) + decErr := json.Unmarshal(acceptedError.Raw, sarifID) + if decErr != nil { + return nil, resp, decErr + } return sarifID, resp, nil } diff --git a/github/code-scanning_test.go b/github/code-scanning_test.go index 4fbe45e7813..a081a6ba5f1 100644 --- a/github/code-scanning_test.go +++ b/github/code-scanning_test.go @@ -58,6 +58,11 @@ func TestCodeScanningService_UploadSarif(t *testing.T) { client, mux, _, teardown := setup() defer teardown() + expectedSarifID := &SarifID{ + ID: String("testid"), + URL: String("https://example.com/testurl"), + } + mux.HandleFunc("/repos/o/r/code-scanning/sarifs", func(w http.ResponseWriter, r *http.Request) { v := new(SarifAnalysis) assertNilError(t, json.NewDecoder(r.Body).Decode(v)) @@ -67,15 +72,20 @@ func TestCodeScanningService_UploadSarif(t *testing.T) { t.Errorf("Request body = %+v, want %+v", v, want) } - fmt.Fprint(w, `{"commit_sha":"abc","ref":"ref/head/main","sarif":"abc"}`) + w.WriteHeader(http.StatusAccepted) + respBody, _ := json.Marshal(expectedSarifID) + _, _ = w.Write(respBody) }) ctx := context.Background() sarifAnalysis := &SarifAnalysis{CommitSHA: String("abc"), Ref: String("ref/head/main"), Sarif: String("abc"), CheckoutURI: String("uri"), StartedAt: &Timestamp{time.Date(2006, time.January, 02, 15, 04, 05, 0, time.UTC)}, ToolName: String("codeql-cli")} - _, _, err := client.CodeScanning.UploadSarif(ctx, "o", "r", sarifAnalysis) + respSarifID, _, err := client.CodeScanning.UploadSarif(ctx, "o", "r", sarifAnalysis) if err != nil { t.Errorf("CodeScanning.UploadSarif returned error: %v", err) } + if !cmp.Equal(expectedSarifID, respSarifID) { + t.Errorf("Sarif response = %+v, want %+v", respSarifID, expectedSarifID) + } const methodName = "UploadSarif" testBadOptions(t, methodName, func() (err error) { From e9f52699f5e55a4791567bce668f56446e6343ef Mon Sep 17 00:00:00 2001 From: Andreas Deininger Date: Thu, 11 Jan 2024 20:34:43 +0100 Subject: [PATCH 090/145] Fix typos (#3048) --- example/newfilewithappauth/main.go | 4 ++-- github/dependabot_alerts.go | 4 ++-- github/event_types.go | 2 +- github/github.go | 2 +- github/strings_test.go | 2 +- github/teams_test.go | 4 ++-- tools/metadata/testdata/update-go/invalid/github/a.go | 1 + tools/metadata/testdata/update-go/valid/github/a.go | 2 ++ 8 files changed, 12 insertions(+), 9 deletions(-) diff --git a/example/newfilewithappauth/main.go b/example/newfilewithappauth/main.go index 3162174d451..0e7c0899564 100644 --- a/example/newfilewithappauth/main.go +++ b/example/newfilewithappauth/main.go @@ -29,7 +29,7 @@ func main() { itr, err := ghinstallation.NewAppsTransport(http.DefaultTransport, 10, privatePem) if err != nil { - log.Fatalf("faild to create app transport: %v\n", err) + log.Fatalf("failed to create app transport: %v\n", err) } itr.BaseURL = gitHost @@ -42,7 +42,7 @@ func main() { ).WithEnterpriseURLs(gitHost, gitHost) if err != nil { - log.Fatalf("faild to create git client for app: %v\n", err) + log.Fatalf("failed to create git client for app: %v\n", err) } installations, _, err := client.Apps.ListInstallations(context.Background(), &github.ListOptions{}) diff --git a/github/dependabot_alerts.go b/github/dependabot_alerts.go index f1ed126c217..c274f07bece 100644 --- a/github/dependabot_alerts.go +++ b/github/dependabot_alerts.go @@ -10,7 +10,7 @@ import ( "fmt" ) -// Dependency reprensents the vulnerable dependency. +// Dependency represents the vulnerable dependency. type Dependency struct { Package *VulnerabilityPackage `json:"package,omitempty"` ManifestPath *string `json:"manifest_path,omitempty"` @@ -23,7 +23,7 @@ type AdvisoryCVSS struct { VectorString *string `json:"vector_string,omitempty"` } -// AdvisoryCWEs reprensent the advisory pertaining to Common Weakness Enumeration. +// AdvisoryCWEs represent the advisory pertaining to Common Weakness Enumeration. type AdvisoryCWEs struct { CWEID *string `json:"cwe_id,omitempty"` Name *string `json:"name,omitempty"` diff --git a/github/event_types.go b/github/event_types.go index badd29b2a01..db7c7c69efe 100644 --- a/github/event_types.go +++ b/github/event_types.go @@ -1389,7 +1389,7 @@ type ReleaseEvent struct { // RepositoryEvent is triggered when a repository is created, archived, unarchived, // renamed, edited, transferred, made public, or made private. Organization hooks are -// also trigerred when a repository is deleted. +// also triggered when a repository is deleted. // The Webhook event name is "repository". // // Events of this type are not visible in timelines, they are only used to diff --git a/github/github.go b/github/github.go index 7378d3f2039..8bc35e5efe2 100644 --- a/github/github.go +++ b/github/github.go @@ -901,7 +901,7 @@ func (c *Client) BareDo(ctx context.Context, req *http.Request) (*Response, erro // JSON decoded and stored in the value pointed to by v, or returned as an // error if an API error has occurred. If v implements the io.Writer interface, // the raw response body will be written to v, without attempting to first -// decode it. If v is nil, and no error hapens, the response is returned as is. +// decode it. If v is nil, and no error happens, the response is returned as is. // If rate limit is exceeded and reset time is in the future, Do returns // *RateLimitError immediately without making a network API call. // diff --git a/github/strings_test.go b/github/strings_test.go index 10074f08bdf..fc0f6bafcf3 100644 --- a/github/strings_test.go +++ b/github/strings_test.go @@ -80,7 +80,7 @@ func TestStringify(t *testing.T) { } // Directly test the String() methods on various GitHub types. We don't do an -// exaustive test of all the various field types, since TestStringify() above +// exhaustive test of all the various field types, since TestStringify() above // takes care of that. Rather, we just make sure that Stringify() is being // used to build the strings, which we do by verifying that pointers are // stringified as their underlying value. diff --git a/github/teams_test.go b/github/teams_test.go index d215605c618..c0ca1f6dd71 100644 --- a/github/teams_test.go +++ b/github/teams_test.go @@ -872,7 +872,7 @@ func TestTeamsService_AddTeamRepoByID_noAccess(t *testing.T) { ctx := context.Background() _, err := client.Teams.AddTeamRepoByID(ctx, 1, 1, "owner", "repo", nil) if err == nil { - t.Errorf("Expcted error to be returned") + t.Errorf("Expected error to be returned") } } @@ -888,7 +888,7 @@ func TestTeamsService_AddTeamRepoBySlug_noAccess(t *testing.T) { ctx := context.Background() _, err := client.Teams.AddTeamRepoBySlug(ctx, "org", "slug", "owner", "repo", nil) if err == nil { - t.Errorf("Expcted error to be returned") + t.Errorf("Expected error to be returned") } } diff --git a/tools/metadata/testdata/update-go/invalid/github/a.go b/tools/metadata/testdata/update-go/invalid/github/a.go index ceef5fb5963..3f58dd2b846 100644 --- a/tools/metadata/testdata/update-go/invalid/github/a.go +++ b/tools/metadata/testdata/update-go/invalid/github/a.go @@ -18,6 +18,7 @@ func (*AService) Ambiguous() {} func (*AService) MissingOperation() {} // DuplicateOperations has duplicate operations +// //meta:operation GET /a/{a_id} //meta:operation POST /a/{a_id} //meta:operation GET /a/{a_id} diff --git a/tools/metadata/testdata/update-go/valid/github/a.go b/tools/metadata/testdata/update-go/valid/github/a.go index 7885efd8c79..245e2ba1df1 100644 --- a/tools/metadata/testdata/update-go/valid/github/a.go +++ b/tools/metadata/testdata/update-go/valid/github/a.go @@ -3,10 +3,12 @@ package github type AService struct{} // Get gets an A +// //meta:operation GET /a/{non-canonical-id} func (s *AService) Get() {} // Undocumented uses an undocumented operation +// //meta:operation GET /undocumented/{undocumented_id} func (s *AService) Undocumented() {} From e7a3cc7ba31a1723c65b8f0e0c88e9bccaa5ee82 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa <404610+tatsuhiro-t@users.noreply.github.com> Date: Fri, 19 Jan 2024 22:11:29 +0900 Subject: [PATCH 091/145] Add MergedAt field to PullRequestLinks (#3053) Fixes: #3052. --- github/github-accessors.go | 8 ++++++++ github/github-accessors_test.go | 10 ++++++++++ github/issues.go | 9 +++++---- github/issues_test.go | 4 +++- 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/github/github-accessors.go b/github/github-accessors.go index 256bfacfb50..6663fc1ae7d 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -16262,6 +16262,14 @@ func (p *PullRequestLinks) GetHTMLURL() string { return *p.HTMLURL } +// GetMergedAt returns the MergedAt field if it's non-nil, zero value otherwise. +func (p *PullRequestLinks) GetMergedAt() Timestamp { + if p == nil || p.MergedAt == nil { + return Timestamp{} + } + return *p.MergedAt +} + // GetPatchURL returns the PatchURL field if it's non-nil, zero value otherwise. func (p *PullRequestLinks) GetPatchURL() string { if p == nil || p.PatchURL == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 461ce8ed7eb..86c9140d55b 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -18864,6 +18864,16 @@ func TestPullRequestLinks_GetHTMLURL(tt *testing.T) { p.GetHTMLURL() } +func TestPullRequestLinks_GetMergedAt(tt *testing.T) { + var zeroValue Timestamp + p := &PullRequestLinks{MergedAt: &zeroValue} + p.GetMergedAt() + p = &PullRequestLinks{} + p.GetMergedAt() + p = nil + p.GetMergedAt() +} + func TestPullRequestLinks_GetPatchURL(tt *testing.T) { var zeroValue string p := &PullRequestLinks{PatchURL: &zeroValue} diff --git a/github/issues.go b/github/issues.go index 1c07fef827b..a2652b34972 100644 --- a/github/issues.go +++ b/github/issues.go @@ -122,10 +122,11 @@ type IssueListOptions struct { // PullRequestLinks object is added to the Issue object when it's an issue included // in the IssueCommentEvent webhook payload, if the webhook is fired by a comment on a PR. type PullRequestLinks struct { - URL *string `json:"url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - DiffURL *string `json:"diff_url,omitempty"` - PatchURL *string `json:"patch_url,omitempty"` + URL *string `json:"url,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + DiffURL *string `json:"diff_url,omitempty"` + PatchURL *string `json:"patch_url,omitempty"` + MergedAt *Timestamp `json:"merged_at,omitempty"` } // List the issues for the authenticated user. If all is true, list issues diff --git a/github/issues_test.go b/github/issues_test.go index aa767d6508a..d64ef88d72f 100644 --- a/github/issues_test.go +++ b/github/issues_test.go @@ -499,13 +499,15 @@ func TestPullRequestLinks_Marshal(t *testing.T) { HTMLURL: String("hurl"), DiffURL: String("durl"), PatchURL: String("purl"), + MergedAt: &Timestamp{referenceTime}, } want := `{ "url": "url", "html_url": "hurl", "diff_url": "durl", - "patch_url": "purl" + "patch_url": "purl", + "merged_at": ` + referenceTimeStr + ` }` testJSONMarshal(t, u, want) From a541a92024d01083fa9b71820a5f85f424d248b8 Mon Sep 17 00:00:00 2001 From: Erik Elkins Date: Mon, 22 Jan 2024 12:00:02 -0600 Subject: [PATCH 092/145] Add default workflow permissions for enterprise/org/repo (#3054) --- github/actions_permissions_enterprise.go | 51 ++++++++++++ github/actions_permissions_enterprise_test.go | 77 ++++++++++++++++++ github/actions_permissions_orgs.go | 51 ++++++++++++ github/actions_permissions_orgs_test.go | 77 ++++++++++++++++++ github/github-accessors.go | 48 ++++++++++++ github/github-accessors_test.go | 60 ++++++++++++++ github/repos_actions_permissions.go | 52 +++++++++++++ github/repos_actions_permissions_test.go | 78 +++++++++++++++++++ 8 files changed, 494 insertions(+) diff --git a/github/actions_permissions_enterprise.go b/github/actions_permissions_enterprise.go index 7e10444af47..a6a85aa32a5 100644 --- a/github/actions_permissions_enterprise.go +++ b/github/actions_permissions_enterprise.go @@ -29,6 +29,14 @@ func (a ActionsPermissionsEnterprise) String() string { return Stringify(a) } +// DefaultWorkflowPermissionEnterprise represents the default permissions for GitHub Actions workflows for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions +type DefaultWorkflowPermissionEnterprise struct { + DefaultWorkflowPermissions *string `json:"default_workflow_permissions,omitempty"` + CanApprovePullRequestReviews *bool `json:"can_approve_pull_request_reviews,omitempty"` +} + // GetActionsPermissionsInEnterprise gets the GitHub Actions permissions policy for an enterprise. // // GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#get-github-actions-permissions-for-an-enterprise @@ -205,3 +213,46 @@ func (s *ActionsService) EditActionsAllowedInEnterprise(ctx context.Context, ent return p, resp, nil } + +// GetDefaultWorkflowPermissionsInEnterprise gets the GitHub Actions default workflow permissions for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#get-default-workflow-permissions-for-an-enterprise +// +//meta:operation GET /enterprises/{enterprise}/actions/permissions/workflow +func (s *ActionsService) GetDefaultWorkflowPermissionsInEnterprise(ctx context.Context, enterprise string) (*DefaultWorkflowPermissionEnterprise, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/workflow", enterprise) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + permissions := new(DefaultWorkflowPermissionEnterprise) + resp, err := s.client.Do(ctx, req, permissions) + if err != nil { + return nil, resp, err + } + + return permissions, resp, nil +} + +// EditDefaultWorkflowPermissionsInEnterprise sets the GitHub Actions default workflow permissions for an enterprise. +// +// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/actions/permissions#set-default-workflow-permissions-for-an-enterprise +// +//meta:operation PUT /enterprises/{enterprise}/actions/permissions/workflow +func (s *ActionsService) EditDefaultWorkflowPermissionsInEnterprise(ctx context.Context, enterprise string, permissions DefaultWorkflowPermissionEnterprise) (*DefaultWorkflowPermissionEnterprise, *Response, error) { + u := fmt.Sprintf("enterprises/%v/actions/permissions/workflow", enterprise) + req, err := s.client.NewRequest("PUT", u, permissions) + if err != nil { + return nil, nil, err + } + + p := new(DefaultWorkflowPermissionEnterprise) + resp, err := s.client.Do(ctx, req, p) + if err != nil { + return nil, resp, err + } + + return p, resp, nil +} diff --git a/github/actions_permissions_enterprise_test.go b/github/actions_permissions_enterprise_test.go index 14e8e3a6b33..70f7d2c0979 100644 --- a/github/actions_permissions_enterprise_test.go +++ b/github/actions_permissions_enterprise_test.go @@ -296,3 +296,80 @@ func TestActionsService_EditActionsAllowedInEnterprise(t *testing.T) { return resp, err }) } + +func TestActionsService_GetDefaultWorkflowPermissionsInEnterprise(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/enterprises/e/actions/permissions/workflow", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + fmt.Fprint(w, `{ "default_workflow_permissions": "read", "can_approve_pull_request_reviews": true }`) + }) + + ctx := context.Background() + ent, _, err := client.Actions.GetDefaultWorkflowPermissionsInEnterprise(ctx, "e") + if err != nil { + t.Errorf("Actions.GetDefaultWorkflowPermissionsInEnterprise returned error: %v", err) + } + want := &DefaultWorkflowPermissionEnterprise{DefaultWorkflowPermissions: String("read"), CanApprovePullRequestReviews: Bool(true)} + if !cmp.Equal(ent, want) { + t.Errorf("Actions.GetDefaultWorkflowPermissionsInEnterprise returned %+v, want %+v", ent, want) + } + + const methodName = "GetDefaultWorkflowPermissionsInEnterprise" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Actions.GetDefaultWorkflowPermissionsInEnterprise(ctx, "\n") + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Actions.GetDefaultWorkflowPermissionsInEnterprise(ctx, "e") + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestActionsService_EditDefaultWorkflowPermissionsInEnterprise(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + input := &DefaultWorkflowPermissionEnterprise{DefaultWorkflowPermissions: String("read"), CanApprovePullRequestReviews: Bool(true)} + + mux.HandleFunc("/enterprises/e/actions/permissions/workflow", func(w http.ResponseWriter, r *http.Request) { + v := new(DefaultWorkflowPermissionEnterprise) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) + + testMethod(t, r, "PUT") + if !cmp.Equal(v, input) { + t.Errorf("Request body = %+v, want %+v", v, input) + } + + fmt.Fprint(w, `{ "default_workflow_permissions": "read", "can_approve_pull_request_reviews": true }`) + }) + + ctx := context.Background() + ent, _, err := client.Actions.EditDefaultWorkflowPermissionsInEnterprise(ctx, "e", *input) + if err != nil { + t.Errorf("Actions.EditDefaultWorkflowPermissionsInEnterprise returned error: %v", err) + } + + want := &DefaultWorkflowPermissionEnterprise{DefaultWorkflowPermissions: String("read"), CanApprovePullRequestReviews: Bool(true)} + if !cmp.Equal(ent, want) { + t.Errorf("Actions.EditDefaultWorkflowPermissionsInEnterprise returned %+v, want %+v", ent, want) + } + + const methodName = "EditDefaultWorkflowPermissionsInEnterprise" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Actions.EditDefaultWorkflowPermissionsInEnterprise(ctx, "\n", *input) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Actions.EditDefaultWorkflowPermissionsInEnterprise(ctx, "e", *input) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} diff --git a/github/actions_permissions_orgs.go b/github/actions_permissions_orgs.go index 1a31e4c6f1b..2f555f24935 100644 --- a/github/actions_permissions_orgs.go +++ b/github/actions_permissions_orgs.go @@ -42,6 +42,14 @@ func (a ActionsAllowed) String() string { return Stringify(a) } +// DefaultWorkflowPermissionOrganization represents the default permissions for GitHub Actions workflows for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions +type DefaultWorkflowPermissionOrganization struct { + DefaultWorkflowPermissions *string `json:"default_workflow_permissions,omitempty"` + CanApprovePullRequestReviews *bool `json:"can_approve_pull_request_reviews,omitempty"` +} + // GetActionsPermissions gets the GitHub Actions permissions policy for repositories and allowed actions in an organization. // // GitHub API docs: https://docs.github.com/rest/actions/permissions#get-github-actions-permissions-for-an-organization @@ -218,3 +226,46 @@ func (s *ActionsService) EditActionsAllowed(ctx context.Context, org string, act return p, resp, nil } + +// GetDefaultWorkflowPermissionsInOrganization gets the GitHub Actions default workflow permissions for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions#get-default-workflow-permissions-for-an-organization +// +//meta:operation GET /orgs/{org}/actions/permissions/workflow +func (s *ActionsService) GetDefaultWorkflowPermissionsInOrganization(ctx context.Context, org string) (*DefaultWorkflowPermissionOrganization, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/workflow", org) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + permissions := new(DefaultWorkflowPermissionOrganization) + resp, err := s.client.Do(ctx, req, permissions) + if err != nil { + return nil, resp, err + } + + return permissions, resp, nil +} + +// EditDefaultWorkflowPermissionsInOrganization sets the GitHub Actions default workflow permissions for an organization. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions#set-default-workflow-permissions-for-an-organization +// +//meta:operation PUT /orgs/{org}/actions/permissions/workflow +func (s *ActionsService) EditDefaultWorkflowPermissionsInOrganization(ctx context.Context, org string, permissions DefaultWorkflowPermissionOrganization) (*DefaultWorkflowPermissionOrganization, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/permissions/workflow", org) + req, err := s.client.NewRequest("PUT", u, permissions) + if err != nil { + return nil, nil, err + } + + p := new(DefaultWorkflowPermissionOrganization) + resp, err := s.client.Do(ctx, req, p) + if err != nil { + return nil, resp, err + } + + return p, resp, nil +} diff --git a/github/actions_permissions_orgs_test.go b/github/actions_permissions_orgs_test.go index 36a241f6ea2..fd35c519645 100644 --- a/github/actions_permissions_orgs_test.go +++ b/github/actions_permissions_orgs_test.go @@ -334,3 +334,80 @@ func TestActionsPermissions_Marshal(t *testing.T) { testJSONMarshal(t, u, want) } + +func TestActionsService_GetDefaultWorkflowPermissionsInOrganization(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/orgs/o/actions/permissions/workflow", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + fmt.Fprint(w, `{ "default_workflow_permissions": "read", "can_approve_pull_request_reviews": true }`) + }) + + ctx := context.Background() + org, _, err := client.Actions.GetDefaultWorkflowPermissionsInOrganization(ctx, "o") + if err != nil { + t.Errorf("Actions.GetDefaultWorkflowPermissionsInOrganization returned error: %v", err) + } + want := &DefaultWorkflowPermissionOrganization{DefaultWorkflowPermissions: String("read"), CanApprovePullRequestReviews: Bool(true)} + if !cmp.Equal(org, want) { + t.Errorf("Actions.GetDefaultWorkflowPermissionsInOrganization returned %+v, want %+v", org, want) + } + + const methodName = "GetDefaultWorkflowPermissionsInOrganization" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Actions.GetDefaultWorkflowPermissionsInOrganization(ctx, "\n") + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Actions.GetDefaultWorkflowPermissionsInOrganization(ctx, "o") + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestActionsService_EditDefaultWorkflowPermissionsInOrganization(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + input := &DefaultWorkflowPermissionOrganization{DefaultWorkflowPermissions: String("read"), CanApprovePullRequestReviews: Bool(true)} + + mux.HandleFunc("/orgs/o/actions/permissions/workflow", func(w http.ResponseWriter, r *http.Request) { + v := new(DefaultWorkflowPermissionOrganization) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) + + testMethod(t, r, "PUT") + if !cmp.Equal(v, input) { + t.Errorf("Request body = %+v, want %+v", v, input) + } + + fmt.Fprint(w, `{ "default_workflow_permissions": "read", "can_approve_pull_request_reviews": true }`) + }) + + ctx := context.Background() + org, _, err := client.Actions.EditDefaultWorkflowPermissionsInOrganization(ctx, "o", *input) + if err != nil { + t.Errorf("Actions.EditDefaultWorkflowPermissionsInOrganization returned error: %v", err) + } + + want := &DefaultWorkflowPermissionOrganization{DefaultWorkflowPermissions: String("read"), CanApprovePullRequestReviews: Bool(true)} + if !cmp.Equal(org, want) { + t.Errorf("Actions.EditDefaultWorkflowPermissionsInOrganization returned %+v, want %+v", org, want) + } + + const methodName = "EditDefaultWorkflowPermissionsInOrganization" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Actions.EditDefaultWorkflowPermissionsInOrganization(ctx, "\n", *input) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Actions.EditDefaultWorkflowPermissionsInOrganization(ctx, "o", *input) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} diff --git a/github/github-accessors.go b/github/github-accessors.go index 6663fc1ae7d..5a763df1e21 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -4686,6 +4686,54 @@ func (d *DefaultSetupConfiguration) GetUpdatedAt() Timestamp { return *d.UpdatedAt } +// GetCanApprovePullRequestReviews returns the CanApprovePullRequestReviews field if it's non-nil, zero value otherwise. +func (d *DefaultWorkflowPermissionEnterprise) GetCanApprovePullRequestReviews() bool { + if d == nil || d.CanApprovePullRequestReviews == nil { + return false + } + return *d.CanApprovePullRequestReviews +} + +// GetDefaultWorkflowPermissions returns the DefaultWorkflowPermissions field if it's non-nil, zero value otherwise. +func (d *DefaultWorkflowPermissionEnterprise) GetDefaultWorkflowPermissions() string { + if d == nil || d.DefaultWorkflowPermissions == nil { + return "" + } + return *d.DefaultWorkflowPermissions +} + +// GetCanApprovePullRequestReviews returns the CanApprovePullRequestReviews field if it's non-nil, zero value otherwise. +func (d *DefaultWorkflowPermissionOrganization) GetCanApprovePullRequestReviews() bool { + if d == nil || d.CanApprovePullRequestReviews == nil { + return false + } + return *d.CanApprovePullRequestReviews +} + +// GetDefaultWorkflowPermissions returns the DefaultWorkflowPermissions field if it's non-nil, zero value otherwise. +func (d *DefaultWorkflowPermissionOrganization) GetDefaultWorkflowPermissions() string { + if d == nil || d.DefaultWorkflowPermissions == nil { + return "" + } + return *d.DefaultWorkflowPermissions +} + +// GetCanApprovePullRequestReviews returns the CanApprovePullRequestReviews field if it's non-nil, zero value otherwise. +func (d *DefaultWorkflowPermissionRepository) GetCanApprovePullRequestReviews() bool { + if d == nil || d.CanApprovePullRequestReviews == nil { + return false + } + return *d.CanApprovePullRequestReviews +} + +// GetDefaultWorkflowPermissions returns the DefaultWorkflowPermissions field if it's non-nil, zero value otherwise. +func (d *DefaultWorkflowPermissionRepository) GetDefaultWorkflowPermissions() string { + if d == nil || d.DefaultWorkflowPermissions == nil { + return "" + } + return *d.DefaultWorkflowPermissions +} + // GetConfirmDeleteURL returns the ConfirmDeleteURL field if it's non-nil, zero value otherwise. func (d *DeleteAnalysis) GetConfirmDeleteURL() string { if d == nil || d.ConfirmDeleteURL == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 86c9140d55b..5c291306ab2 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -5519,6 +5519,66 @@ func TestDefaultSetupConfiguration_GetUpdatedAt(tt *testing.T) { d.GetUpdatedAt() } +func TestDefaultWorkflowPermissionEnterprise_GetCanApprovePullRequestReviews(tt *testing.T) { + var zeroValue bool + d := &DefaultWorkflowPermissionEnterprise{CanApprovePullRequestReviews: &zeroValue} + d.GetCanApprovePullRequestReviews() + d = &DefaultWorkflowPermissionEnterprise{} + d.GetCanApprovePullRequestReviews() + d = nil + d.GetCanApprovePullRequestReviews() +} + +func TestDefaultWorkflowPermissionEnterprise_GetDefaultWorkflowPermissions(tt *testing.T) { + var zeroValue string + d := &DefaultWorkflowPermissionEnterprise{DefaultWorkflowPermissions: &zeroValue} + d.GetDefaultWorkflowPermissions() + d = &DefaultWorkflowPermissionEnterprise{} + d.GetDefaultWorkflowPermissions() + d = nil + d.GetDefaultWorkflowPermissions() +} + +func TestDefaultWorkflowPermissionOrganization_GetCanApprovePullRequestReviews(tt *testing.T) { + var zeroValue bool + d := &DefaultWorkflowPermissionOrganization{CanApprovePullRequestReviews: &zeroValue} + d.GetCanApprovePullRequestReviews() + d = &DefaultWorkflowPermissionOrganization{} + d.GetCanApprovePullRequestReviews() + d = nil + d.GetCanApprovePullRequestReviews() +} + +func TestDefaultWorkflowPermissionOrganization_GetDefaultWorkflowPermissions(tt *testing.T) { + var zeroValue string + d := &DefaultWorkflowPermissionOrganization{DefaultWorkflowPermissions: &zeroValue} + d.GetDefaultWorkflowPermissions() + d = &DefaultWorkflowPermissionOrganization{} + d.GetDefaultWorkflowPermissions() + d = nil + d.GetDefaultWorkflowPermissions() +} + +func TestDefaultWorkflowPermissionRepository_GetCanApprovePullRequestReviews(tt *testing.T) { + var zeroValue bool + d := &DefaultWorkflowPermissionRepository{CanApprovePullRequestReviews: &zeroValue} + d.GetCanApprovePullRequestReviews() + d = &DefaultWorkflowPermissionRepository{} + d.GetCanApprovePullRequestReviews() + d = nil + d.GetCanApprovePullRequestReviews() +} + +func TestDefaultWorkflowPermissionRepository_GetDefaultWorkflowPermissions(tt *testing.T) { + var zeroValue string + d := &DefaultWorkflowPermissionRepository{DefaultWorkflowPermissions: &zeroValue} + d.GetDefaultWorkflowPermissions() + d = &DefaultWorkflowPermissionRepository{} + d.GetDefaultWorkflowPermissions() + d = nil + d.GetDefaultWorkflowPermissions() +} + func TestDeleteAnalysis_GetConfirmDeleteURL(tt *testing.T) { var zeroValue string d := &DeleteAnalysis{ConfirmDeleteURL: &zeroValue} diff --git a/github/repos_actions_permissions.go b/github/repos_actions_permissions.go index 2dcc367de1c..9abd32a7837 100644 --- a/github/repos_actions_permissions.go +++ b/github/repos_actions_permissions.go @@ -23,6 +23,14 @@ func (a ActionsPermissionsRepository) String() string { return Stringify(a) } +// DefaultWorkflowPermissionRepository represents the default permissions for GitHub Actions workflows for a repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions +type DefaultWorkflowPermissionRepository struct { + DefaultWorkflowPermissions *string `json:"default_workflow_permissions,omitempty"` + CanApprovePullRequestReviews *bool `json:"can_approve_pull_request_reviews,omitempty"` +} + // GetActionsPermissions gets the GitHub Actions permissions policy for repositories and allowed actions in a repository. // // GitHub API docs: https://docs.github.com/rest/actions/permissions#get-github-actions-permissions-for-a-repository @@ -30,6 +38,7 @@ func (a ActionsPermissionsRepository) String() string { //meta:operation GET /repos/{owner}/{repo}/actions/permissions func (s *RepositoriesService) GetActionsPermissions(ctx context.Context, owner, repo string) (*ActionsPermissionsRepository, *Response, error) { u := fmt.Sprintf("repos/%v/%v/actions/permissions", owner, repo) + req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err @@ -64,3 +73,46 @@ func (s *RepositoriesService) EditActionsPermissions(ctx context.Context, owner, return permissions, resp, nil } + +// GetDefaultWorkflowPermissions gets the GitHub Actions default workflow permissions in a repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions#get-default-workflow-permissions-for-a-repository +// +//meta:operation GET /repos/{owner}/{repo}/actions/permissions/workflow +func (s *RepositoriesService) GetDefaultWorkflowPermissions(ctx context.Context, owner, repo string) (*DefaultWorkflowPermissionRepository, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/permissions/workflow", owner, repo) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + permissions := new(DefaultWorkflowPermissionRepository) + resp, err := s.client.Do(ctx, req, permissions) + if err != nil { + return nil, resp, err + } + + return permissions, resp, nil +} + +// EditDefaultWorkflowPermissions sets the GitHub Actions default workflow permissions in a repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/permissions#set-default-workflow-permissions-for-a-repository +// +//meta:operation PUT /repos/{owner}/{repo}/actions/permissions/workflow +func (s *RepositoriesService) EditDefaultWorkflowPermissions(ctx context.Context, owner, repo string, permissions DefaultWorkflowPermissionRepository) (*DefaultWorkflowPermissionRepository, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/actions/permissions/workflow", owner, repo) + req, err := s.client.NewRequest("PUT", u, permissions) + if err != nil { + return nil, nil, err + } + + p := new(DefaultWorkflowPermissionRepository) + resp, err := s.client.Do(ctx, req, p) + if err != nil { + return nil, resp, err + } + + return p, resp, nil +} diff --git a/github/repos_actions_permissions_test.go b/github/repos_actions_permissions_test.go index ecff0d5fbca..9959a6e7685 100644 --- a/github/repos_actions_permissions_test.go +++ b/github/repos_actions_permissions_test.go @@ -110,3 +110,81 @@ func TestActionsPermissionsRepository_Marshal(t *testing.T) { testJSONMarshal(t, u, want) } + +func TestRepositoriesService_GetDefaultWorkflowPermissions(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/repos/o/r/actions/permissions/workflow", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + fmt.Fprint(w, `{ "default_workflow_permissions": "read", "can_approve_pull_request_reviews": true }`) + }) + + ctx := context.Background() + org, _, err := client.Repositories.GetDefaultWorkflowPermissions(ctx, "o", "r") + if err != nil { + t.Errorf("Repositories.GetDefaultWorkflowPermissions returned error: %v", err) + } + want := &DefaultWorkflowPermissionRepository{DefaultWorkflowPermissions: String("read"), CanApprovePullRequestReviews: Bool(true)} + if !cmp.Equal(org, want) { + t.Errorf("Repositories.GetDefaultWorkflowPermissions returned %+v, want %+v", org, want) + } + + const methodName = "GetDefaultWorkflowPermissions" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Repositories.GetDefaultWorkflowPermissions(ctx, "\n", "\n") + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Repositories.GetDefaultWorkflowPermissions(ctx, "o", "r") + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestRepositoriesService_EditDefaultWorkflowPermissions(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + input := &DefaultWorkflowPermissionRepository{DefaultWorkflowPermissions: String("read"), CanApprovePullRequestReviews: Bool(true)} + + mux.HandleFunc("/repos/o/r/actions/permissions/workflow", func(w http.ResponseWriter, r *http.Request) { + v := new(DefaultWorkflowPermissionRepository) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) + + testMethod(t, r, "PUT") + if !cmp.Equal(v, input) { + t.Errorf("Request body = %+v, want %+v", v, input) + } + + fmt.Fprint(w, `{ "default_workflow_permissions": "read", "can_approve_pull_request_reviews": true }`) + }) + + ctx := context.Background() + org, _, err := client.Repositories.EditDefaultWorkflowPermissions(ctx, "o", "r", *input) + if err != nil { + t.Errorf("Repositories.EditDefaultWorkflowPermissions returned error: %v", err) + } + + want := &DefaultWorkflowPermissionRepository{DefaultWorkflowPermissions: String("read"), CanApprovePullRequestReviews: Bool(true)} + if !cmp.Equal(org, want) { + t.Errorf("Repositories.EditDefaultWorkflowPermissions returned %+v, want %+v", org, want) + } + + const methodName = "EditDefaultWorkflowPermissions" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Repositories.EditDefaultWorkflowPermissions(ctx, "\n", "\n", *input) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Repositories.EditDefaultWorkflowPermissions(ctx, "o", "r", *input) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} From b61795d74253456297d180698c1aada6978e0e67 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 Jan 2024 14:56:53 -0500 Subject: [PATCH 093/145] Bump actions/cache from 3 to 4 (#3055) --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3067b1b0bec..78305423b47 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -51,7 +51,7 @@ jobs: echo "go-mod-cache=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT - name: Cache go modules - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | ${{ steps.cache-paths.outputs.go-cache }} From 20fc90190626bc9ff64da10ffdbb3be9f1ba85be Mon Sep 17 00:00:00 2001 From: Riaje Date: Wed, 24 Jan 2024 18:27:19 -0500 Subject: [PATCH 094/145] Add Topics to EditChange struct (#3057) Fixes: #3056. --- github/event_types.go | 6 ++++++ github/event_types_test.go | 9 +++++++++ github/github-accessors.go | 8 ++++++++ github/github-accessors_test.go | 7 +++++++ 4 files changed, 30 insertions(+) diff --git a/github/event_types.go b/github/event_types.go index db7c7c69efe..56db9f5b18c 100644 --- a/github/event_types.go +++ b/github/event_types.go @@ -394,6 +394,7 @@ type EditChange struct { Repo *EditRepo `json:"repository,omitempty"` Owner *EditOwner `json:"owner,omitempty"` DefaultBranch *EditDefaultBranch `json:"default_branch,omitempty"` + Topics *EditTopics `json:"topics,omitempty"` } // EditTitle represents a pull-request title change. @@ -438,6 +439,11 @@ type RepoName struct { From *string `json:"from,omitempty"` } +// EditTopics represents a change of repository topics. +type EditTopics struct { + From []string `json:"from,omitempty"` +} + // EditSHA represents a sha change of a pull-request. type EditSHA struct { From *string `json:"from,omitempty"` diff --git a/github/event_types_test.go b/github/event_types_test.go index 80eca61d0fc..8578b922bf6 100644 --- a/github/event_types_test.go +++ b/github/event_types_test.go @@ -91,6 +91,9 @@ func TestEditChange_Marshal_Repo(t *testing.T) { From: String("old-repo-name"), }, }, + Topics: &EditTopics{ + From: []string{"topic1", "topic2"}, + }, } want := `{ @@ -98,6 +101,12 @@ func TestEditChange_Marshal_Repo(t *testing.T) { "name": { "from": "old-repo-name" } + }, + "topics": { + "from": [ + "topic1", + "topic2" + ] } }` diff --git a/github/github-accessors.go b/github/github-accessors.go index 5a763df1e21..6d32908ce01 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -6358,6 +6358,14 @@ func (e *EditChange) GetTitle() *EditTitle { return e.Title } +// GetTopics returns the Topics field. +func (e *EditChange) GetTopics() *EditTopics { + if e == nil { + return nil + } + return e.Topics +} + // GetFrom returns the From field if it's non-nil, zero value otherwise. func (e *EditDefaultBranch) GetFrom() string { if e == nil || e.From == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 5c291306ab2..5856cc7ac25 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -7414,6 +7414,13 @@ func TestEditChange_GetTitle(tt *testing.T) { e.GetTitle() } +func TestEditChange_GetTopics(tt *testing.T) { + e := &EditChange{} + e.GetTopics() + e = nil + e.GetTopics() +} + func TestEditDefaultBranch_GetFrom(tt *testing.T) { var zeroValue string e := &EditDefaultBranch{From: &zeroValue} From d26bcb8be17264a1fad1aaf15147625c0df75a99 Mon Sep 17 00:00:00 2001 From: tomfeigin Date: Sat, 27 Jan 2024 18:35:40 +0200 Subject: [PATCH 095/145] Add list repo org variables and secrets (#3058) --- github/actions_secrets.go | 11 ++++++++ github/actions_secrets_test.go | 43 ++++++++++++++++++++++++++++++++ github/actions_variables.go | 10 ++++++++ github/actions_variables_test.go | 43 ++++++++++++++++++++++++++++++++ 4 files changed, 107 insertions(+) diff --git a/github/actions_secrets.go b/github/actions_secrets.go index 2d4ba98db30..d8d405c06d7 100644 --- a/github/actions_secrets.go +++ b/github/actions_secrets.go @@ -138,6 +138,17 @@ func (s *ActionsService) ListRepoSecrets(ctx context.Context, owner, repo string return s.listSecrets(ctx, url, opts) } +// ListRepoOrgSecrets lists all organization secrets available in a repository +// without revealing their encrypted values. +// +// GitHub API docs: https://docs.github.com/rest/actions/secrets#list-repository-organization-secrets +// +//meta:operation GET /repos/{owner}/{repo}/actions/organization-secrets +func (s *ActionsService) ListRepoOrgSecrets(ctx context.Context, owner, repo string, opts *ListOptions) (*Secrets, *Response, error) { + url := fmt.Sprintf("repos/%v/%v/actions/organization-secrets", owner, repo) + return s.listSecrets(ctx, url, opts) +} + // ListOrgSecrets lists all secrets available in an organization // without revealing their encrypted values. // diff --git a/github/actions_secrets_test.go b/github/actions_secrets_test.go index a1266d6bae6..a2ac169cd24 100644 --- a/github/actions_secrets_test.go +++ b/github/actions_secrets_test.go @@ -205,6 +205,49 @@ func TestActionsService_ListRepoSecrets(t *testing.T) { }) } +func TestActionsService_ListRepoOrgSecrets(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/repos/o/r/actions/organization-secrets", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + testFormValues(t, r, values{"per_page": "2", "page": "2"}) + fmt.Fprint(w, `{"total_count":4,"secrets":[{"name":"A","created_at":"2019-01-02T15:04:05Z","updated_at":"2020-01-02T15:04:05Z"},{"name":"B","created_at":"2019-01-02T15:04:05Z","updated_at":"2020-01-02T15:04:05Z"}]}`) + }) + + opts := &ListOptions{Page: 2, PerPage: 2} + ctx := context.Background() + secrets, _, err := client.Actions.ListRepoOrgSecrets(ctx, "o", "r", opts) + if err != nil { + t.Errorf("Actions.ListRepoOrgSecrets returned error: %v", err) + } + + want := &Secrets{ + TotalCount: 4, + Secrets: []*Secret{ + {Name: "A", CreatedAt: Timestamp{time.Date(2019, time.January, 02, 15, 04, 05, 0, time.UTC)}, UpdatedAt: Timestamp{time.Date(2020, time.January, 02, 15, 04, 05, 0, time.UTC)}}, + {Name: "B", CreatedAt: Timestamp{time.Date(2019, time.January, 02, 15, 04, 05, 0, time.UTC)}, UpdatedAt: Timestamp{time.Date(2020, time.January, 02, 15, 04, 05, 0, time.UTC)}}, + }, + } + if !cmp.Equal(secrets, want) { + t.Errorf("Actions.ListRepoOrgSecrets returned %+v, want %+v", secrets, want) + } + + const methodName = "ListRepoOrgSecrets" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Actions.ListRepoOrgSecrets(ctx, "\n", "\n", opts) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Actions.ListRepoOrgSecrets(ctx, "o", "r", opts) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + func TestActionsService_GetRepoSecret(t *testing.T) { client, mux, _, teardown := setup() defer teardown() diff --git a/github/actions_variables.go b/github/actions_variables.go index 244d159079e..aa0f23ca48d 100644 --- a/github/actions_variables.go +++ b/github/actions_variables.go @@ -59,6 +59,16 @@ func (s *ActionsService) ListRepoVariables(ctx context.Context, owner, repo stri return s.listVariables(ctx, url, opts) } +// ListRepoOrgVariables lists all organization variables available in a repository. +// +// GitHub API docs: https://docs.github.com/rest/actions/variables#list-repository-organization-variables +// +//meta:operation GET /repos/{owner}/{repo}/actions/organization-variables +func (s *ActionsService) ListRepoOrgVariables(ctx context.Context, owner, repo string, opts *ListOptions) (*ActionsVariables, *Response, error) { + url := fmt.Sprintf("repos/%v/%v/actions/organization-variables", owner, repo) + return s.listVariables(ctx, url, opts) +} + // ListOrgVariables lists all variables available in an organization. // // GitHub API docs: https://docs.github.com/rest/actions/variables#list-organization-variables diff --git a/github/actions_variables_test.go b/github/actions_variables_test.go index a9f773c261e..dcd648c25c3 100644 --- a/github/actions_variables_test.go +++ b/github/actions_variables_test.go @@ -58,6 +58,49 @@ func TestActionsService_ListRepoVariables(t *testing.T) { }) } +func TestActionsService_ListRepoOrgVariables(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/repos/o/r/actions/organization-variables", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + testFormValues(t, r, values{"per_page": "2", "page": "2"}) + fmt.Fprint(w, `{"total_count":4,"variables":[{"name":"A","value":"AA","created_at":"2019-01-02T15:04:05Z","updated_at":"2020-01-02T15:04:05Z"},{"name":"B","value":"BB","created_at":"2019-01-02T15:04:05Z","updated_at":"2020-01-02T15:04:05Z"}]}`) + }) + + opts := &ListOptions{Page: 2, PerPage: 2} + ctx := context.Background() + variables, _, err := client.Actions.ListRepoOrgVariables(ctx, "o", "r", opts) + if err != nil { + t.Errorf("Actions.ListRepoOrgVariables returned error: %v", err) + } + + want := &ActionsVariables{ + TotalCount: 4, + Variables: []*ActionsVariable{ + {Name: "A", Value: "AA", CreatedAt: &Timestamp{time.Date(2019, time.January, 02, 15, 04, 05, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.January, 02, 15, 04, 05, 0, time.UTC)}}, + {Name: "B", Value: "BB", CreatedAt: &Timestamp{time.Date(2019, time.January, 02, 15, 04, 05, 0, time.UTC)}, UpdatedAt: &Timestamp{time.Date(2020, time.January, 02, 15, 04, 05, 0, time.UTC)}}, + }, + } + if !cmp.Equal(variables, want) { + t.Errorf("Actions.ListRepoOrgVariables returned %+v, want %+v", variables, want) + } + + const methodName = "ListRepoOrgVariables" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Actions.ListRepoOrgVariables(ctx, "\n", "\n", opts) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Actions.ListRepoOrgVariables(ctx, "o", "r", opts) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + func TestActionsService_GetRepoVariable(t *testing.T) { client, mux, _, teardown := setup() defer teardown() From 536966dd02c2dbf01695f41d6fe8a6719b7d3cf6 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Sun, 28 Jan 2024 14:24:21 -0500 Subject: [PATCH 096/145] Fix leaked client transport on copy (#3051) Fixes: #3043. --- github/github.go | 9 ++++++--- github/github_test.go | 29 +++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/github/github.go b/github/github.go index 8bc35e5efe2..a7326a7bd5d 100644 --- a/github/github.go +++ b/github/github.go @@ -450,15 +450,18 @@ func (c *Client) copy() *Client { c.clientMu.Lock() // can't use *c here because that would copy mutexes by value. clone := Client{ - client: c.client, + client: &http.Client{}, UserAgent: c.UserAgent, BaseURL: c.BaseURL, UploadURL: c.UploadURL, secondaryRateLimitReset: c.secondaryRateLimitReset, } c.clientMu.Unlock() - if clone.client == nil { - clone.client = &http.Client{} + if c.client != nil { + clone.client.Transport = c.client.Transport + clone.client.CheckRedirect = c.client.CheckRedirect + clone.client.Jar = c.client.Jar + clone.client.Timeout = c.client.Timeout } c.rateMu.Lock() copy(clone.rateLimits[:], c.rateLimits[:]) diff --git a/github/github_test.go b/github/github_test.go index 45ac57c0019..9a369a25fd4 100644 --- a/github/github_test.go +++ b/github/github_test.go @@ -2599,3 +2599,32 @@ func TestParseTokenExpiration(t *testing.T) { } } } + +func TestClientCopy_leak_transport(t *testing.T) { + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "application/json") + accessToken := r.Header.Get("Authorization") + _, _ = fmt.Fprintf(w, `{"login": "%s"}`, accessToken) + })) + clientPreconfiguredWithURLs, err := NewClient(nil).WithEnterpriseURLs(srv.URL, srv.URL) + if err != nil { + t.Fatal(err) + } + + aliceClient := clientPreconfiguredWithURLs.WithAuthToken("alice") + bobClient := clientPreconfiguredWithURLs.WithAuthToken("bob") + + alice, _, err := aliceClient.Users.Get(context.Background(), "") + if err != nil { + t.Fatal(err) + } + + assertNoDiff(t, "Bearer alice", alice.GetLogin()) + + bob, _, err := bobClient.Users.Get(context.Background(), "") + if err != nil { + t.Fatal(err) + } + + assertNoDiff(t, "Bearer bob", bob.GetLogin()) +} From 8d349fe0c84ba964dc739b74c6dd8533c6e7429c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Jan 2024 14:38:49 -0500 Subject: [PATCH 097/145] Bump codecov/codecov-action from 3.1.4 to 3.1.5 (#3061) --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 78305423b47..aab03d750e4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -73,4 +73,4 @@ jobs: - name: Upload coverage to Codecov if: ${{ matrix.update-coverage }} - uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d #v3.1.4 + uses: codecov/codecov-action@4fe8c5f003fae66aa5ebb77cfd3e7bfbbda0b6b0 #v3.1.5 From e574cdf07e0fa553edd56660a7daf8416660705f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Jan 2024 15:17:27 -0500 Subject: [PATCH 098/145] Bump github.com/getkin/kin-openapi from 0.122.0 to 0.123.0 in /tools (#3062) --- tools/go.mod | 7 +++---- tools/go.sum | 33 ++++++++------------------------- 2 files changed, 11 insertions(+), 29 deletions(-) diff --git a/tools/go.mod b/tools/go.mod index c36b9fecbbc..2fbca2de6a9 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/alecthomas/kong v0.8.1 - github.com/getkin/kin-openapi v0.122.0 + github.com/getkin/kin-openapi v0.123.0 github.com/google/go-cmp v0.6.0 github.com/google/go-github/v58 v58.0.0 golang.org/x/sync v0.6.0 @@ -12,15 +12,14 @@ require ( ) require ( - github.com/go-openapi/jsonpointer v0.19.6 // indirect - github.com/go-openapi/swag v0.22.4 // indirect + github.com/go-openapi/jsonpointer v0.20.2 // indirect + github.com/go-openapi/swag v0.22.8 // indirect github.com/google/go-querystring v1.1.0 // indirect github.com/invopop/yaml v0.2.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/perimeterx/marshmallow v1.1.5 // indirect - github.com/stretchr/testify v1.8.4 // indirect ) // Use version at HEAD, not the latest published. diff --git a/tools/go.sum b/tools/go.sum index 7ba38eeec66..d4a1fd8b7aa 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -2,17 +2,13 @@ github.com/alecthomas/assert/v2 v2.1.0 h1:tbredtNcQnoSd3QBhQWI7QZ3XHOVkw1Moklp2o github.com/alecthomas/kong v0.8.1 h1:acZdn3m4lLRobeh3Zi2S2EpnXTd1mOL6U7xVml+vfkY= github.com/alecthomas/kong v0.8.1/go.mod h1:n1iCIO2xS46oE8ZfYCNDqdR0b0wZNrXAIAqro/2132U= github.com/alecthomas/repr v0.1.0 h1:ENn2e1+J3k09gyj2shc0dHr/yjaWSHRlrJ4DPMevDqE= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/getkin/kin-openapi v0.122.0 h1:WB9Jbl0Hp/T79/JF9xlSW5Kl9uYdk/AWD0yAd9HOM10= -github.com/getkin/kin-openapi v0.122.0/go.mod h1:PCWw/lfBrJY4HcdqE3jj+QFkaFK8ABoqo7PvqVhXXqw= -github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= -github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= -github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= -github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU= -github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/getkin/kin-openapi v0.123.0 h1:zIik0mRwFNLyvtXK274Q6ut+dPh6nlxBp0x7mNrPhs8= +github.com/getkin/kin-openapi v0.123.0/go.mod h1:wb1aSZA/iWmorQP9KTAS/phLj/t17B5jT7+fS8ed9NM= +github.com/go-openapi/jsonpointer v0.20.2 h1:mQc3nmndL8ZBzStEo3JYF8wzmeWffDH4VbXz58sAx6Q= +github.com/go-openapi/jsonpointer v0.20.2/go.mod h1:bHen+N0u1KEO3YlmqOjTT9Adn1RfD91Ar825/PuiRVs= +github.com/go-openapi/swag v0.22.8 h1:/9RjDSQ0vbFR+NyjGMkFTsA1IA0fmhKSThmfGZjicbw= +github.com/go-openapi/swag v0.22.8/go.mod h1:6QT22icPLEqAM/z/TChgb4WAveCHF92+2gF0CNjHpPI= github.com/go-test/deep v1.0.8 h1:TDsG77qcSprGbC6vTN8OuXp5g+J+b5Pcguhf7Zt61VM= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= @@ -24,12 +20,8 @@ github.com/invopop/yaml v0.2.0 h1:7zky/qH+O0DwAyoobXUqvVBwgBFRxKoQ/3FjcVpjTMY= github.com/invopop/yaml v0.2.0/go.mod h1:2XuRLgs/ouIrW3XNzuNj7J3Nvu/Dig5MXvbCEdiBN3Q= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= -github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw= @@ -37,23 +29,14 @@ github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwd github.com/perimeterx/marshmallow v1.1.5 h1:a2LALqQ1BlHM8PZblsDdidgv1mWi1DgC2UmX50IvK2s= github.com/perimeterx/marshmallow v1.1.5/go.mod h1:dsXbUu8CRzfYP5a87xpp0xq9S3u0Vchtcl8we9tYaXw= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From fe7732246522328c143ad09b90972c8fa8f5ae44 Mon Sep 17 00:00:00 2001 From: Nicolas Chapurlat Date: Wed, 31 Jan 2024 15:40:11 +0100 Subject: [PATCH 099/145] Add custom properties on Repository and PushEventRepository (#3065) Fixes: #3064. --- github/event_types.go | 75 ++++++++++++----------- github/github-accessors.go | 16 +++++ github/github-accessors_test.go | 20 ++++++ github/repos.go | 105 ++++++++++++++++---------------- 4 files changed, 127 insertions(+), 89 deletions(-) diff --git a/github/event_types.go b/github/event_types.go index 56db9f5b18c..b820dddf4a7 100644 --- a/github/event_types.go +++ b/github/event_types.go @@ -1327,43 +1327,44 @@ func (h HeadCommit) String() string { // PushEventRepository represents the repo object in a PushEvent payload. type PushEventRepository struct { - ID *int64 `json:"id,omitempty"` - NodeID *string `json:"node_id,omitempty"` - Name *string `json:"name,omitempty"` - FullName *string `json:"full_name,omitempty"` - Owner *User `json:"owner,omitempty"` - Private *bool `json:"private,omitempty"` - Description *string `json:"description,omitempty"` - Fork *bool `json:"fork,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - PushedAt *Timestamp `json:"pushed_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - Homepage *string `json:"homepage,omitempty"` - PullsURL *string `json:"pulls_url,omitempty"` - Size *int `json:"size,omitempty"` - StargazersCount *int `json:"stargazers_count,omitempty"` - WatchersCount *int `json:"watchers_count,omitempty"` - Language *string `json:"language,omitempty"` - HasIssues *bool `json:"has_issues,omitempty"` - HasDownloads *bool `json:"has_downloads,omitempty"` - HasWiki *bool `json:"has_wiki,omitempty"` - HasPages *bool `json:"has_pages,omitempty"` - ForksCount *int `json:"forks_count,omitempty"` - Archived *bool `json:"archived,omitempty"` - Disabled *bool `json:"disabled,omitempty"` - OpenIssuesCount *int `json:"open_issues_count,omitempty"` - DefaultBranch *string `json:"default_branch,omitempty"` - MasterBranch *string `json:"master_branch,omitempty"` - Organization *string `json:"organization,omitempty"` - URL *string `json:"url,omitempty"` - ArchiveURL *string `json:"archive_url,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - StatusesURL *string `json:"statuses_url,omitempty"` - GitURL *string `json:"git_url,omitempty"` - SSHURL *string `json:"ssh_url,omitempty"` - CloneURL *string `json:"clone_url,omitempty"` - SVNURL *string `json:"svn_url,omitempty"` - Topics []string `json:"topics,omitempty"` + ID *int64 `json:"id,omitempty"` + NodeID *string `json:"node_id,omitempty"` + Name *string `json:"name,omitempty"` + FullName *string `json:"full_name,omitempty"` + Owner *User `json:"owner,omitempty"` + Private *bool `json:"private,omitempty"` + Description *string `json:"description,omitempty"` + Fork *bool `json:"fork,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + PushedAt *Timestamp `json:"pushed_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + Homepage *string `json:"homepage,omitempty"` + PullsURL *string `json:"pulls_url,omitempty"` + Size *int `json:"size,omitempty"` + StargazersCount *int `json:"stargazers_count,omitempty"` + WatchersCount *int `json:"watchers_count,omitempty"` + Language *string `json:"language,omitempty"` + HasIssues *bool `json:"has_issues,omitempty"` + HasDownloads *bool `json:"has_downloads,omitempty"` + HasWiki *bool `json:"has_wiki,omitempty"` + HasPages *bool `json:"has_pages,omitempty"` + ForksCount *int `json:"forks_count,omitempty"` + Archived *bool `json:"archived,omitempty"` + Disabled *bool `json:"disabled,omitempty"` + OpenIssuesCount *int `json:"open_issues_count,omitempty"` + DefaultBranch *string `json:"default_branch,omitempty"` + MasterBranch *string `json:"master_branch,omitempty"` + Organization *string `json:"organization,omitempty"` + URL *string `json:"url,omitempty"` + ArchiveURL *string `json:"archive_url,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + StatusesURL *string `json:"statuses_url,omitempty"` + GitURL *string `json:"git_url,omitempty"` + SSHURL *string `json:"ssh_url,omitempty"` + CloneURL *string `json:"clone_url,omitempty"` + SVNURL *string `json:"svn_url,omitempty"` + Topics []string `json:"topics,omitempty"` + CustomProperties map[string]string `json:"custom_properties,omitempty"` } // PushEventRepoOwner is a basic representation of user/org in a PushEvent payload. diff --git a/github/github-accessors.go b/github/github-accessors.go index 6d32908ce01..20c8462132b 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -17150,6 +17150,14 @@ func (p *PushEventRepository) GetCreatedAt() Timestamp { return *p.CreatedAt } +// GetCustomProperties returns the CustomProperties map if it's non-nil, an empty map otherwise. +func (p *PushEventRepository) GetCustomProperties() map[string]string { + if p == nil || p.CustomProperties == nil { + return map[string]string{} + } + return p.CustomProperties +} + // GetDefaultBranch returns the DefaultBranch field if it's non-nil, zero value otherwise. func (p *PushEventRepository) GetDefaultBranch() string { if p == nil || p.DefaultBranch == nil { @@ -18286,6 +18294,14 @@ func (r *Repository) GetCreatedAt() Timestamp { return *r.CreatedAt } +// GetCustomProperties returns the CustomProperties map if it's non-nil, an empty map otherwise. +func (r *Repository) GetCustomProperties() map[string]string { + if r == nil || r.CustomProperties == nil { + return map[string]string{} + } + return r.CustomProperties +} + // GetDefaultBranch returns the DefaultBranch field if it's non-nil, zero value otherwise. func (r *Repository) GetDefaultBranch() string { if r == nil || r.DefaultBranch == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 5856cc7ac25..d35d4bf29fb 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -19842,6 +19842,16 @@ func TestPushEventRepository_GetCreatedAt(tt *testing.T) { p.GetCreatedAt() } +func TestPushEventRepository_GetCustomProperties(tt *testing.T) { + zeroValue := map[string]string{} + p := &PushEventRepository{CustomProperties: zeroValue} + p.GetCustomProperties() + p = &PushEventRepository{} + p.GetCustomProperties() + p = nil + p.GetCustomProperties() +} + func TestPushEventRepository_GetDefaultBranch(tt *testing.T) { var zeroValue string p := &PushEventRepository{DefaultBranch: &zeroValue} @@ -21196,6 +21206,16 @@ func TestRepository_GetCreatedAt(tt *testing.T) { r.GetCreatedAt() } +func TestRepository_GetCustomProperties(tt *testing.T) { + zeroValue := map[string]string{} + r := &Repository{CustomProperties: zeroValue} + r.GetCustomProperties() + r = &Repository{} + r.GetCustomProperties() + r = nil + r.GetCustomProperties() +} + func TestRepository_GetDefaultBranch(tt *testing.T) { var zeroValue string r := &Repository{DefaultBranch: &zeroValue} diff --git a/github/repos.go b/github/repos.go index a7574d72f07..b492e55b464 100644 --- a/github/repos.go +++ b/github/repos.go @@ -27,58 +27,59 @@ type RepositoriesService service // Repository represents a GitHub repository. type Repository struct { - ID *int64 `json:"id,omitempty"` - NodeID *string `json:"node_id,omitempty"` - Owner *User `json:"owner,omitempty"` - Name *string `json:"name,omitempty"` - FullName *string `json:"full_name,omitempty"` - Description *string `json:"description,omitempty"` - Homepage *string `json:"homepage,omitempty"` - CodeOfConduct *CodeOfConduct `json:"code_of_conduct,omitempty"` - DefaultBranch *string `json:"default_branch,omitempty"` - MasterBranch *string `json:"master_branch,omitempty"` - CreatedAt *Timestamp `json:"created_at,omitempty"` - PushedAt *Timestamp `json:"pushed_at,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - HTMLURL *string `json:"html_url,omitempty"` - CloneURL *string `json:"clone_url,omitempty"` - GitURL *string `json:"git_url,omitempty"` - MirrorURL *string `json:"mirror_url,omitempty"` - SSHURL *string `json:"ssh_url,omitempty"` - SVNURL *string `json:"svn_url,omitempty"` - Language *string `json:"language,omitempty"` - Fork *bool `json:"fork,omitempty"` - ForksCount *int `json:"forks_count,omitempty"` - NetworkCount *int `json:"network_count,omitempty"` - OpenIssuesCount *int `json:"open_issues_count,omitempty"` - OpenIssues *int `json:"open_issues,omitempty"` // Deprecated: Replaced by OpenIssuesCount. For backward compatibility OpenIssues is still populated. - StargazersCount *int `json:"stargazers_count,omitempty"` - SubscribersCount *int `json:"subscribers_count,omitempty"` - WatchersCount *int `json:"watchers_count,omitempty"` // Deprecated: Replaced by StargazersCount. For backward compatibility WatchersCount is still populated. - Watchers *int `json:"watchers,omitempty"` // Deprecated: Replaced by StargazersCount. For backward compatibility Watchers is still populated. - Size *int `json:"size,omitempty"` - AutoInit *bool `json:"auto_init,omitempty"` - Parent *Repository `json:"parent,omitempty"` - Source *Repository `json:"source,omitempty"` - TemplateRepository *Repository `json:"template_repository,omitempty"` - Organization *Organization `json:"organization,omitempty"` - Permissions map[string]bool `json:"permissions,omitempty"` - AllowRebaseMerge *bool `json:"allow_rebase_merge,omitempty"` - AllowUpdateBranch *bool `json:"allow_update_branch,omitempty"` - AllowSquashMerge *bool `json:"allow_squash_merge,omitempty"` - AllowMergeCommit *bool `json:"allow_merge_commit,omitempty"` - AllowAutoMerge *bool `json:"allow_auto_merge,omitempty"` - AllowForking *bool `json:"allow_forking,omitempty"` - WebCommitSignoffRequired *bool `json:"web_commit_signoff_required,omitempty"` - DeleteBranchOnMerge *bool `json:"delete_branch_on_merge,omitempty"` - UseSquashPRTitleAsDefault *bool `json:"use_squash_pr_title_as_default,omitempty"` - SquashMergeCommitTitle *string `json:"squash_merge_commit_title,omitempty"` // Can be one of: "PR_TITLE", "COMMIT_OR_PR_TITLE" - SquashMergeCommitMessage *string `json:"squash_merge_commit_message,omitempty"` // Can be one of: "PR_BODY", "COMMIT_MESSAGES", "BLANK" - MergeCommitTitle *string `json:"merge_commit_title,omitempty"` // Can be one of: "PR_TITLE", "MERGE_MESSAGE" - MergeCommitMessage *string `json:"merge_commit_message,omitempty"` // Can be one of: "PR_BODY", "PR_TITLE", "BLANK" - Topics []string `json:"topics,omitempty"` - Archived *bool `json:"archived,omitempty"` - Disabled *bool `json:"disabled,omitempty"` + ID *int64 `json:"id,omitempty"` + NodeID *string `json:"node_id,omitempty"` + Owner *User `json:"owner,omitempty"` + Name *string `json:"name,omitempty"` + FullName *string `json:"full_name,omitempty"` + Description *string `json:"description,omitempty"` + Homepage *string `json:"homepage,omitempty"` + CodeOfConduct *CodeOfConduct `json:"code_of_conduct,omitempty"` + DefaultBranch *string `json:"default_branch,omitempty"` + MasterBranch *string `json:"master_branch,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + PushedAt *Timestamp `json:"pushed_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + HTMLURL *string `json:"html_url,omitempty"` + CloneURL *string `json:"clone_url,omitempty"` + GitURL *string `json:"git_url,omitempty"` + MirrorURL *string `json:"mirror_url,omitempty"` + SSHURL *string `json:"ssh_url,omitempty"` + SVNURL *string `json:"svn_url,omitempty"` + Language *string `json:"language,omitempty"` + Fork *bool `json:"fork,omitempty"` + ForksCount *int `json:"forks_count,omitempty"` + NetworkCount *int `json:"network_count,omitempty"` + OpenIssuesCount *int `json:"open_issues_count,omitempty"` + OpenIssues *int `json:"open_issues,omitempty"` // Deprecated: Replaced by OpenIssuesCount. For backward compatibility OpenIssues is still populated. + StargazersCount *int `json:"stargazers_count,omitempty"` + SubscribersCount *int `json:"subscribers_count,omitempty"` + WatchersCount *int `json:"watchers_count,omitempty"` // Deprecated: Replaced by StargazersCount. For backward compatibility WatchersCount is still populated. + Watchers *int `json:"watchers,omitempty"` // Deprecated: Replaced by StargazersCount. For backward compatibility Watchers is still populated. + Size *int `json:"size,omitempty"` + AutoInit *bool `json:"auto_init,omitempty"` + Parent *Repository `json:"parent,omitempty"` + Source *Repository `json:"source,omitempty"` + TemplateRepository *Repository `json:"template_repository,omitempty"` + Organization *Organization `json:"organization,omitempty"` + Permissions map[string]bool `json:"permissions,omitempty"` + AllowRebaseMerge *bool `json:"allow_rebase_merge,omitempty"` + AllowUpdateBranch *bool `json:"allow_update_branch,omitempty"` + AllowSquashMerge *bool `json:"allow_squash_merge,omitempty"` + AllowMergeCommit *bool `json:"allow_merge_commit,omitempty"` + AllowAutoMerge *bool `json:"allow_auto_merge,omitempty"` + AllowForking *bool `json:"allow_forking,omitempty"` + WebCommitSignoffRequired *bool `json:"web_commit_signoff_required,omitempty"` + DeleteBranchOnMerge *bool `json:"delete_branch_on_merge,omitempty"` + UseSquashPRTitleAsDefault *bool `json:"use_squash_pr_title_as_default,omitempty"` + SquashMergeCommitTitle *string `json:"squash_merge_commit_title,omitempty"` // Can be one of: "PR_TITLE", "COMMIT_OR_PR_TITLE" + SquashMergeCommitMessage *string `json:"squash_merge_commit_message,omitempty"` // Can be one of: "PR_BODY", "COMMIT_MESSAGES", "BLANK" + MergeCommitTitle *string `json:"merge_commit_title,omitempty"` // Can be one of: "PR_TITLE", "MERGE_MESSAGE" + MergeCommitMessage *string `json:"merge_commit_message,omitempty"` // Can be one of: "PR_BODY", "PR_TITLE", "BLANK" + Topics []string `json:"topics,omitempty"` + CustomProperties map[string]string `json:"custom_properties,omitempty"` + Archived *bool `json:"archived,omitempty"` + Disabled *bool `json:"disabled,omitempty"` // Only provided when using RepositoriesService.Get while in preview License *License `json:"license,omitempty"` From 8f2dcee2e7706ca2a47f8310eec900520468e3a1 Mon Sep 17 00:00:00 2001 From: Abhishek Sharma Date: Thu, 1 Feb 2024 11:57:13 -0600 Subject: [PATCH 100/145] Add support for deployment protection rules (#3050) Fixes: #3022. --- github/github-accessors.go | 88 ++++++++ github/github-accessors_test.go | 107 +++++++++ github/repos_deployment_protection_rules.go | 148 ++++++++++++ .../repos_deployment_protection_rules_test.go | 213 ++++++++++++++++++ 4 files changed, 556 insertions(+) create mode 100644 github/repos_deployment_protection_rules.go create mode 100644 github/repos_deployment_protection_rules_test.go diff --git a/github/github-accessors.go b/github/github-accessors.go index 20c8462132b..00211cd7145 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -4590,6 +4590,78 @@ func (c *Credit) GetUser() *User { return c.User } +// GetApp returns the App field. +func (c *CustomDeploymentProtectionRule) GetApp() *CustomDeploymentProtectionRuleApp { + if c == nil { + return nil + } + return c.App +} + +// GetEnabled returns the Enabled field if it's non-nil, zero value otherwise. +func (c *CustomDeploymentProtectionRule) GetEnabled() bool { + if c == nil || c.Enabled == nil { + return false + } + return *c.Enabled +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (c *CustomDeploymentProtectionRule) GetID() int64 { + if c == nil || c.ID == nil { + return 0 + } + return *c.ID +} + +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (c *CustomDeploymentProtectionRule) GetNodeID() string { + if c == nil || c.NodeID == nil { + return "" + } + return *c.NodeID +} + +// GetID returns the ID field if it's non-nil, zero value otherwise. +func (c *CustomDeploymentProtectionRuleApp) GetID() int64 { + if c == nil || c.ID == nil { + return 0 + } + return *c.ID +} + +// GetIntegrationURL returns the IntegrationURL field if it's non-nil, zero value otherwise. +func (c *CustomDeploymentProtectionRuleApp) GetIntegrationURL() string { + if c == nil || c.IntegrationURL == nil { + return "" + } + return *c.IntegrationURL +} + +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (c *CustomDeploymentProtectionRuleApp) GetNodeID() string { + if c == nil || c.NodeID == nil { + return "" + } + return *c.NodeID +} + +// GetSlug returns the Slug field if it's non-nil, zero value otherwise. +func (c *CustomDeploymentProtectionRuleApp) GetSlug() string { + if c == nil || c.Slug == nil { + return "" + } + return *c.Slug +} + +// GetIntegrationID returns the IntegrationID field if it's non-nil, zero value otherwise. +func (c *CustomDeploymentProtectionRuleRequest) GetIntegrationID() int64 { + if c == nil || c.IntegrationID == nil { + return 0 + } + return *c.IntegrationID +} + // GetDefaultValue returns the DefaultValue field if it's non-nil, zero value otherwise. func (c *CustomProperty) GetDefaultValue() string { if c == nil || c.DefaultValue == nil { @@ -10526,6 +10598,22 @@ func (l *ListCollaboratorOptions) GetAffiliation() string { return *l.Affiliation } +// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. +func (l *ListCustomDeploymentRuleIntegrationsResponse) GetTotalCount() int { + if l == nil || l.TotalCount == nil { + return 0 + } + return *l.TotalCount +} + +// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. +func (l *ListDeploymentProtectionRuleResponse) GetTotalCount() int { + if l == nil || l.TotalCount == nil { + return 0 + } + return *l.TotalCount +} + // GetDisplayName returns the DisplayName field if it's non-nil, zero value otherwise. func (l *ListExternalGroupsOptions) GetDisplayName() string { if l == nil || l.DisplayName == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index d35d4bf29fb..7f7962cd10e 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -5399,6 +5399,93 @@ func TestCredit_GetUser(tt *testing.T) { c.GetUser() } +func TestCustomDeploymentProtectionRule_GetApp(tt *testing.T) { + c := &CustomDeploymentProtectionRule{} + c.GetApp() + c = nil + c.GetApp() +} + +func TestCustomDeploymentProtectionRule_GetEnabled(tt *testing.T) { + var zeroValue bool + c := &CustomDeploymentProtectionRule{Enabled: &zeroValue} + c.GetEnabled() + c = &CustomDeploymentProtectionRule{} + c.GetEnabled() + c = nil + c.GetEnabled() +} + +func TestCustomDeploymentProtectionRule_GetID(tt *testing.T) { + var zeroValue int64 + c := &CustomDeploymentProtectionRule{ID: &zeroValue} + c.GetID() + c = &CustomDeploymentProtectionRule{} + c.GetID() + c = nil + c.GetID() +} + +func TestCustomDeploymentProtectionRule_GetNodeID(tt *testing.T) { + var zeroValue string + c := &CustomDeploymentProtectionRule{NodeID: &zeroValue} + c.GetNodeID() + c = &CustomDeploymentProtectionRule{} + c.GetNodeID() + c = nil + c.GetNodeID() +} + +func TestCustomDeploymentProtectionRuleApp_GetID(tt *testing.T) { + var zeroValue int64 + c := &CustomDeploymentProtectionRuleApp{ID: &zeroValue} + c.GetID() + c = &CustomDeploymentProtectionRuleApp{} + c.GetID() + c = nil + c.GetID() +} + +func TestCustomDeploymentProtectionRuleApp_GetIntegrationURL(tt *testing.T) { + var zeroValue string + c := &CustomDeploymentProtectionRuleApp{IntegrationURL: &zeroValue} + c.GetIntegrationURL() + c = &CustomDeploymentProtectionRuleApp{} + c.GetIntegrationURL() + c = nil + c.GetIntegrationURL() +} + +func TestCustomDeploymentProtectionRuleApp_GetNodeID(tt *testing.T) { + var zeroValue string + c := &CustomDeploymentProtectionRuleApp{NodeID: &zeroValue} + c.GetNodeID() + c = &CustomDeploymentProtectionRuleApp{} + c.GetNodeID() + c = nil + c.GetNodeID() +} + +func TestCustomDeploymentProtectionRuleApp_GetSlug(tt *testing.T) { + var zeroValue string + c := &CustomDeploymentProtectionRuleApp{Slug: &zeroValue} + c.GetSlug() + c = &CustomDeploymentProtectionRuleApp{} + c.GetSlug() + c = nil + c.GetSlug() +} + +func TestCustomDeploymentProtectionRuleRequest_GetIntegrationID(tt *testing.T) { + var zeroValue int64 + c := &CustomDeploymentProtectionRuleRequest{IntegrationID: &zeroValue} + c.GetIntegrationID() + c = &CustomDeploymentProtectionRuleRequest{} + c.GetIntegrationID() + c = nil + c.GetIntegrationID() +} + func TestCustomProperty_GetDefaultValue(tt *testing.T) { var zeroValue string c := &CustomProperty{DefaultValue: &zeroValue} @@ -12300,6 +12387,26 @@ func TestListCollaboratorOptions_GetAffiliation(tt *testing.T) { l.GetAffiliation() } +func TestListCustomDeploymentRuleIntegrationsResponse_GetTotalCount(tt *testing.T) { + var zeroValue int + l := &ListCustomDeploymentRuleIntegrationsResponse{TotalCount: &zeroValue} + l.GetTotalCount() + l = &ListCustomDeploymentRuleIntegrationsResponse{} + l.GetTotalCount() + l = nil + l.GetTotalCount() +} + +func TestListDeploymentProtectionRuleResponse_GetTotalCount(tt *testing.T) { + var zeroValue int + l := &ListDeploymentProtectionRuleResponse{TotalCount: &zeroValue} + l.GetTotalCount() + l = &ListDeploymentProtectionRuleResponse{} + l.GetTotalCount() + l = nil + l.GetTotalCount() +} + func TestListExternalGroupsOptions_GetDisplayName(tt *testing.T) { var zeroValue string l := &ListExternalGroupsOptions{DisplayName: &zeroValue} diff --git a/github/repos_deployment_protection_rules.go b/github/repos_deployment_protection_rules.go new file mode 100644 index 00000000000..29d49032818 --- /dev/null +++ b/github/repos_deployment_protection_rules.go @@ -0,0 +1,148 @@ +// Copyright 2024 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "fmt" +) + +// CustomDeploymentProtectionRuleApp represents a single deployment protection rule app for an environment. +type CustomDeploymentProtectionRuleApp struct { + ID *int64 `json:"id,omitempty"` + Slug *string `json:"slug,omitempty"` + IntegrationURL *string `json:"integration_url,omitempty"` + NodeID *string `json:"node_id,omitempty"` +} + +// CustomDeploymentProtectionRule represents a single deployment protection rule for an environment. +type CustomDeploymentProtectionRule struct { + ID *int64 `json:"id,omitempty"` + NodeID *string `json:"node_id,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + App *CustomDeploymentProtectionRuleApp `json:"app,omitempty"` +} + +// ListDeploymentProtectionRuleResponse represents the response that comes back when you list deployment protection rules. +type ListDeploymentProtectionRuleResponse struct { + TotalCount *int `json:"total_count,omitempty"` + ProtectionRules []*CustomDeploymentProtectionRule `json:"custom_deployment_protection_rules,omitempty"` +} + +// ListCustomDeploymentRuleIntegrationsResponse represents the slightly different response that comes back when you list custom deployment rule integrations. +type ListCustomDeploymentRuleIntegrationsResponse struct { + TotalCount *int `json:"total_count,omitempty"` + AvailableIntegrations []*CustomDeploymentProtectionRuleApp `json:"available_custom_deployment_protection_rule_integrations,omitempty"` +} + +// CustomDeploymentProtectionRuleRequest represents a deployment protection rule request. +type CustomDeploymentProtectionRuleRequest struct { + IntegrationID *int64 `json:"integration_id,omitempty"` +} + +// GetAllDeploymentProtectionRules gets all the deployment protection rules for an environment. +// +// GitHub API docs: https://docs.github.com/rest/deployments/protection-rules#get-all-deployment-protection-rules-for-an-environment +// +//meta:operation GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules +func (s *RepositoriesService) GetAllDeploymentProtectionRules(ctx context.Context, owner, repo, environment string) (*ListDeploymentProtectionRuleResponse, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment_protection_rules", owner, repo, environment) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var list *ListDeploymentProtectionRuleResponse + resp, err := s.client.Do(ctx, req, &list) + if err != nil { + return nil, resp, err + } + + return list, resp, nil +} + +// CreateCustomDeploymentProtectionRule creates a custom deployment protection rule on an environment. +// +// GitHub API docs: https://docs.github.com/rest/deployments/protection-rules#create-a-custom-deployment-protection-rule-on-an-environment +// +//meta:operation POST /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules +func (s *RepositoriesService) CreateCustomDeploymentProtectionRule(ctx context.Context, owner, repo, environment string, request *CustomDeploymentProtectionRuleRequest) (*CustomDeploymentProtectionRule, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment_protection_rules", owner, repo, environment) + + req, err := s.client.NewRequest("POST", u, request) + if err != nil { + return nil, nil, err + } + + protectionRule := new(CustomDeploymentProtectionRule) + resp, err := s.client.Do(ctx, req, protectionRule) + if err != nil { + return nil, resp, err + } + + return protectionRule, resp, nil +} + +// ListCustomDeploymentRuleIntegrations lists the custom deployment rule integrations for an environment. +// +// GitHub API docs: https://docs.github.com/rest/deployments/protection-rules#list-custom-deployment-rule-integrations-available-for-an-environment +// +//meta:operation GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/apps +func (s *RepositoriesService) ListCustomDeploymentRuleIntegrations(ctx context.Context, owner, repo, environment string) (*ListCustomDeploymentRuleIntegrationsResponse, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment_protection_rules/apps", owner, repo, environment) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var list *ListCustomDeploymentRuleIntegrationsResponse + resp, err := s.client.Do(ctx, req, &list) + if err != nil { + return nil, resp, err + } + + return list, resp, nil +} + +// GetCustomDeploymentProtectionRule gets a custom deployment protection rule for an environment. +// +// GitHub API docs: https://docs.github.com/rest/deployments/protection-rules#get-a-custom-deployment-protection-rule +// +//meta:operation GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/{protection_rule_id} +func (s *RepositoriesService) GetCustomDeploymentProtectionRule(ctx context.Context, owner, repo, environment string, protectionRuleID int64) (*CustomDeploymentProtectionRule, *Response, error) { + u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment_protection_rules/%v", owner, repo, environment, protectionRuleID) + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + var protectionRule *CustomDeploymentProtectionRule + resp, err := s.client.Do(ctx, req, &protectionRule) + if err != nil { + return nil, resp, err + } + + return protectionRule, resp, nil +} + +// DisableCustomDeploymentProtectionRule disables a custom deployment protection rule for an environment. +// +// GitHub API docs: https://docs.github.com/rest/deployments/protection-rules#disable-a-custom-protection-rule-for-an-environment +// +//meta:operation DELETE /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/{protection_rule_id} +func (s *RepositoriesService) DisableCustomDeploymentProtectionRule(ctx context.Context, owner, repo, environment string, protectionRuleID int64) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/environments/%v/deployment_protection_rules/%v", owner, repo, environment, protectionRuleID) + + req, err := s.client.NewRequest("DELETE", u, nil) + if err != nil { + return nil, err + } + + return s.client.Do(ctx, req, nil) +} diff --git a/github/repos_deployment_protection_rules_test.go b/github/repos_deployment_protection_rules_test.go new file mode 100644 index 00000000000..d5a6b87acc7 --- /dev/null +++ b/github/repos_deployment_protection_rules_test.go @@ -0,0 +1,213 @@ +// Copyright 2024 The go-github AUTHORS. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package github + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + "reflect" + "testing" + + "github.com/google/go-cmp/cmp" +) + +func TestRepositoriesService_GetAllDeploymentProtectionRules(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/repos/o/r/environments/e/deployment_protection_rules", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + fmt.Fprint(w, `{"total_count":2, "custom_deployment_protection_rules":[{ "id": 3, "node_id": "IEH37kRlcGxveW1lbnRTdGF0ddiv", "enabled": true, "app": { "id": 1, "node_id": "GHT58kRlcGxveW1lbnRTdTY!bbcy", "slug": "a-custom-app", "integration_url": "https://api.github.com/apps/a-custom-app"}}, { "id": 4, "node_id": "MDE2OkRlcGxveW1lbnRTdHJ41128", "enabled": true, "app": { "id": 1, "node_id": "UHVE67RlcGxveW1lbnRTdTY!jfeuy", "slug": "another-custom-app", "integration_url": "https://api.github.com/apps/another-custom-app"}}]}`) + }) + + ctx := context.Background() + got, _, err := client.Repositories.GetAllDeploymentProtectionRules(ctx, "o", "r", "e") + if err != nil { + t.Errorf("Repositories.GetAllDeploymentProtectionRules returned error: %v", err) + } + + want := &ListDeploymentProtectionRuleResponse{ + ProtectionRules: []*CustomDeploymentProtectionRule{ + {ID: Int64(3), NodeID: String("IEH37kRlcGxveW1lbnRTdGF0ddiv"), Enabled: Bool(true), App: &CustomDeploymentProtectionRuleApp{ID: Int64(1), NodeID: String("GHT58kRlcGxveW1lbnRTdTY!bbcy"), Slug: String("a-custom-app"), IntegrationURL: String("https://api.github.com/apps/a-custom-app")}}, + {ID: Int64(4), NodeID: String("MDE2OkRlcGxveW1lbnRTdHJ41128"), Enabled: Bool(true), App: &CustomDeploymentProtectionRuleApp{ID: Int64(1), NodeID: String("UHVE67RlcGxveW1lbnRTdTY!jfeuy"), Slug: String("another-custom-app"), IntegrationURL: String("https://api.github.com/apps/another-custom-app")}}, + }, + TotalCount: Int(2), + } + if !reflect.DeepEqual(got, want) { + t.Errorf("Repositories.GetAllDeploymentProtectionRules = %+v, want %+v", got, want) + } + + const methodName = "GetAllDeploymentProtectionRules" + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Repositories.GetAllDeploymentProtectionRules(ctx, "o", "r", "e") + if got != nil { + t.Errorf("got non-nil Repositories.GetAllDeploymentProtectionRules response: %+v", got) + } + return resp, err + }) +} + +func TestRepositoriesService_CreateCustomDeploymentProtectionRule(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + input := &CustomDeploymentProtectionRuleRequest{ + IntegrationID: Int64(5), + } + + mux.HandleFunc("/repos/o/r/environments/e/deployment_protection_rules", func(w http.ResponseWriter, r *http.Request) { + v := new(CustomDeploymentProtectionRuleRequest) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) + + testMethod(t, r, "POST") + want := input + if !reflect.DeepEqual(v, want) { + t.Errorf("Request body = %+v, want %+v", v, want) + } + + fmt.Fprint(w, `{"id":3, "node_id": "IEH37kRlcGxveW1lbnRTdGF0ddiv", "enabled": true, "app": {"id": 1, "node_id": "GHT58kRlcGxveW1lbnRTdTY!bbcy", "slug": "a-custom-app", "integration_url": "https://api.github.com/apps/a-custom-app"}}`) + }) + + ctx := context.Background() + got, _, err := client.Repositories.CreateCustomDeploymentProtectionRule(ctx, "o", "r", "e", input) + if err != nil { + t.Errorf("Repositories.CreateCustomDeploymentProtectionRule returned error: %v", err) + } + + want := &CustomDeploymentProtectionRule{ + ID: Int64(3), + NodeID: String("IEH37kRlcGxveW1lbnRTdGF0ddiv"), + Enabled: Bool(true), + App: &CustomDeploymentProtectionRuleApp{ + ID: Int64(1), + NodeID: String("GHT58kRlcGxveW1lbnRTdTY!bbcy"), + Slug: String("a-custom-app"), + IntegrationURL: String("https://api.github.com/apps/a-custom-app"), + }, + } + if !reflect.DeepEqual(got, want) { + t.Errorf("Repositories.CreateCustomDeploymentProtectionRule = %+v, want %+v", got, want) + } + + const methodName = "CreateCustomDeploymentProtectionRule" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Repositories.CreateCustomDeploymentProtectionRule(ctx, "\n", "\n", "\n", input) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Repositories.CreateCustomDeploymentProtectionRule(ctx, "o", "r", "e", input) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + +func TestRepositoriesService_ListCustomDeploymentRuleIntegrations(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/repos/o/r/environments/e/deployment_protection_rules/apps", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + fmt.Fprint(w, `{"total_count": 2, "available_custom_deployment_protection_rule_integrations": [{"id": 1, "node_id": "GHT58kRlcGxveW1lbnRTdTY!bbcy", "slug": "a-custom-app", "integration_url": "https://api.github.com/apps/a-custom-app"}, {"id": 2, "node_id": "UHVE67RlcGxveW1lbnRTdTY!jfeuy", "slug": "another-custom-app", "integration_url": "https://api.github.com/apps/another-custom-app"}]}`) + }) + + ctx := context.Background() + got, _, err := client.Repositories.ListCustomDeploymentRuleIntegrations(ctx, "o", "r", "e") + if err != nil { + t.Errorf("Repositories.ListCustomDeploymentRuleIntegrations returned error: %v", err) + } + + want := &ListCustomDeploymentRuleIntegrationsResponse{ + TotalCount: Int(2), + AvailableIntegrations: []*CustomDeploymentProtectionRuleApp{ + {ID: Int64(1), NodeID: String("GHT58kRlcGxveW1lbnRTdTY!bbcy"), Slug: String("a-custom-app"), IntegrationURL: String("https://api.github.com/apps/a-custom-app")}, + {ID: Int64(2), NodeID: String("UHVE67RlcGxveW1lbnRTdTY!jfeuy"), Slug: String("another-custom-app"), IntegrationURL: String("https://api.github.com/apps/another-custom-app")}, + }, + } + if !reflect.DeepEqual(got, want) { + t.Errorf("Repositories.ListCustomDeploymentRuleIntegrations = %+v, want %+v", got, want) + } + + const methodName = "ListCustomDeploymentRuleIntegrations" + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Repositories.ListCustomDeploymentRuleIntegrations(ctx, "o", "r", "e") + if got != nil { + t.Errorf("got non-nil Repositories.ListCustomDeploymentRuleIntegrations response: %+v", got) + } + return resp, err + }) +} + +func TestRepositoriesService_GetCustomDeploymentProtectionRule(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/repos/o/r/environments/e/deployment_protection_rules/1", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + fmt.Fprint(w, `{"id":1, "node_id": "IEH37kRlcGxveW1lbnRTdGF0ddiv", "enabled": true, "app": {"id": 1, "node_id": "GHT58kRlcGxveW1lbnRTdTY!bbcy", "slug": "a-custom-app", "integration_url": "https://api.github.com/apps/a-custom-app"}}`) + }) + + ctx := context.Background() + got, _, err := client.Repositories.GetCustomDeploymentProtectionRule(ctx, "o", "r", "e", 1) + if err != nil { + t.Errorf("Repositories.GetCustomDeploymentProtectionRule returned error: %v", err) + } + + want := &CustomDeploymentProtectionRule{ + ID: Int64(1), + NodeID: String("IEH37kRlcGxveW1lbnRTdGF0ddiv"), + Enabled: Bool(true), + App: &CustomDeploymentProtectionRuleApp{ + ID: Int64(1), + NodeID: String("GHT58kRlcGxveW1lbnRTdTY!bbcy"), + Slug: String("a-custom-app"), + IntegrationURL: String("https://api.github.com/apps/a-custom-app"), + }, + } + + if !reflect.DeepEqual(got, want) { + t.Errorf("Repositories.GetCustomDeploymentProtectionRule = %+v, want %+v", got, want) + } + + const methodName = "GetCustomDeploymentProtectionRule" + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Repositories.GetCustomDeploymentProtectionRule(ctx, "o", "r", "e", 1) + if got != nil { + t.Errorf("got non-nil Repositories.GetCustomDeploymentProtectionRule response: %+v", got) + } + return resp, err + }) +} + +func TestRepositoriesService_DisableCustomDeploymentProtectionRule(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/repos/o/r/environments/e/deployment_protection_rules/1", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "DELETE") + w.WriteHeader(http.StatusNoContent) + }) + + ctx := context.Background() + resp, err := client.Repositories.DisableCustomDeploymentProtectionRule(ctx, "o", "r", "e", 1) + if err != nil { + t.Errorf("Repositories.DisableCustomDeploymentProtectionRule returned error: %v", err) + } + + if !cmp.Equal(resp.StatusCode, 204) { + t.Errorf("Repositories.DisableCustomDeploymentProtectionRule returned status code %+v, want %+v", resp.StatusCode, "204") + } + + const methodName = "DisableCustomDeploymentProtectionRule" + testBadOptions(t, methodName, func() (err error) { + _, err = client.Repositories.DisableCustomDeploymentProtectionRule(ctx, "\n", "\n", "\n", 1) + return err + }) +} From 2b8c7fa86fcd1cb4a89a44c8e7b5a49fe4be8a45 Mon Sep 17 00:00:00 2001 From: Travis Tomsu Date: Thu, 1 Feb 2024 13:07:27 -0500 Subject: [PATCH 101/145] Add suspended as option to AdminService.CreateUser() (#3049) --- github/admin_users.go | 18 +++++++----------- github/admin_users_test.go | 22 +++++++++++++++------- github/github-accessors.go | 16 ++++++++++++++++ github/github-accessors_test.go | 20 ++++++++++++++++++++ 4 files changed, 58 insertions(+), 18 deletions(-) diff --git a/github/admin_users.go b/github/admin_users.go index 0d3fe9fafc1..e134ff34dbf 100644 --- a/github/admin_users.go +++ b/github/admin_users.go @@ -10,11 +10,12 @@ import ( "fmt" ) -// createUserRequest is a subset of User and is used internally -// by CreateUser to pass only the known fields for the endpoint. -type createUserRequest struct { - Login *string `json:"login,omitempty"` - Email *string `json:"email,omitempty"` +// CreateUserRequest represents the fields sent to the `CreateUser` endpoint. +// Note that `Login` is a required field. +type CreateUserRequest struct { + Login string `json:"login"` + Email *string `json:"email,omitempty"` + Suspended *bool `json:"suspended,omitempty"` } // CreateUser creates a new user in GitHub Enterprise. @@ -22,14 +23,9 @@ type createUserRequest struct { // GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#create-a-user // //meta:operation POST /admin/users -func (s *AdminService) CreateUser(ctx context.Context, login, email string) (*User, *Response, error) { +func (s *AdminService) CreateUser(ctx context.Context, userReq CreateUserRequest) (*User, *Response, error) { u := "admin/users" - userReq := &createUserRequest{ - Login: &login, - Email: &email, - } - req, err := s.client.NewRequest("POST", u, userReq) if err != nil { return nil, nil, err diff --git a/github/admin_users_test.go b/github/admin_users_test.go index 2dac611709e..d29a7e672f1 100644 --- a/github/admin_users_test.go +++ b/github/admin_users_test.go @@ -21,11 +21,11 @@ func TestAdminUsers_Create(t *testing.T) { defer teardown() mux.HandleFunc("/admin/users", func(w http.ResponseWriter, r *http.Request) { - v := new(createUserRequest) + v := new(CreateUserRequest) assertNilError(t, json.NewDecoder(r.Body).Decode(v)) testMethod(t, r, "POST") - want := &createUserRequest{Login: String("github"), Email: String("email@domain.com")} + want := &CreateUserRequest{Login: "github", Email: String("email@domain.com"), Suspended: Bool(false)} if !cmp.Equal(v, want) { t.Errorf("Request body = %+v, want %+v", v, want) } @@ -34,7 +34,11 @@ func TestAdminUsers_Create(t *testing.T) { }) ctx := context.Background() - org, _, err := client.Admin.CreateUser(ctx, "github", "email@domain.com") + org, _, err := client.Admin.CreateUser(ctx, CreateUserRequest{ + Login: "github", + Email: String("email@domain.com"), + Suspended: Bool(false), + }) if err != nil { t.Errorf("Admin.CreateUser returned error: %v", err) } @@ -46,7 +50,11 @@ func TestAdminUsers_Create(t *testing.T) { const methodName = "CreateUser" testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Admin.CreateUser(ctx, "github", "email@domain.com") + got, resp, err := client.Admin.CreateUser(ctx, CreateUserRequest{ + Login: "github", + Email: String("email@domain.com"), + Suspended: Bool(false), + }) if got != nil { t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) } @@ -177,10 +185,10 @@ func TestUserImpersonation_Delete(t *testing.T) { } func TestCreateUserRequest_Marshal(t *testing.T) { - testJSONMarshal(t, &createUserRequest{}, "{}") + testJSONMarshal(t, &CreateUserRequest{}, "{}") - u := &createUserRequest{ - Login: String("l"), + u := &CreateUserRequest{ + Login: "l", Email: String("e"), } diff --git a/github/github-accessors.go b/github/github-accessors.go index 00211cd7145..e28fd275682 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -4478,6 +4478,22 @@ func (c *CreateUserProjectOptions) GetBody() string { return *c.Body } +// GetEmail returns the Email field if it's non-nil, zero value otherwise. +func (c *CreateUserRequest) GetEmail() string { + if c == nil || c.Email == nil { + return "" + } + return *c.Email +} + +// GetSuspended returns the Suspended field if it's non-nil, zero value otherwise. +func (c *CreateUserRequest) GetSuspended() bool { + if c == nil || c.Suspended == nil { + return false + } + return *c.Suspended +} + // GetCreated returns the Created field if it's non-nil, zero value otherwise. func (c *CreationInfo) GetCreated() Timestamp { if c == nil || c.Created == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 7f7962cd10e..4c349a05ae8 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -5262,6 +5262,26 @@ func TestCreateUserProjectOptions_GetBody(tt *testing.T) { c.GetBody() } +func TestCreateUserRequest_GetEmail(tt *testing.T) { + var zeroValue string + c := &CreateUserRequest{Email: &zeroValue} + c.GetEmail() + c = &CreateUserRequest{} + c.GetEmail() + c = nil + c.GetEmail() +} + +func TestCreateUserRequest_GetSuspended(tt *testing.T) { + var zeroValue bool + c := &CreateUserRequest{Suspended: &zeroValue} + c.GetSuspended() + c = &CreateUserRequest{} + c.GetSuspended() + c = nil + c.GetSuspended() +} + func TestCreationInfo_GetCreated(tt *testing.T) { var zeroValue Timestamp c := &CreationInfo{Created: &zeroValue} From 975b2e55cec1dd1a438ed15ec605cc46113506ab Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Feb 2024 14:40:49 -0500 Subject: [PATCH 102/145] Bump codecov/codecov-action from 3.1.5 to 4.0.1 (#3066) --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index aab03d750e4..267066633b5 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -73,4 +73,4 @@ jobs: - name: Upload coverage to Codecov if: ${{ matrix.update-coverage }} - uses: codecov/codecov-action@4fe8c5f003fae66aa5ebb77cfd3e7bfbbda0b6b0 #v3.1.5 + uses: codecov/codecov-action@e0b68c6749509c5f83f984dd99a76a1c1a231044 #v4.0.1 From 9390a86d3969e000efb18cebf6930948a901f217 Mon Sep 17 00:00:00 2001 From: Ryo Mimura <52129983+fchimpan@users.noreply.github.com> Date: Fri, 9 Feb 2024 21:37:05 +0900 Subject: [PATCH 103/145] Add ListWorkflowJobsAttempt method to ActionsService (#3060) Fixes: #3059. --- github/actions_workflow_jobs.go | 26 ++++++++++++++ github/actions_workflow_jobs_test.go | 54 ++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) diff --git a/github/actions_workflow_jobs.go b/github/actions_workflow_jobs.go index 0e0eb6e1146..84bbe5aa46d 100644 --- a/github/actions_workflow_jobs.go +++ b/github/actions_workflow_jobs.go @@ -94,6 +94,32 @@ func (s *ActionsService) ListWorkflowJobs(ctx context.Context, owner, repo strin return jobs, resp, nil } +// ListWorkflowJobsAttempt lists jobs for a workflow run Attempt. +// +// GitHub API docs: https://docs.github.com/rest/actions/workflow-jobs#list-jobs-for-a-workflow-run-attempt +// +//meta:operation GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/jobs +func (s *ActionsService) ListWorkflowJobsAttempt(ctx context.Context, owner, repo string, runID, attemptNumber int64, opts *ListOptions) (*Jobs, *Response, error) { + u := fmt.Sprintf("repos/%s/%s/actions/runs/%v/attempts/%v/jobs", owner, repo, runID, attemptNumber) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest("GET", u, nil) + if err != nil { + return nil, nil, err + } + + jobs := new(Jobs) + resp, err := s.client.Do(ctx, req, &jobs) + if err != nil { + return nil, resp, err + } + + return jobs, resp, nil +} + // GetWorkflowJobByID gets a specific job in a workflow run by ID. // // GitHub API docs: https://docs.github.com/rest/actions/workflow-jobs#get-a-job-for-a-workflow-run diff --git a/github/actions_workflow_jobs_test.go b/github/actions_workflow_jobs_test.go index 1cdf4a6c81a..4e46b1377b9 100644 --- a/github/actions_workflow_jobs_test.go +++ b/github/actions_workflow_jobs_test.go @@ -89,6 +89,60 @@ func TestActionsService_ListWorkflowJobs_Filter(t *testing.T) { } } +func TestActionsService_ListWorkflowJobsAttempt(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/repos/o/r/actions/runs/29679449/attempts/1/jobs", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "GET") + testFormValues(t, r, values{"per_page": "2", "page": "2"}) + fmt.Fprint(w, `{"total_count":4,"jobs":[{"id":399444496,"run_id":29679449,"started_at":"2019-01-02T15:04:05Z","completed_at":"2020-01-02T15:04:05Z","run_attempt":2},{"id":399444497,"run_id":29679449,"started_at":"2019-01-02T15:04:05Z","completed_at":"2020-01-02T15:04:05Z","run_attempt":2}]}`) + }) + opts := &ListOptions{Page: 2, PerPage: 2} + ctx := context.Background() + jobs, _, err := client.Actions.ListWorkflowJobsAttempt(ctx, "o", "r", 29679449, 1, opts) + if err != nil { + t.Errorf("Actions.ListWorkflowJobsAttempt returned error: %v", err) + } + + want := &Jobs{ + TotalCount: Int(4), + Jobs: []*WorkflowJob{ + { + ID: Int64(399444496), + RunID: Int64(29679449), + StartedAt: &Timestamp{time.Date(2019, time.January, 02, 15, 04, 05, 0, time.UTC)}, + CompletedAt: &Timestamp{time.Date(2020, time.January, 02, 15, 04, 05, 0, time.UTC)}, + RunAttempt: Int64(2), + }, + { + ID: Int64(399444497), + RunID: Int64(29679449), + StartedAt: &Timestamp{time.Date(2019, time.January, 02, 15, 04, 05, 0, time.UTC)}, + CompletedAt: &Timestamp{time.Date(2020, time.January, 02, 15, 04, 05, 0, time.UTC)}, + RunAttempt: Int64(2), + }, + }, + } + if !cmp.Equal(jobs, want) { + t.Errorf("Actions.ListWorkflowJobsAttempt returned %+v, want %+v", jobs, want) + } + + const methodName = "ListWorkflowJobsAttempt" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Actions.ListWorkflowJobsAttempt(ctx, "\n", "\n", 29679449, 1, opts) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Actions.ListWorkflowJobsAttempt(ctx, "o", "r", 29679449, 1, opts) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) +} + func TestActionsService_GetWorkflowJobByID(t *testing.T) { client, mux, _, teardown := setup() defer teardown() From 4177a193b1205aa1ab5019448bafc5c438ebb01e Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Fri, 9 Feb 2024 09:33:13 -0500 Subject: [PATCH 104/145] Bump version of go-github to v59.0.0 (#3068) --- README.md | 15 ++++++++------- example/actionpermissions/main.go | 2 +- example/appengine/app.go | 2 +- example/basicauth/main.go | 2 +- .../codespaces/newreposecretwithxcrypto/main.go | 2 +- .../codespaces/newusersecretwithxcrypto/main.go | 2 +- example/commitpr/main.go | 2 +- example/go.mod | 6 +++--- example/listenvironments/main.go | 2 +- example/migrations/main.go | 2 +- example/newfilewithappauth/main.go | 2 +- example/newrepo/main.go | 2 +- example/newreposecretwithlibsodium/go.mod | 4 ++-- example/newreposecretwithlibsodium/main.go | 2 +- example/newreposecretwithxcrypto/main.go | 2 +- example/ratelimit/main.go | 2 +- example/simple/main.go | 2 +- example/tagprotection/main.go | 2 +- example/tokenauth/main.go | 2 +- example/topics/main.go | 2 +- github/doc.go | 2 +- github/examples_test.go | 2 +- github/github.go | 2 +- go.mod | 2 +- test/fields/fields.go | 2 +- test/integration/activity_test.go | 2 +- test/integration/authorizations_test.go | 2 +- test/integration/github_test.go | 2 +- test/integration/repos_test.go | 2 +- test/integration/users_test.go | 2 +- tools/go.mod | 4 ++-- tools/metadata/main.go | 2 +- tools/metadata/main_test.go | 2 +- tools/metadata/metadata.go | 2 +- tools/metadata/openapi.go | 2 +- 35 files changed, 46 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index 099fd37311d..00407f2d745 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # go-github # [![go-github release (latest SemVer)](https://img.shields.io/github/v/release/google/go-github?sort=semver)](https://github.com/google/go-github/releases) -[![GoDoc](https://img.shields.io/static/v1?label=godoc&message=reference&color=blue)](https://pkg.go.dev/github.com/google/go-github/v58/github) +[![GoDoc](https://img.shields.io/static/v1?label=godoc&message=reference&color=blue)](https://pkg.go.dev/github.com/google/go-github/v59/github) [![Test Status](https://github.com/google/go-github/workflows/tests/badge.svg)](https://github.com/google/go-github/actions?query=workflow%3Atests) [![Test Coverage](https://codecov.io/gh/google/go-github/branch/master/graph/badge.svg)](https://codecov.io/gh/google/go-github) [![Discuss at go-github@googlegroups.com](https://img.shields.io/badge/discuss-go--github%40googlegroups.com-blue.svg)](https://groups.google.com/group/go-github) @@ -24,7 +24,7 @@ If you're interested in using the [GraphQL API v4][], the recommended library is go-github is compatible with modern Go releases in module mode, with Go installed: ```bash -go get github.com/google/go-github/v58 +go get github.com/google/go-github/v59 ``` will resolve and add the package to the current development module, along with its dependencies. @@ -32,7 +32,7 @@ will resolve and add the package to the current development module, along with i Alternatively the same can be achieved if you use import in a package: ```go -import "github.com/google/go-github/v58/github" +import "github.com/google/go-github/v59/github" ``` and run `go get` without parameters. @@ -40,13 +40,13 @@ and run `go get` without parameters. Finally, to use the top-of-trunk version of this repo, use the following command: ```bash -go get github.com/google/go-github/v58@master +go get github.com/google/go-github/v59@master ``` ## Usage ## ```go -import "github.com/google/go-github/v58/github" // with go modules enabled (GO111MODULE=on or outside GOPATH) +import "github.com/google/go-github/v59/github" // with go modules enabled (GO111MODULE=on or outside GOPATH) import "github.com/google/go-github/github" // with go modules disabled ``` @@ -117,7 +117,7 @@ import ( "net/http" "github.com/bradleyfalzon/ghinstallation/v2" - "github.com/google/go-github/v58/github" + "github.com/google/go-github/v59/github" ) func main() { @@ -296,7 +296,7 @@ For complete usage of go-github, see the full [package docs][]. [GitHub API v3]: https://docs.github.com/en/rest [personal access token]: https://github.com/blog/1509-personal-api-tokens -[package docs]: https://pkg.go.dev/github.com/google/go-github/v58/github +[package docs]: https://pkg.go.dev/github.com/google/go-github/v59/github [GraphQL API v4]: https://developer.github.com/v4/ [shurcooL/githubv4]: https://github.com/shurcooL/githubv4 [GitHub webhook events]: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads @@ -369,6 +369,7 @@ Versions prior to 48.2.0 are not listed. | go-github Version | GitHub v3 API Version | | ----------------- | --------------------- | +| 59.0.0 | 2022-11-28 | | 58.0.0 | 2022-11-28 | | 57.0.0 | 2022-11-28 | | 56.0.0 | 2022-11-28 | diff --git a/example/actionpermissions/main.go b/example/actionpermissions/main.go index ab1a4c9413d..f4229a8b8a6 100644 --- a/example/actionpermissions/main.go +++ b/example/actionpermissions/main.go @@ -14,7 +14,7 @@ import ( "log" "os" - "github.com/google/go-github/v58/github" + "github.com/google/go-github/v59/github" ) var ( diff --git a/example/appengine/app.go b/example/appengine/app.go index 998a5271904..2a971c3ce94 100644 --- a/example/appengine/app.go +++ b/example/appengine/app.go @@ -12,7 +12,7 @@ import ( "net/http" "os" - "github.com/google/go-github/v58/github" + "github.com/google/go-github/v59/github" "google.golang.org/appengine" "google.golang.org/appengine/log" ) diff --git a/example/basicauth/main.go b/example/basicauth/main.go index 958ccafb74e..5145185f851 100644 --- a/example/basicauth/main.go +++ b/example/basicauth/main.go @@ -21,7 +21,7 @@ import ( "os" "strings" - "github.com/google/go-github/v58/github" + "github.com/google/go-github/v59/github" "golang.org/x/term" ) diff --git a/example/codespaces/newreposecretwithxcrypto/main.go b/example/codespaces/newreposecretwithxcrypto/main.go index 0e4afb30bd3..8b4168697de 100644 --- a/example/codespaces/newreposecretwithxcrypto/main.go +++ b/example/codespaces/newreposecretwithxcrypto/main.go @@ -36,7 +36,7 @@ import ( "log" "os" - "github.com/google/go-github/v58/github" + "github.com/google/go-github/v59/github" "golang.org/x/crypto/nacl/box" ) diff --git a/example/codespaces/newusersecretwithxcrypto/main.go b/example/codespaces/newusersecretwithxcrypto/main.go index e6746fa146f..ed5e42daae5 100644 --- a/example/codespaces/newusersecretwithxcrypto/main.go +++ b/example/codespaces/newusersecretwithxcrypto/main.go @@ -37,7 +37,7 @@ import ( "log" "os" - "github.com/google/go-github/v58/github" + "github.com/google/go-github/v59/github" "golang.org/x/crypto/nacl/box" ) diff --git a/example/commitpr/main.go b/example/commitpr/main.go index 8e21f503d80..f3023619c3c 100644 --- a/example/commitpr/main.go +++ b/example/commitpr/main.go @@ -33,7 +33,7 @@ import ( "time" "github.com/ProtonMail/go-crypto/openpgp" - "github.com/google/go-github/v58/github" + "github.com/google/go-github/v59/github" ) var ( diff --git a/example/go.mod b/example/go.mod index ea991adb3da..79d1c11ebee 100644 --- a/example/go.mod +++ b/example/go.mod @@ -1,4 +1,4 @@ -module github.com/google/go-github/v58/example +module github.com/google/go-github/v59/example go 1.17 @@ -6,7 +6,7 @@ require ( github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 github.com/bradleyfalzon/ghinstallation/v2 v2.0.4 github.com/gofri/go-github-ratelimit v1.0.3 - github.com/google/go-github/v58 v58.0.0 + github.com/google/go-github/v59 v59.0.0 golang.org/x/crypto v0.17.0 golang.org/x/term v0.15.0 google.golang.org/appengine v1.6.7 @@ -24,4 +24,4 @@ require ( ) // Use version at HEAD, not the latest published. -replace github.com/google/go-github/v58 => ../ +replace github.com/google/go-github/v59 => ../ diff --git a/example/listenvironments/main.go b/example/listenvironments/main.go index ce02614cf54..b6af06c2ca2 100644 --- a/example/listenvironments/main.go +++ b/example/listenvironments/main.go @@ -18,7 +18,7 @@ import ( "log" "os" - "github.com/google/go-github/v58/github" + "github.com/google/go-github/v59/github" ) func main() { diff --git a/example/migrations/main.go b/example/migrations/main.go index 39b67d1e2f3..37b578d4d01 100644 --- a/example/migrations/main.go +++ b/example/migrations/main.go @@ -12,7 +12,7 @@ import ( "context" "fmt" - "github.com/google/go-github/v58/github" + "github.com/google/go-github/v59/github" ) func fetchAllUserMigrations() ([]*github.UserMigration, error) { diff --git a/example/newfilewithappauth/main.go b/example/newfilewithappauth/main.go index 0e7c0899564..787a60111ac 100644 --- a/example/newfilewithappauth/main.go +++ b/example/newfilewithappauth/main.go @@ -16,7 +16,7 @@ import ( "time" "github.com/bradleyfalzon/ghinstallation/v2" - "github.com/google/go-github/v58/github" + "github.com/google/go-github/v59/github" ) func main() { diff --git a/example/newrepo/main.go b/example/newrepo/main.go index 405e54d7aeb..17681c28704 100644 --- a/example/newrepo/main.go +++ b/example/newrepo/main.go @@ -16,7 +16,7 @@ import ( "log" "os" - "github.com/google/go-github/v58/github" + "github.com/google/go-github/v59/github" ) var ( diff --git a/example/newreposecretwithlibsodium/go.mod b/example/newreposecretwithlibsodium/go.mod index 8b0c2e2ad7c..4bd526d3145 100644 --- a/example/newreposecretwithlibsodium/go.mod +++ b/example/newreposecretwithlibsodium/go.mod @@ -4,8 +4,8 @@ go 1.15 require ( github.com/GoKillers/libsodium-go v0.0.0-20171022220152-dd733721c3cb - github.com/google/go-github/v58 v58.0.0 + github.com/google/go-github/v59 v59.0.0 ) // Use version at HEAD, not the latest published. -replace github.com/google/go-github/v58 => ../.. +replace github.com/google/go-github/v59 => ../.. diff --git a/example/newreposecretwithlibsodium/main.go b/example/newreposecretwithlibsodium/main.go index a134ffee183..93d6f5be03a 100644 --- a/example/newreposecretwithlibsodium/main.go +++ b/example/newreposecretwithlibsodium/main.go @@ -36,7 +36,7 @@ import ( "os" sodium "github.com/GoKillers/libsodium-go/cryptobox" - "github.com/google/go-github/v58/github" + "github.com/google/go-github/v59/github" ) var ( diff --git a/example/newreposecretwithxcrypto/main.go b/example/newreposecretwithxcrypto/main.go index c77455c3174..8fb1b533b3e 100644 --- a/example/newreposecretwithxcrypto/main.go +++ b/example/newreposecretwithxcrypto/main.go @@ -36,7 +36,7 @@ import ( "log" "os" - "github.com/google/go-github/v58/github" + "github.com/google/go-github/v59/github" "golang.org/x/crypto/nacl/box" ) diff --git a/example/ratelimit/main.go b/example/ratelimit/main.go index 0898c7a8338..4728cb504ad 100644 --- a/example/ratelimit/main.go +++ b/example/ratelimit/main.go @@ -13,7 +13,7 @@ import ( "fmt" "github.com/gofri/go-github-ratelimit/github_ratelimit" - "github.com/google/go-github/v58/github" + "github.com/google/go-github/v59/github" ) func main() { diff --git a/example/simple/main.go b/example/simple/main.go index f85a6bfcacf..7df3f927fec 100644 --- a/example/simple/main.go +++ b/example/simple/main.go @@ -12,7 +12,7 @@ import ( "context" "fmt" - "github.com/google/go-github/v58/github" + "github.com/google/go-github/v59/github" ) // Fetch all the public organizations' membership of a user. diff --git a/example/tagprotection/main.go b/example/tagprotection/main.go index d2bdea046d2..825ef7b895b 100644 --- a/example/tagprotection/main.go +++ b/example/tagprotection/main.go @@ -18,7 +18,7 @@ import ( "os" "strings" - "github.com/google/go-github/v58/github" + "github.com/google/go-github/v59/github" "golang.org/x/term" ) diff --git a/example/tokenauth/main.go b/example/tokenauth/main.go index 4666dedd19d..e4ed2e7dcab 100644 --- a/example/tokenauth/main.go +++ b/example/tokenauth/main.go @@ -15,7 +15,7 @@ import ( "log" "os" - "github.com/google/go-github/v58/github" + "github.com/google/go-github/v59/github" "golang.org/x/term" ) diff --git a/example/topics/main.go b/example/topics/main.go index d2a5c3f5c1f..c29e0d45bd2 100644 --- a/example/topics/main.go +++ b/example/topics/main.go @@ -12,7 +12,7 @@ import ( "context" "fmt" - "github.com/google/go-github/v58/github" + "github.com/google/go-github/v59/github" ) // Fetch and lists all the public topics associated with the specified GitHub topic diff --git a/github/doc.go b/github/doc.go index 5fcf8b03691..7bb0d18dff4 100644 --- a/github/doc.go +++ b/github/doc.go @@ -8,7 +8,7 @@ Package github provides a client for using the GitHub API. Usage: - import "github.com/google/go-github/v58/github" // with go modules enabled (GO111MODULE=on or outside GOPATH) + import "github.com/google/go-github/v59/github" // with go modules enabled (GO111MODULE=on or outside GOPATH) import "github.com/google/go-github/github" // with go modules disabled Construct a new GitHub client, then use the various services on the client to diff --git a/github/examples_test.go b/github/examples_test.go index d58c6e41cff..db26615f45d 100644 --- a/github/examples_test.go +++ b/github/examples_test.go @@ -12,7 +12,7 @@ import ( "fmt" "log" - "github.com/google/go-github/v58/github" + "github.com/google/go-github/v59/github" ) func ExampleMarkdownService_Render() { diff --git a/github/github.go b/github/github.go index a7326a7bd5d..805a3fed3da 100644 --- a/github/github.go +++ b/github/github.go @@ -28,7 +28,7 @@ import ( ) const ( - Version = "v58.0.0" + Version = "v59.0.0" defaultAPIVersion = "2022-11-28" defaultBaseURL = "https://api.github.com/" diff --git a/go.mod b/go.mod index d4fd03ba937..95675d8396b 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/google/go-github/v58 +module github.com/google/go-github/v59 require ( github.com/google/go-cmp v0.6.0 diff --git a/test/fields/fields.go b/test/fields/fields.go index 6c823364ffe..6be99aa23d1 100644 --- a/test/fields/fields.go +++ b/test/fields/fields.go @@ -25,7 +25,7 @@ import ( "reflect" "strings" - "github.com/google/go-github/v58/github" + "github.com/google/go-github/v59/github" ) var ( diff --git a/test/integration/activity_test.go b/test/integration/activity_test.go index 79131193cb9..f15a9e6188a 100644 --- a/test/integration/activity_test.go +++ b/test/integration/activity_test.go @@ -12,7 +12,7 @@ import ( "context" "testing" - "github.com/google/go-github/v58/github" + "github.com/google/go-github/v59/github" ) const ( diff --git a/test/integration/authorizations_test.go b/test/integration/authorizations_test.go index aa5c4d94580..1942454eb54 100644 --- a/test/integration/authorizations_test.go +++ b/test/integration/authorizations_test.go @@ -15,7 +15,7 @@ import ( "testing" "time" - "github.com/google/go-github/v58/github" + "github.com/google/go-github/v59/github" ) const msgEnvMissing = "Skipping test because the required environment variable (%v) is not present." diff --git a/test/integration/github_test.go b/test/integration/github_test.go index 692e9e91466..4fc8c003070 100644 --- a/test/integration/github_test.go +++ b/test/integration/github_test.go @@ -15,7 +15,7 @@ import ( "net/http" "os" - "github.com/google/go-github/v58/github" + "github.com/google/go-github/v59/github" ) var ( diff --git a/test/integration/repos_test.go b/test/integration/repos_test.go index 32d02cab81d..79e8cdfe9fb 100644 --- a/test/integration/repos_test.go +++ b/test/integration/repos_test.go @@ -15,7 +15,7 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/google/go-github/v58/github" + "github.com/google/go-github/v59/github" ) func TestRepositories_CRUD(t *testing.T) { diff --git a/test/integration/users_test.go b/test/integration/users_test.go index fc479b25859..21e14c16a7d 100644 --- a/test/integration/users_test.go +++ b/test/integration/users_test.go @@ -14,7 +14,7 @@ import ( "math/rand" "testing" - "github.com/google/go-github/v58/github" + "github.com/google/go-github/v59/github" ) func TestUsers_Get(t *testing.T) { diff --git a/tools/go.mod b/tools/go.mod index 2fbca2de6a9..cdc69d921c7 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -6,7 +6,7 @@ require ( github.com/alecthomas/kong v0.8.1 github.com/getkin/kin-openapi v0.123.0 github.com/google/go-cmp v0.6.0 - github.com/google/go-github/v58 v58.0.0 + github.com/google/go-github/v59 v59.0.0 golang.org/x/sync v0.6.0 gopkg.in/yaml.v3 v3.0.1 ) @@ -23,4 +23,4 @@ require ( ) // Use version at HEAD, not the latest published. -replace github.com/google/go-github/v58 => ../ +replace github.com/google/go-github/v59 => ../ diff --git a/tools/metadata/main.go b/tools/metadata/main.go index 1b8d754b90c..a8c597ae00d 100644 --- a/tools/metadata/main.go +++ b/tools/metadata/main.go @@ -15,7 +15,7 @@ import ( "path/filepath" "github.com/alecthomas/kong" - "github.com/google/go-github/v58/github" + "github.com/google/go-github/v59/github" ) var helpVars = kong.Vars{ diff --git a/tools/metadata/main_test.go b/tools/metadata/main_test.go index 001f2eeead3..0d850fb5b30 100644 --- a/tools/metadata/main_test.go +++ b/tools/metadata/main_test.go @@ -23,7 +23,7 @@ import ( "github.com/alecthomas/kong" "github.com/getkin/kin-openapi/openapi3" "github.com/google/go-cmp/cmp" - "github.com/google/go-github/v58/github" + "github.com/google/go-github/v59/github" ) func TestUpdateGo(t *testing.T) { diff --git a/tools/metadata/metadata.go b/tools/metadata/metadata.go index 834ccae8fce..0818a14202e 100644 --- a/tools/metadata/metadata.go +++ b/tools/metadata/metadata.go @@ -24,7 +24,7 @@ import ( "strings" "sync" - "github.com/google/go-github/v58/github" + "github.com/google/go-github/v59/github" "gopkg.in/yaml.v3" ) diff --git a/tools/metadata/openapi.go b/tools/metadata/openapi.go index 55697e389a4..e138e142bd4 100644 --- a/tools/metadata/openapi.go +++ b/tools/metadata/openapi.go @@ -14,7 +14,7 @@ import ( "strconv" "github.com/getkin/kin-openapi/openapi3" - "github.com/google/go-github/v58/github" + "github.com/google/go-github/v59/github" "golang.org/x/sync/errgroup" ) From 5145e7fe7eb5cf02fc5e646bb8bf1cb08cdd9788 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Fri, 9 Feb 2024 09:42:42 -0500 Subject: [PATCH 105/145] Bump go-github from v58 to v59 in /scrape (#3069) --- scrape/apps.go | 2 +- scrape/apps_test.go | 2 +- scrape/go.mod | 2 +- scrape/go.sum | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scrape/apps.go b/scrape/apps.go index f2dd84da609..5310f88ce62 100644 --- a/scrape/apps.go +++ b/scrape/apps.go @@ -17,7 +17,7 @@ import ( "strings" "github.com/PuerkitoBio/goquery" - "github.com/google/go-github/v58/github" + "github.com/google/go-github/v59/github" ) // AppRestrictionsEnabled returns whether the specified organization has diff --git a/scrape/apps_test.go b/scrape/apps_test.go index dd0b006e56d..8cfbbdb0006 100644 --- a/scrape/apps_test.go +++ b/scrape/apps_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/google/go-github/v58/github" + "github.com/google/go-github/v59/github" ) func Test_AppRestrictionsEnabled(t *testing.T) { diff --git a/scrape/go.mod b/scrape/go.mod index 48a03a23bc4..c70573c1f32 100644 --- a/scrape/go.mod +++ b/scrape/go.mod @@ -5,7 +5,7 @@ go 1.13 require ( github.com/PuerkitoBio/goquery v1.8.1 github.com/google/go-cmp v0.6.0 - github.com/google/go-github/v58 v58.0.0 + github.com/google/go-github/v59 v59.0.0 github.com/xlzd/gotp v0.1.0 golang.org/x/net v0.20.0 ) diff --git a/scrape/go.sum b/scrape/go.sum index 245655f139a..7dee995d95e 100644 --- a/scrape/go.sum +++ b/scrape/go.sum @@ -5,8 +5,8 @@ github.com/andybalholm/cascadia v1.3.1/go.mod h1:R4bJ1UQfqADjvDa4P6HZHLh/3OxWWEq github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-github/v58 v58.0.0 h1:Una7GGERlF/37XfkPwpzYJe0Vp4dt2k1kCjlxwjIvzw= -github.com/google/go-github/v58 v58.0.0/go.mod h1:k4hxDKEfoWpSqFlc8LTpGd9fu2KrV1YAa6Hi6FmDNY4= +github.com/google/go-github/v59 v59.0.0 h1:7h6bgpF5as0YQLLkEiVqpgtJqjimMYhBkD4jT5aN3VA= +github.com/google/go-github/v59 v59.0.0/go.mod h1:rJU4R0rQHFVFDOkqGWxfLNo6vEk4dv40oDjhV/gH6wM= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/xlzd/gotp v0.1.0 h1:37blvlKCh38s+fkem+fFh7sMnceltoIEBYTVXyoa5Po= From dd4d2a19c120ebb71a8f91097d1be1e991047b55 Mon Sep 17 00:00:00 2001 From: Emma Sax Date: Sun, 11 Feb 2024 14:53:04 -0600 Subject: [PATCH 106/145] Turn `RequiredStatusChecks` `Checks` and `Contexts` into pointers (#3070) Fixes: #2976 and #2467. --- github/github-accessors.go | 16 ++ github/github-accessors_test.go | 20 ++ github/repos.go | 16 +- github/repos_test.go | 355 ++++++++++++++++++++++++++++++-- test/integration/repos_test.go | 4 +- 5 files changed, 384 insertions(+), 27 deletions(-) diff --git a/github/github-accessors.go b/github/github-accessors.go index e28fd275682..b645390e83a 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -20246,6 +20246,22 @@ func (r *RequiredStatusCheck) GetAppID() int64 { return *r.AppID } +// GetChecks returns the Checks field if it's non-nil, zero value otherwise. +func (r *RequiredStatusChecks) GetChecks() []*RequiredStatusCheck { + if r == nil || r.Checks == nil { + return nil + } + return *r.Checks +} + +// GetContexts returns the Contexts field if it's non-nil, zero value otherwise. +func (r *RequiredStatusChecks) GetContexts() []string { + if r == nil || r.Contexts == nil { + return nil + } + return *r.Contexts +} + // GetContextsURL returns the ContextsURL field if it's non-nil, zero value otherwise. func (r *RequiredStatusChecks) GetContextsURL() string { if r == nil || r.ContextsURL == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 4c349a05ae8..8d5b438054d 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -23517,6 +23517,26 @@ func TestRequiredStatusCheck_GetAppID(tt *testing.T) { r.GetAppID() } +func TestRequiredStatusChecks_GetChecks(tt *testing.T) { + var zeroValue []*RequiredStatusCheck + r := &RequiredStatusChecks{Checks: &zeroValue} + r.GetChecks() + r = &RequiredStatusChecks{} + r.GetChecks() + r = nil + r.GetChecks() +} + +func TestRequiredStatusChecks_GetContexts(tt *testing.T) { + var zeroValue []string + r := &RequiredStatusChecks{Contexts: &zeroValue} + r.GetContexts() + r = &RequiredStatusChecks{} + r.GetContexts() + r = nil + r.GetContexts() +} + func TestRequiredStatusChecks_GetContextsURL(tt *testing.T) { var zeroValue string r := &RequiredStatusChecks{ContextsURL: &zeroValue} diff --git a/github/repos.go b/github/repos.go index b492e55b464..2fb4c6f190a 100644 --- a/github/repos.go +++ b/github/repos.go @@ -1191,20 +1191,20 @@ type RequiredStatusChecks struct { // Require branches to be up to date before merging. (Required.) Strict bool `json:"strict"` // The list of status checks to require in order to merge into this - // branch. (Deprecated. Note: only one of Contexts/Checks can be populated, - // but at least one must be populated). - Contexts []string `json:"contexts,omitempty"` + // branch. An empty slice is valid. (Deprecated. Note: only one of + // Contexts/Checks can be populated, but at least one must be populated). + Contexts *[]string `json:"contexts,omitempty"` // The list of status checks to require in order to merge into this - // branch. - Checks []*RequiredStatusCheck `json:"checks,omitempty"` - ContextsURL *string `json:"contexts_url,omitempty"` - URL *string `json:"url,omitempty"` + // branch. An empty slice is valid. + Checks *[]*RequiredStatusCheck `json:"checks,omitempty"` + ContextsURL *string `json:"contexts_url,omitempty"` + URL *string `json:"url,omitempty"` } // RequiredStatusChecksRequest represents a request to edit a protected branch's status checks. type RequiredStatusChecksRequest struct { Strict *bool `json:"strict,omitempty"` - // Note: if both Contexts and Checks are populated, + // Deprecated. Note: if both Contexts and Checks are populated, // the GitHub API will only use Checks. Contexts []string `json:"contexts,omitempty"` Checks []*RequiredStatusCheck `json:"checks,omitempty"` diff --git a/github/repos_test.go b/github/repos_test.go index 2e61aeb1b1f..0ea381ebb56 100644 --- a/github/repos_test.go +++ b/github/repos_test.go @@ -1207,8 +1207,8 @@ func TestRepositoriesService_GetBranchProtection(t *testing.T) { want := &Protection{ RequiredStatusChecks: &RequiredStatusChecks{ Strict: true, - Contexts: []string{"continuous-integration"}, - Checks: []*RequiredStatusCheck{ + Contexts: &[]string{"continuous-integration"}, + Checks: &[]*RequiredStatusCheck{ { Context: "continuous-integration", }, @@ -1334,8 +1334,8 @@ func TestRepositoriesService_GetBranchProtection_noDismissalRestrictions(t *test want := &Protection{ RequiredStatusChecks: &RequiredStatusChecks{ Strict: true, - Contexts: []string{"continuous-integration"}, - Checks: []*RequiredStatusCheck{ + Contexts: &[]string{"continuous-integration"}, + Checks: &[]*RequiredStatusCheck{ { Context: "continuous-integration", }, @@ -1421,7 +1421,7 @@ func TestRepositoriesService_UpdateBranchProtection_Contexts(t *testing.T) { input := &ProtectionRequest{ RequiredStatusChecks: &RequiredStatusChecks{ Strict: true, - Contexts: []string{"continuous-integration"}, + Contexts: &[]string{"continuous-integration"}, }, RequiredPullRequestReviews: &PullRequestReviewsEnforcementRequest{ DismissStaleReviews: true, @@ -1517,8 +1517,8 @@ func TestRepositoriesService_UpdateBranchProtection_Contexts(t *testing.T) { want := &Protection{ RequiredStatusChecks: &RequiredStatusChecks{ Strict: true, - Contexts: []string{"continuous-integration"}, - Checks: []*RequiredStatusCheck{ + Contexts: &[]string{"continuous-integration"}, + Checks: &[]*RequiredStatusCheck{ { Context: "continuous-integration", }, @@ -1592,6 +1592,184 @@ func TestRepositoriesService_UpdateBranchProtection_Contexts(t *testing.T) { } } +func TestRepositoriesService_UpdateBranchProtection_EmptyContexts(t *testing.T) { + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b/protection"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%/protection"}, + } + + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + input := &ProtectionRequest{ + RequiredStatusChecks: &RequiredStatusChecks{ + Strict: true, + Contexts: &[]string{}, + }, + RequiredPullRequestReviews: &PullRequestReviewsEnforcementRequest{ + DismissStaleReviews: true, + DismissalRestrictionsRequest: &DismissalRestrictionsRequest{ + Users: &[]string{"uu"}, + Teams: &[]string{"tt"}, + Apps: &[]string{"aa"}, + }, + BypassPullRequestAllowancesRequest: &BypassPullRequestAllowancesRequest{ + Users: []string{"uuu"}, + Teams: []string{"ttt"}, + Apps: []string{"aaa"}, + }, + }, + Restrictions: &BranchRestrictionsRequest{ + Users: []string{"u"}, + Teams: []string{"t"}, + Apps: []string{"a"}, + }, + BlockCreations: Bool(true), + LockBranch: Bool(true), + AllowForkSyncing: Bool(true), + } + + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + v := new(ProtectionRequest) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) + + testMethod(t, r, "PUT") + if !cmp.Equal(v, input) { + t.Errorf("Request body = %+v, want %+v", v, input) + } + + // TODO: remove custom Accept header when this API fully launches + testHeader(t, r, "Accept", mediaTypeRequiredApprovingReviewsPreview) + fmt.Fprintf(w, `{ + "required_status_checks":{ + "strict":true, + "contexts":[], + "checks": null + }, + "required_pull_request_reviews":{ + "dismissal_restrictions":{ + "users":[{ + "id":3, + "login":"uu" + }], + "teams":[{ + "id":4, + "slug":"tt" + }], + "apps":[{ + "id":5, + "slug":"aa" + }] + }, + "dismiss_stale_reviews":true, + "require_code_owner_reviews":true, + "bypass_pull_request_allowances": { + "users":[{"id":10,"login":"uuu"}], + "teams":[{"id":20,"slug":"ttt"}], + "apps":[{"id":30,"slug":"aaa"}] + } + }, + "restrictions":{ + "users":[{"id":1,"login":"u"}], + "teams":[{"id":2,"slug":"t"}], + "apps":[{"id":3,"slug":"a"}] + }, + "block_creations": { + "enabled": true + }, + "lock_branch": { + "enabled": true + }, + "allow_fork_syncing": { + "enabled": true + } + }`) + }) + + ctx := context.Background() + protection, _, err := client.Repositories.UpdateBranchProtection(ctx, "o", "r", test.branch, input) + if err != nil { + t.Errorf("Repositories.UpdateBranchProtection returned error: %v", err) + } + + want := &Protection{ + RequiredStatusChecks: &RequiredStatusChecks{ + Strict: true, + Contexts: &[]string{}, + }, + RequiredPullRequestReviews: &PullRequestReviewsEnforcement{ + DismissStaleReviews: true, + DismissalRestrictions: &DismissalRestrictions{ + Users: []*User{ + {Login: String("uu"), ID: Int64(3)}, + }, + Teams: []*Team{ + {Slug: String("tt"), ID: Int64(4)}, + }, + Apps: []*App{ + {Slug: String("aa"), ID: Int64(5)}, + }, + }, + RequireCodeOwnerReviews: true, + BypassPullRequestAllowances: &BypassPullRequestAllowances{ + Users: []*User{ + {Login: String("uuu"), ID: Int64(10)}, + }, + Teams: []*Team{ + {Slug: String("ttt"), ID: Int64(20)}, + }, + Apps: []*App{ + {Slug: String("aaa"), ID: Int64(30)}, + }, + }, + }, + Restrictions: &BranchRestrictions{ + Users: []*User{ + {Login: String("u"), ID: Int64(1)}, + }, + Teams: []*Team{ + {Slug: String("t"), ID: Int64(2)}, + }, + Apps: []*App{ + {Slug: String("a"), ID: Int64(3)}, + }, + }, + BlockCreations: &BlockCreations{ + Enabled: Bool(true), + }, + LockBranch: &LockBranch{ + Enabled: Bool(true), + }, + AllowForkSyncing: &AllowForkSyncing{ + Enabled: Bool(true), + }, + } + if !cmp.Equal(protection, want) { + t.Errorf("Repositories.UpdateBranchProtection returned %+v, want %+v", protection, want) + } + + const methodName = "UpdateBranchProtection" + testBadOptions(t, methodName, func() (err error) { + _, _, err = client.Repositories.UpdateBranchProtection(ctx, "\n", "\n", "\n", input) + return err + }) + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + got, resp, err := client.Repositories.UpdateBranchProtection(ctx, "o", "r", test.branch, input) + if got != nil { + t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) + } + return resp, err + }) + }) + } +} + func TestRepositoriesService_UpdateBranchProtection_Checks(t *testing.T) { tests := []struct { branch string @@ -1609,7 +1787,7 @@ func TestRepositoriesService_UpdateBranchProtection_Checks(t *testing.T) { input := &ProtectionRequest{ RequiredStatusChecks: &RequiredStatusChecks{ Strict: true, - Checks: []*RequiredStatusCheck{ + Checks: &[]*RequiredStatusCheck{ { Context: "continuous-integration", }, @@ -1697,8 +1875,8 @@ func TestRepositoriesService_UpdateBranchProtection_Checks(t *testing.T) { want := &Protection{ RequiredStatusChecks: &RequiredStatusChecks{ Strict: true, - Contexts: []string{"continuous-integration"}, - Checks: []*RequiredStatusCheck{ + Contexts: &[]string{"continuous-integration"}, + Checks: &[]*RequiredStatusCheck{ { Context: "continuous-integration", }, @@ -1749,6 +1927,149 @@ func TestRepositoriesService_UpdateBranchProtection_Checks(t *testing.T) { } } +func TestRepositoriesService_UpdateBranchProtection_EmptyChecks(t *testing.T) { + tests := []struct { + branch string + urlPath string + }{ + {branch: "b", urlPath: "/repos/o/r/branches/b/protection"}, + {branch: "feat/branch-50%", urlPath: "/repos/o/r/branches/feat/branch-50%/protection"}, + } + + for _, test := range tests { + t.Run(test.branch, func(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + input := &ProtectionRequest{ + RequiredStatusChecks: &RequiredStatusChecks{ + Strict: true, + Checks: &[]*RequiredStatusCheck{}, + }, + RequiredPullRequestReviews: &PullRequestReviewsEnforcementRequest{ + DismissStaleReviews: true, + DismissalRestrictionsRequest: &DismissalRestrictionsRequest{ + Users: &[]string{"uu"}, + Teams: &[]string{"tt"}, + Apps: &[]string{"aa"}, + }, + BypassPullRequestAllowancesRequest: &BypassPullRequestAllowancesRequest{ + Users: []string{"uuu"}, + Teams: []string{"ttt"}, + Apps: []string{"aaa"}, + }, + }, + Restrictions: &BranchRestrictionsRequest{ + Users: []string{"u"}, + Teams: []string{"t"}, + Apps: []string{"a"}, + }, + } + + mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { + v := new(ProtectionRequest) + assertNilError(t, json.NewDecoder(r.Body).Decode(v)) + + testMethod(t, r, "PUT") + if !cmp.Equal(v, input) { + t.Errorf("Request body = %+v, want %+v", v, input) + } + + // TODO: remove custom Accept header when this API fully launches + testHeader(t, r, "Accept", mediaTypeRequiredApprovingReviewsPreview) + fmt.Fprintf(w, `{ + "required_status_checks":{ + "strict":true, + "contexts":null, + "checks": [] + }, + "required_pull_request_reviews":{ + "dismissal_restrictions":{ + "users":[{ + "id":3, + "login":"uu" + }], + "teams":[{ + "id":4, + "slug":"tt" + }], + "apps":[{ + "id":5, + "slug":"aa" + }] + }, + "dismiss_stale_reviews":true, + "require_code_owner_reviews":true, + "bypass_pull_request_allowances": { + "users":[{"id":10,"login":"uuu"}], + "teams":[{"id":20,"slug":"ttt"}], + "apps":[{"id":30,"slug":"aaa"}] + } + }, + "restrictions":{ + "users":[{"id":1,"login":"u"}], + "teams":[{"id":2,"slug":"t"}], + "apps":[{"id":3,"slug":"a"}] + } + }`) + }) + + ctx := context.Background() + protection, _, err := client.Repositories.UpdateBranchProtection(ctx, "o", "r", test.branch, input) + if err != nil { + t.Errorf("Repositories.UpdateBranchProtection returned error: %v", err) + } + + want := &Protection{ + RequiredStatusChecks: &RequiredStatusChecks{ + Strict: true, + Checks: &[]*RequiredStatusCheck{}, + }, + RequiredPullRequestReviews: &PullRequestReviewsEnforcement{ + DismissStaleReviews: true, + DismissalRestrictions: &DismissalRestrictions{ + Users: []*User{ + {Login: String("uu"), ID: Int64(3)}, + }, + Teams: []*Team{ + {Slug: String("tt"), ID: Int64(4)}, + }, + Apps: []*App{ + {Slug: String("aa"), ID: Int64(5)}, + }, + }, + RequireCodeOwnerReviews: true, + BypassPullRequestAllowances: &BypassPullRequestAllowances{ + Users: []*User{ + {Login: String("uuu"), ID: Int64(10)}, + }, + Teams: []*Team{ + {Slug: String("ttt"), ID: Int64(20)}, + }, + Apps: []*App{ + {Slug: String("aaa"), ID: Int64(30)}, + }, + }, + }, + Restrictions: &BranchRestrictions{ + Users: []*User{ + {Login: String("u"), ID: Int64(1)}, + }, + Teams: []*Team{ + {Slug: String("t"), ID: Int64(2)}, + }, + Apps: []*App{ + {Slug: String("a"), ID: Int64(3)}, + }, + }, + } + if !cmp.Equal(protection, want) { + t.Errorf("Repositories.UpdateBranchProtection returned %+v, want %+v", protection, want) + } + }) + } +} + func TestRepositoriesService_UpdateBranchProtection_StrictNoChecks(t *testing.T) { tests := []struct { branch string @@ -1844,7 +2165,7 @@ func TestRepositoriesService_UpdateBranchProtection_StrictNoChecks(t *testing.T) want := &Protection{ RequiredStatusChecks: &RequiredStatusChecks{ Strict: true, - Contexts: []string{}, + Contexts: &[]string{}, }, RequiredPullRequestReviews: &PullRequestReviewsEnforcement{ DismissStaleReviews: true, @@ -2082,8 +2403,8 @@ func TestRepositoriesService_GetRequiredStatusChecks(t *testing.T) { want := &RequiredStatusChecks{ Strict: true, - Contexts: []string{"x", "y", "z"}, - Checks: []*RequiredStatusCheck{ + Contexts: &[]string{"x", "y", "z"}, + Checks: &[]*RequiredStatusCheck{ { Context: "x", }, @@ -2202,8 +2523,8 @@ func TestRepositoriesService_UpdateRequiredStatusChecks_Contexts(t *testing.T) { want := &RequiredStatusChecks{ Strict: true, - Contexts: []string{"continuous-integration"}, - Checks: []*RequiredStatusCheck{ + Contexts: &[]string{"continuous-integration"}, + Checks: &[]*RequiredStatusCheck{ { Context: "continuous-integration", }, @@ -2300,8 +2621,8 @@ func TestRepositoriesService_UpdateRequiredStatusChecks_Checks(t *testing.T) { want := &RequiredStatusChecks{ Strict: true, - Contexts: []string{"continuous-integration"}, - Checks: []*RequiredStatusCheck{ + Contexts: &[]string{"continuous-integration"}, + Checks: &[]*RequiredStatusCheck{ { Context: "continuous-integration", }, diff --git a/test/integration/repos_test.go b/test/integration/repos_test.go index 79e8cdfe9fb..9b32cc4a311 100644 --- a/test/integration/repos_test.go +++ b/test/integration/repos_test.go @@ -103,7 +103,7 @@ func TestRepositories_EditBranches(t *testing.T) { protectionRequest := &github.ProtectionRequest{ RequiredStatusChecks: &github.RequiredStatusChecks{ Strict: true, - Contexts: []string{"continuous-integration"}, + Contexts: &[]string{"continuous-integration"}, }, RequiredPullRequestReviews: &github.PullRequestReviewsEnforcementRequest{ DismissStaleReviews: true, @@ -126,7 +126,7 @@ func TestRepositories_EditBranches(t *testing.T) { want := &github.Protection{ RequiredStatusChecks: &github.RequiredStatusChecks{ Strict: true, - Contexts: []string{"continuous-integration"}, + Contexts: &[]string{"continuous-integration"}, }, RequiredPullRequestReviews: &github.PullRequestReviewsEnforcement{ DismissStaleReviews: true, From 6ca4d142bef57e88f87290837796a54a0296fcc4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Feb 2024 15:09:39 -0500 Subject: [PATCH 107/145] Bump golang.org/x/net from 0.20.0 to 0.21.0 in /scrape (#3071) --- scrape/go.mod | 2 +- scrape/go.sum | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scrape/go.mod b/scrape/go.mod index c70573c1f32..260a0414972 100644 --- a/scrape/go.mod +++ b/scrape/go.mod @@ -7,5 +7,5 @@ require ( github.com/google/go-cmp v0.6.0 github.com/google/go-github/v59 v59.0.0 github.com/xlzd/gotp v0.1.0 - golang.org/x/net v0.20.0 + golang.org/x/net v0.21.0 ) diff --git a/scrape/go.sum b/scrape/go.sum index 7dee995d95e..8eee238637c 100644 --- a/scrape/go.sum +++ b/scrape/go.sum @@ -14,7 +14,7 @@ github.com/xlzd/gotp v0.1.0/go.mod h1:ndLJ3JKzi3xLmUProq4LLxCuECL93dG9WASNLpHz8q github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= +golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -24,8 +24,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= -golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= +golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -37,12 +37,12 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= -golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY= +golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= From a516e21897a3c49c8bc3d6ba1e4b146e1a7aefec Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Tue, 13 Feb 2024 22:01:20 -0500 Subject: [PATCH 108/145] Update workflow and tools to use Go 1.22 and 1.21 (#3074) --- .github/workflows/tests.yml | 2 +- example/go.mod | 2 +- example/go.sum | 1 + example/newreposecretwithlibsodium/go.mod | 6 +++++- go.mod | 2 +- script/generate.sh | 2 +- tools/go.mod | 4 +++- tools/go.sum | 12 ++++++++++++ 8 files changed, 25 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 267066633b5..d789c811c14 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -24,7 +24,7 @@ jobs: shell: bash strategy: matrix: - go-version: [1.x, 1.20.x] + go-version: [1.x, 1.21.x] platform: [ubuntu-latest] include: # include windows, but only with the latest Go version, since there diff --git a/example/go.mod b/example/go.mod index 79d1c11ebee..f3e6883fa1c 100644 --- a/example/go.mod +++ b/example/go.mod @@ -1,6 +1,6 @@ module github.com/google/go-github/v59/example -go 1.17 +go 1.21 require ( github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 diff --git a/example/go.sum b/example/go.sum index 1bdf8355928..81f5d70a5b0 100644 --- a/example/go.sum +++ b/example/go.sum @@ -19,6 +19,7 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-github/v41 v41.0.0 h1:HseJrM2JFf2vfiZJ8anY2hqBjdfY1Vlj/K27ueww4gg= github.com/google/go-github/v41 v41.0.0/go.mod h1:XgmCA5H323A9rtgExdTcnDkcqp6S30AVACCBDOonIxg= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= diff --git a/example/newreposecretwithlibsodium/go.mod b/example/newreposecretwithlibsodium/go.mod index 4bd526d3145..07619c05181 100644 --- a/example/newreposecretwithlibsodium/go.mod +++ b/example/newreposecretwithlibsodium/go.mod @@ -1,11 +1,15 @@ module newreposecretwithlibsodium -go 1.15 +go 1.21 + +toolchain go1.22.0 require ( github.com/GoKillers/libsodium-go v0.0.0-20171022220152-dd733721c3cb github.com/google/go-github/v59 v59.0.0 ) +require github.com/google/go-querystring v1.1.0 // indirect + // Use version at HEAD, not the latest published. replace github.com/google/go-github/v59 => ../.. diff --git a/go.mod b/go.mod index 95675d8396b..32244bfb7d5 100644 --- a/go.mod +++ b/go.mod @@ -5,4 +5,4 @@ require ( github.com/google/go-querystring v1.1.0 ) -go 1.17 +go 1.21 diff --git a/script/generate.sh b/script/generate.sh index 17707b2385c..6dab2ad6795 100755 --- a/script/generate.sh +++ b/script/generate.sh @@ -43,6 +43,6 @@ for dir in $MOD_DIRS; do ( cd "$dir" go generate ./... - go mod tidy -compat '1.17' + go mod tidy -compat '1.21' ) done diff --git a/tools/go.mod b/tools/go.mod index cdc69d921c7..4d6ad23eefa 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -1,6 +1,8 @@ module tools -go 1.20 +go 1.21 + +toolchain go1.22.0 require ( github.com/alecthomas/kong v0.8.1 diff --git a/tools/go.sum b/tools/go.sum index d4a1fd8b7aa..87c9d843a96 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -1,8 +1,11 @@ github.com/alecthomas/assert/v2 v2.1.0 h1:tbredtNcQnoSd3QBhQWI7QZ3XHOVkw1Moklp2ojoH/0= +github.com/alecthomas/assert/v2 v2.1.0/go.mod h1:b/+1DI2Q6NckYi+3mXyH3wFb8qG37K/DuK80n7WefXA= github.com/alecthomas/kong v0.8.1 h1:acZdn3m4lLRobeh3Zi2S2EpnXTd1mOL6U7xVml+vfkY= github.com/alecthomas/kong v0.8.1/go.mod h1:n1iCIO2xS46oE8ZfYCNDqdR0b0wZNrXAIAqro/2132U= github.com/alecthomas/repr v0.1.0 h1:ENn2e1+J3k09gyj2shc0dHr/yjaWSHRlrJ4DPMevDqE= +github.com/alecthomas/repr v0.1.0/go.mod h1:2kn6fqh/zIyPLmm3ugklbEi5hg5wS435eygvNfaDQL8= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/getkin/kin-openapi v0.123.0 h1:zIik0mRwFNLyvtXK274Q6ut+dPh6nlxBp0x7mNrPhs8= github.com/getkin/kin-openapi v0.123.0/go.mod h1:wb1aSZA/iWmorQP9KTAS/phLj/t17B5jT7+fS8ed9NM= github.com/go-openapi/jsonpointer v0.20.2 h1:mQc3nmndL8ZBzStEo3JYF8wzmeWffDH4VbXz58sAx6Q= @@ -10,18 +13,22 @@ github.com/go-openapi/jsonpointer v0.20.2/go.mod h1:bHen+N0u1KEO3YlmqOjTT9Adn1Rf github.com/go-openapi/swag v0.22.8 h1:/9RjDSQ0vbFR+NyjGMkFTsA1IA0fmhKSThmfGZjicbw= github.com/go-openapi/swag v0.22.8/go.mod h1:6QT22icPLEqAM/z/TChgb4WAveCHF92+2gF0CNjHpPI= github.com/go-test/deep v1.0.8 h1:TDsG77qcSprGbC6vTN8OuXp5g+J+b5Pcguhf7Zt61VM= +github.com/go-test/deep v1.0.8/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= +github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= github.com/invopop/yaml v0.2.0 h1:7zky/qH+O0DwAyoobXUqvVBwgBFRxKoQ/3FjcVpjTMY= github.com/invopop/yaml v0.2.0/go.mod h1:2XuRLgs/ouIrW3XNzuNj7J3Nvu/Dig5MXvbCEdiBN3Q= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw= @@ -29,14 +36,19 @@ github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwd github.com/perimeterx/marshmallow v1.1.5 h1:a2LALqQ1BlHM8PZblsDdidgv1mWi1DgC2UmX50IvK2s= github.com/perimeterx/marshmallow v1.1.5/go.mod h1:dsXbUu8CRzfYP5a87xpp0xq9S3u0Vchtcl8we9tYaXw= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= +github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From 8bb3d096305926412c890028c5a40adbb97e01ab Mon Sep 17 00:00:00 2001 From: Shervil Gupta <35729671+ShervilG@users.noreply.github.com> Date: Wed, 14 Feb 2024 20:24:52 +0530 Subject: [PATCH 109/145] Add test case for JSON resource marshaling (#3075) --- github/secret_scanning_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/github/secret_scanning_test.go b/github/secret_scanning_test.go index 7898d29a38c..1c8ad82bfcb 100644 --- a/github/secret_scanning_test.go +++ b/github/secret_scanning_test.go @@ -595,3 +595,19 @@ func TestSecretScanningAlertLocationDetails_Marshal(t *testing.T) { testJSONMarshal(t, u, want) } + +func TestSecretScanningAlertUpdateOptions_Marshal(t *testing.T) { + testJSONMarshal(t, &SecretScanningAlertUpdateOptions{}, `{}`) + + u := &SecretScanningAlertUpdateOptions{ + State: "open", + Resolution: String("false_positive"), + } + + want := `{ + "state": "open", + "resolution": "false_positive" + }` + + testJSONMarshal(t, u, want) +} From a79e405d09613fc0cd2e647ba452a3350f69de94 Mon Sep 17 00:00:00 2001 From: Shervil Gupta <35729671+ShervilG@users.noreply.github.com> Date: Thu, 15 Feb 2024 20:29:20 +0530 Subject: [PATCH 110/145] Add test case for JSON resource marshaling (#3076) --- github/security_advisories_test.go | 169 +++++++++++++++++++++++++++++ 1 file changed, 169 insertions(+) diff --git a/github/security_advisories_test.go b/github/security_advisories_test.go index eb8e7d317d6..0116f0ddbb1 100644 --- a/github/security_advisories_test.go +++ b/github/security_advisories_test.go @@ -1159,3 +1159,172 @@ func TestGetGlobalSecurityAdvisories(t *testing.T) { return resp, err }) } + +func TestSecurityAdvisorySubmission_Marshal(t *testing.T) { + testJSONMarshal(t, &SecurityAdvisorySubmission{}, `{}`) + + u := &SecurityAdvisorySubmission{ + Accepted: Bool(true), + } + + w := `{ + "accepted": true + }` + + testJSONMarshal(t, u, w) +} + +func TestRepoAdvisoryCredit_Marshal(t *testing.T) { + testJSONMarshal(t, &RepoAdvisoryCredit{}, `{}`) + + u := &RepoAdvisoryCredit{ + Login: String("l"), + Type: String("t"), + } + + w := `{ + "login": "l", + "type": "t" + }` + + testJSONMarshal(t, u, w) +} + +func TestRepoAdvisoryCreditDetailed_Marshal(t *testing.T) { + testJSONMarshal(t, &RepoAdvisoryCreditDetailed{}, `{}`) + + testDate := &Timestamp{time.Date(2019, time.August, 10, 14, 59, 22, 0, time.UTC)} + u := &RepoAdvisoryCreditDetailed{ + Type: String("t"), + State: String("s"), + User: &User{ + Name: String("u"), + Company: String("c"), + Blog: String("b"), + Location: String("l"), + Email: String("e"), + Hireable: Bool(false), + Bio: String("bio"), + TwitterUsername: String("tu"), + PublicRepos: Int(1), + PublicGists: Int(1), + Followers: Int(2), + Following: Int(2), + CreatedAt: testDate, + UpdatedAt: testDate, + SuspendedAt: testDate, + Type: String("type"), + SiteAdmin: Bool(false), + TotalPrivateRepos: Int64(10), + OwnedPrivateRepos: Int64(10), + PrivateGists: Int(10), + DiskUsage: Int(10), + Collaborators: Int(10), + TwoFactorAuthentication: Bool(true), + Plan: &Plan{ + Name: String("p"), + Space: Int(2), + Collaborators: Int(2), + PrivateRepos: Int64(2), + Seats: Int(2), + FilledSeats: Int(1), + }, + LdapDn: String("l"), + URL: String("url"), + EventsURL: String("e"), + FollowingURL: String("f"), + FollowersURL: String("f"), + GistsURL: String("g"), + OrganizationsURL: String("o"), + ReceivedEventsURL: String("r"), + ReposURL: String("rep"), + StarredURL: String("star"), + SubscriptionsURL: String("sub"), + TextMatches: []*TextMatch{ + { + ObjectURL: String("u"), + ObjectType: String("t"), + Property: String("p"), + Fragment: String("f"), + Matches: []*Match{ + { + Text: String("t"), + Indices: []int{1, 2}, + }, + }, + }, + }, + Permissions: map[string]bool{"p1": true}, + RoleName: String("r"), + }, + } + + w := `{ + "type": "t", + "state": "s", + "user": { + "name": "u", + "company": "c", + "blog": "b", + "location": "l", + "email": "e", + "hireable": false, + "bio": "bio", + "twitter_username": "tu", + "public_repos": 1, + "public_gists": 1, + "followers": 2, + "following": 2, + "created_at": "2019-08-10T14:59:22Z", + "updated_at": "2019-08-10T14:59:22Z", + "suspended_at": "2019-08-10T14:59:22Z", + "type": "type", + "site_admin": false, + "total_private_repos": 10, + "owned_private_repos": 10, + "private_gists": 10, + "disk_usage": 10, + "collaborators": 10, + "two_factor_authentication": true, + "plan": { + "name": "p", + "space": 2, + "collaborators": 2, + "private_repos": 2, + "seats": 2, + "filled_seats": 1 + }, + "ldap_dn": "l", + "url": "url", + "events_url": "e", + "following_url": "f", + "followers_url": "f", + "gists_url": "g", + "organizations_url": "o", + "received_events_url": "r", + "repos_url": "rep", + "starred_url": "star", + "subscriptions_url": "sub", + "text_matches": [ + { + "object_url": "u", + "object_type": "t", + "property": "p", + "fragment": "f", + "matches": [ + { + "text": "t", + "indices": [1, 2] + } + ] + } + ], + "permissions": { + "p1": true + }, + "role_name": "r" + } + }` + + testJSONMarshal(t, u, w) +} From 5bf78f8b6b3ea99c8073df6b8d2875441851694f Mon Sep 17 00:00:00 2001 From: Florian Maier Date: Thu, 15 Feb 2024 21:51:22 +0100 Subject: [PATCH 111/145] Rename function parameters to match usage as url parameters (#3078) --- github/actions_runners.go | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/github/actions_runners.go b/github/actions_runners.go index 90cf5804e1e..c5c90279df5 100644 --- a/github/actions_runners.go +++ b/github/actions_runners.go @@ -63,8 +63,8 @@ type JITRunnerConfig struct { // GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#create-configuration-for-a-just-in-time-runner-for-an-organization // //meta:operation POST /orgs/{org}/actions/runners/generate-jitconfig -func (s *ActionsService) GenerateOrgJITConfig(ctx context.Context, owner string, request *GenerateJITConfigRequest) (*JITRunnerConfig, *Response, error) { - u := fmt.Sprintf("orgs/%v/actions/runners/generate-jitconfig", owner) +func (s *ActionsService) GenerateOrgJITConfig(ctx context.Context, org string, request *GenerateJITConfigRequest) (*JITRunnerConfig, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/runners/generate-jitconfig", org) req, err := s.client.NewRequest("POST", u, request) if err != nil { return nil, nil, err @@ -247,8 +247,8 @@ func (s *ActionsService) RemoveRunner(ctx context.Context, owner, repo string, r // GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#list-runner-applications-for-an-organization // //meta:operation GET /orgs/{org}/actions/runners/downloads -func (s *ActionsService) ListOrganizationRunnerApplicationDownloads(ctx context.Context, owner string) ([]*RunnerApplicationDownload, *Response, error) { - u := fmt.Sprintf("orgs/%v/actions/runners/downloads", owner) +func (s *ActionsService) ListOrganizationRunnerApplicationDownloads(ctx context.Context, org string) ([]*RunnerApplicationDownload, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/runners/downloads", org) req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err @@ -268,8 +268,8 @@ func (s *ActionsService) ListOrganizationRunnerApplicationDownloads(ctx context. // GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#create-a-registration-token-for-an-organization // //meta:operation POST /orgs/{org}/actions/runners/registration-token -func (s *ActionsService) CreateOrganizationRegistrationToken(ctx context.Context, owner string) (*RegistrationToken, *Response, error) { - u := fmt.Sprintf("orgs/%v/actions/runners/registration-token", owner) +func (s *ActionsService) CreateOrganizationRegistrationToken(ctx context.Context, org string) (*RegistrationToken, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/runners/registration-token", org) req, err := s.client.NewRequest("POST", u, nil) if err != nil { @@ -290,8 +290,8 @@ func (s *ActionsService) CreateOrganizationRegistrationToken(ctx context.Context // GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#list-self-hosted-runners-for-an-organization // //meta:operation GET /orgs/{org}/actions/runners -func (s *ActionsService) ListOrganizationRunners(ctx context.Context, owner string, opts *ListOptions) (*Runners, *Response, error) { - u := fmt.Sprintf("orgs/%v/actions/runners", owner) +func (s *ActionsService) ListOrganizationRunners(ctx context.Context, org string, opts *ListOptions) (*Runners, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/runners", org) u, err := addOptions(u, opts) if err != nil { return nil, nil, err @@ -316,8 +316,8 @@ func (s *ActionsService) ListOrganizationRunners(ctx context.Context, owner stri // GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#get-a-self-hosted-runner-for-an-organization // //meta:operation GET /orgs/{org}/actions/runners/{runner_id} -func (s *ActionsService) GetOrganizationRunner(ctx context.Context, owner string, runnerID int64) (*Runner, *Response, error) { - u := fmt.Sprintf("orgs/%v/actions/runners/%v", owner, runnerID) +func (s *ActionsService) GetOrganizationRunner(ctx context.Context, org string, runnerID int64) (*Runner, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/runners/%v", org, runnerID) req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err @@ -337,8 +337,8 @@ func (s *ActionsService) GetOrganizationRunner(ctx context.Context, owner string // GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#create-a-remove-token-for-an-organization // //meta:operation POST /orgs/{org}/actions/runners/remove-token -func (s *ActionsService) CreateOrganizationRemoveToken(ctx context.Context, owner string) (*RemoveToken, *Response, error) { - u := fmt.Sprintf("orgs/%v/actions/runners/remove-token", owner) +func (s *ActionsService) CreateOrganizationRemoveToken(ctx context.Context, org string) (*RemoveToken, *Response, error) { + u := fmt.Sprintf("orgs/%v/actions/runners/remove-token", org) req, err := s.client.NewRequest("POST", u, nil) if err != nil { @@ -359,8 +359,8 @@ func (s *ActionsService) CreateOrganizationRemoveToken(ctx context.Context, owne // GitHub API docs: https://docs.github.com/rest/actions/self-hosted-runners#delete-a-self-hosted-runner-from-an-organization // //meta:operation DELETE /orgs/{org}/actions/runners/{runner_id} -func (s *ActionsService) RemoveOrganizationRunner(ctx context.Context, owner string, runnerID int64) (*Response, error) { - u := fmt.Sprintf("orgs/%v/actions/runners/%v", owner, runnerID) +func (s *ActionsService) RemoveOrganizationRunner(ctx context.Context, org string, runnerID int64) (*Response, error) { + u := fmt.Sprintf("orgs/%v/actions/runners/%v", org, runnerID) req, err := s.client.NewRequest("DELETE", u, nil) if err != nil { From 454c1ddaeb85aa3caba66b7cd21ca24b6a2e311d Mon Sep 17 00:00:00 2001 From: Shervil Gupta <35729671+ShervilG@users.noreply.github.com> Date: Fri, 16 Feb 2024 23:04:01 +0530 Subject: [PATCH 112/145] Add test case for JSON resource marshaling (#3080) --- github/security_advisories_test.go | 386 +++++++++++++++++++++++++++++ 1 file changed, 386 insertions(+) diff --git a/github/security_advisories_test.go b/github/security_advisories_test.go index 0116f0ddbb1..b43ef7f990a 100644 --- a/github/security_advisories_test.go +++ b/github/security_advisories_test.go @@ -1328,3 +1328,389 @@ func TestRepoAdvisoryCreditDetailed_Marshal(t *testing.T) { testJSONMarshal(t, u, w) } + +func TestCredit_Marshal(t *testing.T) { + testJSONMarshal(t, &Credit{}, `{}`) + + testDate := &Timestamp{time.Date(2019, time.August, 10, 14, 59, 22, 0, time.UTC)} + u := &Credit{ + Type: String("t"), + User: &User{ + Name: String("u"), + Company: String("c"), + Blog: String("b"), + Location: String("l"), + Email: String("e"), + Hireable: Bool(false), + Bio: String("bio"), + TwitterUsername: String("tu"), + PublicRepos: Int(1), + PublicGists: Int(1), + Followers: Int(2), + Following: Int(2), + CreatedAt: testDate, + UpdatedAt: testDate, + SuspendedAt: testDate, + Type: String("type"), + SiteAdmin: Bool(false), + TotalPrivateRepos: Int64(10), + OwnedPrivateRepos: Int64(10), + PrivateGists: Int(10), + DiskUsage: Int(10), + Collaborators: Int(10), + TwoFactorAuthentication: Bool(true), + Plan: &Plan{ + Name: String("p"), + Space: Int(2), + Collaborators: Int(2), + PrivateRepos: Int64(2), + Seats: Int(2), + FilledSeats: Int(1), + }, + LdapDn: String("l"), + URL: String("url"), + EventsURL: String("e"), + FollowingURL: String("f"), + FollowersURL: String("f"), + GistsURL: String("g"), + OrganizationsURL: String("o"), + ReceivedEventsURL: String("r"), + ReposURL: String("rep"), + StarredURL: String("star"), + SubscriptionsURL: String("sub"), + TextMatches: []*TextMatch{ + { + ObjectURL: String("u"), + ObjectType: String("t"), + Property: String("p"), + Fragment: String("f"), + Matches: []*Match{ + { + Text: String("t"), + Indices: []int{1, 2}, + }, + }, + }, + }, + Permissions: map[string]bool{"p1": true}, + RoleName: String("r"), + }, + } + + w := `{ + "type": "t", + "user": { + "name": "u", + "company": "c", + "blog": "b", + "location": "l", + "email": "e", + "hireable": false, + "bio": "bio", + "twitter_username": "tu", + "public_repos": 1, + "public_gists": 1, + "followers": 2, + "following": 2, + "created_at": "2019-08-10T14:59:22Z", + "updated_at": "2019-08-10T14:59:22Z", + "suspended_at": "2019-08-10T14:59:22Z", + "type": "type", + "site_admin": false, + "total_private_repos": 10, + "owned_private_repos": 10, + "private_gists": 10, + "disk_usage": 10, + "collaborators": 10, + "two_factor_authentication": true, + "plan": { + "name": "p", + "space": 2, + "collaborators": 2, + "private_repos": 2, + "seats": 2, + "filled_seats": 1 + }, + "ldap_dn": "l", + "url": "url", + "events_url": "e", + "following_url": "f", + "followers_url": "f", + "gists_url": "g", + "organizations_url": "o", + "received_events_url": "r", + "repos_url": "rep", + "starred_url": "star", + "subscriptions_url": "sub", + "text_matches": [ + { + "object_url": "u", + "object_type": "t", + "property": "p", + "fragment": "f", + "matches": [ + { + "text": "t", + "indices": [1, 2] + } + ] + } + ], + "permissions": { + "p1": true + }, + "role_name": "r" + } + }` + + testJSONMarshal(t, u, w) +} + +func TestGlobalSecurityAdvisory_Marshal(t *testing.T) { + testJSONMarshal(t, &GlobalSecurityAdvisory{}, `{}`) + + testDate := &Timestamp{time.Date(2019, time.August, 10, 14, 59, 22, 0, time.UTC)} + u := &GlobalSecurityAdvisory{ + ID: Int64(1), + RepositoryAdvisoryURL: String("r"), + Type: String("t"), + SourceCodeLocation: String("s"), + References: []string{"r"}, + Vulnerabilities: []*GlobalSecurityVulnerability{ + { + Package: &VulnerabilityPackage{ + Ecosystem: String("npm"), + Name: String("a-package"), + }, + FirstPatchedVersion: String("1.0.3"), + VulnerableVersionRange: String("<=1.0.2"), + VulnerableFunctions: []string{"a_function"}, + }, + }, + GithubReviewedAt: testDate, + NVDPublishedAt: testDate, + Credits: []*Credit{ + { + Type: String("t"), + User: &User{ + Name: String("u"), + Company: String("c"), + Blog: String("b"), + Location: String("l"), + Email: String("e"), + Hireable: Bool(false), + Bio: String("bio"), + TwitterUsername: String("tu"), + PublicRepos: Int(1), + PublicGists: Int(1), + Followers: Int(2), + Following: Int(2), + CreatedAt: testDate, + UpdatedAt: testDate, + SuspendedAt: testDate, + Type: String("type"), + SiteAdmin: Bool(false), + TotalPrivateRepos: Int64(10), + OwnedPrivateRepos: Int64(10), + PrivateGists: Int(10), + DiskUsage: Int(10), + Collaborators: Int(10), + TwoFactorAuthentication: Bool(true), + Plan: &Plan{ + Name: String("p"), + Space: Int(2), + Collaborators: Int(2), + PrivateRepos: Int64(2), + Seats: Int(2), + FilledSeats: Int(1), + }, + LdapDn: String("l"), + URL: String("url"), + EventsURL: String("e"), + FollowingURL: String("f"), + FollowersURL: String("f"), + GistsURL: String("g"), + OrganizationsURL: String("o"), + ReceivedEventsURL: String("r"), + ReposURL: String("rep"), + StarredURL: String("star"), + SubscriptionsURL: String("sub"), + TextMatches: []*TextMatch{ + { + ObjectURL: String("u"), + ObjectType: String("t"), + Property: String("p"), + Fragment: String("f"), + Matches: []*Match{ + { + Text: String("t"), + Indices: []int{1, 2}, + }, + }, + }, + }, + Permissions: map[string]bool{"p1": true}, + RoleName: String("r"), + }, + }, + }, + SecurityAdvisory: SecurityAdvisory{ + GHSAID: String("GHSA-xoxo-1234-xoxo"), + CVEID: String("CVE-xoxo-1234"), + URL: String("https://api.github.com/advisories/GHSA-xoxo-1234-xoxo"), + HTMLURL: String("https://github.com/advisories/GHSA-xoxo-1234-xoxo"), + Severity: String("high"), + Summary: String("Heartbleed security advisory"), + Description: String("This bug allows an attacker to read portions of the affected server’s memory, potentially disclosing sensitive information."), + Identifiers: []*AdvisoryIdentifier{ + { + Type: String("GHSA"), + Value: String("GHSA-xoxo-1234-xoxo"), + }, + { + Type: String("CVE"), + Value: String("CVE-xoxo-1234"), + }, + }, + PublishedAt: testDate, + UpdatedAt: testDate, + WithdrawnAt: nil, + CVSS: &AdvisoryCVSS{ + VectorString: String("CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:C/C:H/I:H/A:H"), + Score: Float64(7.6), + }, + CWEs: []*AdvisoryCWEs{ + { + CWEID: String("CWE-400"), + Name: String("Uncontrolled Resource Consumption"), + }, + }, + }, + } + + w := `{ + "cvss": { + "score": 7.6, + "vector_string": "CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:C/C:H/I:H/A:H" + }, + "cwes": [ + { + "cwe_id": "CWE-400", + "name": "Uncontrolled Resource Consumption" + } + ], + "ghsa_id": "GHSA-xoxo-1234-xoxo", + "summary": "Heartbleed security advisory", + "description": "This bug allows an attacker to read portions of the affected server’s memory, potentially disclosing sensitive information.", + "severity": "high", + "identifiers": [ + { + "value": "GHSA-xoxo-1234-xoxo", + "type": "GHSA" + }, + { + "value": "CVE-xoxo-1234", + "type": "CVE" + } + ], + "published_at": "2019-08-10T14:59:22Z", + "updated_at": "2019-08-10T14:59:22Z", + "cve_id": "CVE-xoxo-1234", + "url": "https://api.github.com/advisories/GHSA-xoxo-1234-xoxo", + "html_url": "https://github.com/advisories/GHSA-xoxo-1234-xoxo", + "id": 1, + "repository_advisory_url": "r", + "type": "t", + "source_code_location": "s", + "references": [ + "r" + ], + "vulnerabilities": [ + { + "package": { + "ecosystem": "npm", + "name": "a-package" + }, + "first_patched_version": "1.0.3", + "vulnerable_version_range": "\u003c=1.0.2", + "vulnerable_functions": [ + "a_function" + ] + } + ], + "github_reviewed_at": "2019-08-10T14:59:22Z", + "nvd_published_at": "2019-08-10T14:59:22Z", + "credits": [ + { + "user": { + "name": "u", + "company": "c", + "blog": "b", + "location": "l", + "email": "e", + "hireable": false, + "bio": "bio", + "twitter_username": "tu", + "public_repos": 1, + "public_gists": 1, + "followers": 2, + "following": 2, + "created_at": "2019-08-10T14:59:22Z", + "updated_at": "2019-08-10T14:59:22Z", + "suspended_at": "2019-08-10T14:59:22Z", + "type": "type", + "site_admin": false, + "total_private_repos": 10, + "owned_private_repos": 10, + "private_gists": 10, + "disk_usage": 10, + "collaborators": 10, + "two_factor_authentication": true, + "plan": { + "name": "p", + "space": 2, + "collaborators": 2, + "private_repos": 2, + "filled_seats": 1, + "seats": 2 + }, + "ldap_dn": "l", + "url": "url", + "events_url": "e", + "following_url": "f", + "followers_url": "f", + "gists_url": "g", + "organizations_url": "o", + "received_events_url": "r", + "repos_url": "rep", + "starred_url": "star", + "subscriptions_url": "sub", + "text_matches": [ + { + "object_url": "u", + "object_type": "t", + "property": "p", + "fragment": "f", + "matches": [ + { + "text": "t", + "indices": [ + 1, + 2 + ] + } + ] + } + ], + "permissions": { + "p1": true + }, + "role_name": "r" + }, + "type": "t" + } + ] + }` + + testJSONMarshal(t, u, w) +} From 73422173c6336ad014ce14c9113477bea3339187 Mon Sep 17 00:00:00 2001 From: Francesco Giordano <73994521+himazawa@users.noreply.github.com> Date: Sat, 17 Feb 2024 16:10:21 +0100 Subject: [PATCH 113/145] feat!: Change Hook.Config field from map to *HookConfig (#3073) Fixes: #3072. BREAKING CHANGE: Changes `Hook.Config` from `map[string]interface{}` to `*HookConfig`. --- github/event_types_test.go | 10 +++++++--- github/github-accessors.go | 8 ++++++++ github/github-accessors_test.go | 7 +++++++ github/github-stringify_test.go | 3 ++- github/orgs_audit_log.go | 10 ---------- github/repos_hooks.go | 14 +++++++------- github/repos_hooks_configuration.go | 15 +++++++++++++++ github/repos_hooks_test.go | 12 ++++-------- 8 files changed, 50 insertions(+), 29 deletions(-) diff --git a/github/event_types_test.go b/github/event_types_test.go index 8578b922bf6..b00e94a34e4 100644 --- a/github/event_types_test.go +++ b/github/event_types_test.go @@ -7691,6 +7691,7 @@ func TestPingEvent_Marshal(t *testing.T) { l := make(map[string]interface{}) l["key"] = "value" + hookConfig := new(HookConfig) u := &PingEvent{ Zen: String("z"), @@ -7705,7 +7706,7 @@ func TestPingEvent_Marshal(t *testing.T) { TestURL: String("tu"), PingURL: String("pu"), LastResponse: l, - Config: l, + Config: hookConfig, Events: []string{"a"}, Active: Bool(true), }, @@ -12165,6 +12166,9 @@ func TestMetaEvent_Marshal(t *testing.T) { v := make(map[string]interface{}) v["a"] = "b" + hookConfig := &HookConfig{ + ContentType: String("json"), + } u := &MetaEvent{ Action: String("a"), @@ -12179,7 +12183,7 @@ func TestMetaEvent_Marshal(t *testing.T) { TestURL: String("tu"), PingURL: String("pu"), LastResponse: v, - Config: v, + Config: hookConfig, Events: []string{"a"}, Active: Bool(true), }, @@ -12201,7 +12205,7 @@ func TestMetaEvent_Marshal(t *testing.T) { "a": "b" }, "config": { - "a": "b" + "content_type": "json" }, "events": [ "a" diff --git a/github/github-accessors.go b/github/github-accessors.go index b645390e83a..89728d38df9 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -7894,6 +7894,14 @@ func (h *Hook) GetActive() bool { return *h.Active } +// GetConfig returns the Config field. +func (h *Hook) GetConfig() *HookConfig { + if h == nil { + return nil + } + return h.Config +} + // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. func (h *Hook) GetCreatedAt() Timestamp { if h == nil || h.CreatedAt == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 8d5b438054d..1dcb4dc2bb9 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -9229,6 +9229,13 @@ func TestHook_GetActive(tt *testing.T) { h.GetActive() } +func TestHook_GetConfig(tt *testing.T) { + h := &Hook{} + h.GetConfig() + h = nil + h.GetConfig() +} + func TestHook_GetCreatedAt(tt *testing.T) { var zeroValue Timestamp h := &Hook{CreatedAt: &zeroValue} diff --git a/github/github-stringify_test.go b/github/github-stringify_test.go index bb69ce1ad5a..576db8ff29a 100644 --- a/github/github-stringify_test.go +++ b/github/github-stringify_test.go @@ -617,10 +617,11 @@ func TestHook_String(t *testing.T) { Name: String(""), TestURL: String(""), PingURL: String(""), + Config: &HookConfig{}, Events: []string{""}, Active: Bool(false), } - want := `github.Hook{CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, URL:"", ID:0, Type:"", Name:"", TestURL:"", PingURL:"", Events:[""], Active:false}` + want := `github.Hook{CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, URL:"", ID:0, Type:"", Name:"", TestURL:"", PingURL:"", Config:github.HookConfig{}, Events:[""], Active:false}` if got := v.String(); got != want { t.Errorf("Hook.String = %v, want %v", got, want) } diff --git a/github/orgs_audit_log.go b/github/orgs_audit_log.go index 28ac079bb3b..025c5d02327 100644 --- a/github/orgs_audit_log.go +++ b/github/orgs_audit_log.go @@ -20,16 +20,6 @@ type GetAuditLogOptions struct { ListCursorOptions } -// HookConfig describes metadata about a webhook configuration. -type HookConfig struct { - ContentType *string `json:"content_type,omitempty"` - InsecureSSL *string `json:"insecure_ssl,omitempty"` - URL *string `json:"url,omitempty"` - - // Secret is returned obfuscated by GitHub, but it can be set for outgoing requests. - Secret *string `json:"secret,omitempty"` -} - // ActorLocation contains information about reported location for an actor. type ActorLocation struct { CountryCode *string `json:"country_code,omitempty"` diff --git a/github/repos_hooks.go b/github/repos_hooks.go index 3edf6475666..d221db21b6b 100644 --- a/github/repos_hooks.go +++ b/github/repos_hooks.go @@ -51,9 +51,9 @@ type Hook struct { // Only the following fields are used when creating a hook. // Config is required. - Config map[string]interface{} `json:"config,omitempty"` - Events []string `json:"events,omitempty"` - Active *bool `json:"active,omitempty"` + Config *HookConfig `json:"config,omitempty"` + Events []string `json:"events,omitempty"` + Active *bool `json:"active,omitempty"` } func (h Hook) String() string { @@ -67,10 +67,10 @@ func (h Hook) String() string { // information. type createHookRequest struct { // Config is required. - Name string `json:"name"` - Config map[string]interface{} `json:"config,omitempty"` - Events []string `json:"events,omitempty"` - Active *bool `json:"active,omitempty"` + Name string `json:"name"` + Config *HookConfig `json:"config,omitempty"` + Events []string `json:"events,omitempty"` + Active *bool `json:"active,omitempty"` } // CreateHook creates a Hook for the specified repository. diff --git a/github/repos_hooks_configuration.go b/github/repos_hooks_configuration.go index b58eb248e44..9560bd7a4ba 100644 --- a/github/repos_hooks_configuration.go +++ b/github/repos_hooks_configuration.go @@ -10,6 +10,21 @@ import ( "fmt" ) +// HookConfig describes metadata about a webhook configuration. +type HookConfig struct { + // The media type used to serialize the payloads + // Possible values are `json` and `form`, the field is not specified the default is `form` + ContentType *string `json:"content_type,omitempty"` + // The possible values are 0 and 1. + // Setting it to 1 will allow skip certificate verification for the host, + // potentially exposing to MitM attacks: https://en.wikipedia.org/wiki/Man-in-the-middle_attack + InsecureSSL *string `json:"insecure_ssl,omitempty"` + URL *string `json:"url,omitempty"` + + // Secret is returned obfuscated by GitHub, but it can be set for outgoing requests. + Secret *string `json:"secret,omitempty"` +} + // GetHookConfiguration returns the configuration for the specified repository webhook. // // GitHub API docs: https://docs.github.com/rest/repos/webhooks#get-a-webhook-configuration-for-a-repository diff --git a/github/repos_hooks_test.go b/github/repos_hooks_test.go index fa44440ade0..bda277af735 100644 --- a/github/repos_hooks_test.go +++ b/github/repos_hooks_test.go @@ -502,9 +502,7 @@ func TestBranchCreateHookRequest_Marshal(t *testing.T) { Name: "abc", Events: []string{"1", "2", "3"}, Active: Bool(true), - Config: map[string]interface{}{ - "thing": "@123", - }, + Config: &HookConfig{ContentType: String("json")}, } want := `{ @@ -512,7 +510,7 @@ func TestBranchCreateHookRequest_Marshal(t *testing.T) { "active": true, "events": ["1","2","3"], "config":{ - "thing": "@123" + "content_type": "json" } }` @@ -534,9 +532,7 @@ func TestBranchHook_Marshal(t *testing.T) { LastResponse: map[string]interface{}{ "item": "item", }, - Config: map[string]interface{}{ - "thing": "@123", - }, + Config: &HookConfig{ContentType: String("json")}, Events: []string{"1", "2", "3"}, Active: Bool(true), } @@ -554,7 +550,7 @@ func TestBranchHook_Marshal(t *testing.T) { "item": "item" }, "config":{ - "thing": "@123" + "content_type": "json" }, "events": ["1","2","3"], "active": true From c066426738317917d55c7efbbde29f8213427fc7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Feb 2024 15:49:43 -0500 Subject: [PATCH 114/145] Bump github.com/PuerkitoBio/goquery from 1.8.1 to 1.9.0 in /scrape (#3085) --- scrape/go.mod | 2 +- scrape/go.sum | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/scrape/go.mod b/scrape/go.mod index 260a0414972..a59c0619622 100644 --- a/scrape/go.mod +++ b/scrape/go.mod @@ -3,7 +3,7 @@ module github.com/google/go-github/scrape go 1.13 require ( - github.com/PuerkitoBio/goquery v1.8.1 + github.com/PuerkitoBio/goquery v1.9.0 github.com/google/go-cmp v0.6.0 github.com/google/go-github/v59 v59.0.0 github.com/xlzd/gotp v0.1.0 diff --git a/scrape/go.sum b/scrape/go.sum index 8eee238637c..452c976d664 100644 --- a/scrape/go.sum +++ b/scrape/go.sum @@ -1,7 +1,7 @@ -github.com/PuerkitoBio/goquery v1.8.1 h1:uQxhNlArOIdbrH1tr0UXwdVFgDcZDrZVdcpygAcwmWM= -github.com/PuerkitoBio/goquery v1.8.1/go.mod h1:Q8ICL1kNUJ2sXGoAhPGUdYDJvgQgHzJsnnd3H7Ho5jQ= -github.com/andybalholm/cascadia v1.3.1 h1:nhxRkql1kdYCc8Snf7D5/D3spOX+dBgjA6u8x004T2c= -github.com/andybalholm/cascadia v1.3.1/go.mod h1:R4bJ1UQfqADjvDa4P6HZHLh/3OxWWEqc0Sk8XGwHqvA= +github.com/PuerkitoBio/goquery v1.9.0 h1:zgjKkdpRY9T97Q5DCtcXwfqkcylSFIVCocZmn2huTp8= +github.com/PuerkitoBio/goquery v1.9.0/go.mod h1:cW1n6TmIMDoORQU5IU/P1T3tGFunOeXEpGP2WHRwkbY= +github.com/andybalholm/cascadia v1.3.2 h1:3Xi6Dw5lHF15JtdcmAHD3i1+T8plmv7BQ/nsViSLyss= +github.com/andybalholm/cascadia v1.3.2/go.mod h1:7gtRlve5FxPPgIgX36uWBX58OdBsSS6lUvCFb+h7KvU= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= @@ -19,10 +19,9 @@ golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91 golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210916014120-12bc252f5db8/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= @@ -31,21 +30,21 @@ golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= From 4f323e5388007d9ee6e19cf9f57ec994574698a4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Feb 2024 15:50:17 -0500 Subject: [PATCH 115/145] Bump codecov/codecov-action from 4.0.1 to 4.0.2 (#3084) --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d789c811c14..cf6f7ec284c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -73,4 +73,4 @@ jobs: - name: Upload coverage to Codecov if: ${{ matrix.update-coverage }} - uses: codecov/codecov-action@e0b68c6749509c5f83f984dd99a76a1c1a231044 #v4.0.1 + uses: codecov/codecov-action@0cfda1dd0a4ad9efc75517f399d859cd1ea4ced1 #v4.0.2 From ffe505198ca42c56e8c2232928a040a6d0f5b31f Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Thu, 29 Feb 2024 12:16:23 -0500 Subject: [PATCH 116/145] Bump version of go-github to v60.0.0 (#3086) --- README.md | 15 ++++++++------- example/actionpermissions/main.go | 2 +- example/appengine/app.go | 2 +- example/basicauth/main.go | 2 +- .../codespaces/newreposecretwithxcrypto/main.go | 2 +- .../codespaces/newusersecretwithxcrypto/main.go | 2 +- example/commitpr/main.go | 2 +- example/go.mod | 6 +++--- example/listenvironments/main.go | 2 +- example/migrations/main.go | 2 +- example/newfilewithappauth/main.go | 2 +- example/newrepo/main.go | 2 +- example/newreposecretwithlibsodium/go.mod | 4 ++-- example/newreposecretwithlibsodium/main.go | 2 +- example/newreposecretwithxcrypto/main.go | 2 +- example/ratelimit/main.go | 2 +- example/simple/main.go | 2 +- example/tagprotection/main.go | 2 +- example/tokenauth/main.go | 2 +- example/topics/main.go | 2 +- github/doc.go | 2 +- github/examples_test.go | 2 +- github/github.go | 2 +- go.mod | 2 +- test/fields/fields.go | 2 +- test/integration/activity_test.go | 2 +- test/integration/authorizations_test.go | 2 +- test/integration/github_test.go | 2 +- test/integration/repos_test.go | 2 +- test/integration/users_test.go | 2 +- tools/go.mod | 4 ++-- tools/metadata/main.go | 2 +- tools/metadata/main_test.go | 2 +- tools/metadata/metadata.go | 2 +- tools/metadata/openapi.go | 2 +- 35 files changed, 46 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index 00407f2d745..f2f1437744b 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # go-github # [![go-github release (latest SemVer)](https://img.shields.io/github/v/release/google/go-github?sort=semver)](https://github.com/google/go-github/releases) -[![GoDoc](https://img.shields.io/static/v1?label=godoc&message=reference&color=blue)](https://pkg.go.dev/github.com/google/go-github/v59/github) +[![GoDoc](https://img.shields.io/static/v1?label=godoc&message=reference&color=blue)](https://pkg.go.dev/github.com/google/go-github/v60/github) [![Test Status](https://github.com/google/go-github/workflows/tests/badge.svg)](https://github.com/google/go-github/actions?query=workflow%3Atests) [![Test Coverage](https://codecov.io/gh/google/go-github/branch/master/graph/badge.svg)](https://codecov.io/gh/google/go-github) [![Discuss at go-github@googlegroups.com](https://img.shields.io/badge/discuss-go--github%40googlegroups.com-blue.svg)](https://groups.google.com/group/go-github) @@ -24,7 +24,7 @@ If you're interested in using the [GraphQL API v4][], the recommended library is go-github is compatible with modern Go releases in module mode, with Go installed: ```bash -go get github.com/google/go-github/v59 +go get github.com/google/go-github/v60 ``` will resolve and add the package to the current development module, along with its dependencies. @@ -32,7 +32,7 @@ will resolve and add the package to the current development module, along with i Alternatively the same can be achieved if you use import in a package: ```go -import "github.com/google/go-github/v59/github" +import "github.com/google/go-github/v60/github" ``` and run `go get` without parameters. @@ -40,13 +40,13 @@ and run `go get` without parameters. Finally, to use the top-of-trunk version of this repo, use the following command: ```bash -go get github.com/google/go-github/v59@master +go get github.com/google/go-github/v60@master ``` ## Usage ## ```go -import "github.com/google/go-github/v59/github" // with go modules enabled (GO111MODULE=on or outside GOPATH) +import "github.com/google/go-github/v60/github" // with go modules enabled (GO111MODULE=on or outside GOPATH) import "github.com/google/go-github/github" // with go modules disabled ``` @@ -117,7 +117,7 @@ import ( "net/http" "github.com/bradleyfalzon/ghinstallation/v2" - "github.com/google/go-github/v59/github" + "github.com/google/go-github/v60/github" ) func main() { @@ -296,7 +296,7 @@ For complete usage of go-github, see the full [package docs][]. [GitHub API v3]: https://docs.github.com/en/rest [personal access token]: https://github.com/blog/1509-personal-api-tokens -[package docs]: https://pkg.go.dev/github.com/google/go-github/v59/github +[package docs]: https://pkg.go.dev/github.com/google/go-github/v60/github [GraphQL API v4]: https://developer.github.com/v4/ [shurcooL/githubv4]: https://github.com/shurcooL/githubv4 [GitHub webhook events]: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads @@ -369,6 +369,7 @@ Versions prior to 48.2.0 are not listed. | go-github Version | GitHub v3 API Version | | ----------------- | --------------------- | +| 60.0.0 | 2022-11-28 | | 59.0.0 | 2022-11-28 | | 58.0.0 | 2022-11-28 | | 57.0.0 | 2022-11-28 | diff --git a/example/actionpermissions/main.go b/example/actionpermissions/main.go index f4229a8b8a6..46a541ffa35 100644 --- a/example/actionpermissions/main.go +++ b/example/actionpermissions/main.go @@ -14,7 +14,7 @@ import ( "log" "os" - "github.com/google/go-github/v59/github" + "github.com/google/go-github/v60/github" ) var ( diff --git a/example/appengine/app.go b/example/appengine/app.go index 2a971c3ce94..e8a578d5fea 100644 --- a/example/appengine/app.go +++ b/example/appengine/app.go @@ -12,7 +12,7 @@ import ( "net/http" "os" - "github.com/google/go-github/v59/github" + "github.com/google/go-github/v60/github" "google.golang.org/appengine" "google.golang.org/appengine/log" ) diff --git a/example/basicauth/main.go b/example/basicauth/main.go index 5145185f851..c5453573a9e 100644 --- a/example/basicauth/main.go +++ b/example/basicauth/main.go @@ -21,7 +21,7 @@ import ( "os" "strings" - "github.com/google/go-github/v59/github" + "github.com/google/go-github/v60/github" "golang.org/x/term" ) diff --git a/example/codespaces/newreposecretwithxcrypto/main.go b/example/codespaces/newreposecretwithxcrypto/main.go index 8b4168697de..9fffd8fbcb7 100644 --- a/example/codespaces/newreposecretwithxcrypto/main.go +++ b/example/codespaces/newreposecretwithxcrypto/main.go @@ -36,7 +36,7 @@ import ( "log" "os" - "github.com/google/go-github/v59/github" + "github.com/google/go-github/v60/github" "golang.org/x/crypto/nacl/box" ) diff --git a/example/codespaces/newusersecretwithxcrypto/main.go b/example/codespaces/newusersecretwithxcrypto/main.go index ed5e42daae5..72256136c40 100644 --- a/example/codespaces/newusersecretwithxcrypto/main.go +++ b/example/codespaces/newusersecretwithxcrypto/main.go @@ -37,7 +37,7 @@ import ( "log" "os" - "github.com/google/go-github/v59/github" + "github.com/google/go-github/v60/github" "golang.org/x/crypto/nacl/box" ) diff --git a/example/commitpr/main.go b/example/commitpr/main.go index f3023619c3c..ffe7aa4529f 100644 --- a/example/commitpr/main.go +++ b/example/commitpr/main.go @@ -33,7 +33,7 @@ import ( "time" "github.com/ProtonMail/go-crypto/openpgp" - "github.com/google/go-github/v59/github" + "github.com/google/go-github/v60/github" ) var ( diff --git a/example/go.mod b/example/go.mod index f3e6883fa1c..17e9dd10f60 100644 --- a/example/go.mod +++ b/example/go.mod @@ -1,4 +1,4 @@ -module github.com/google/go-github/v59/example +module github.com/google/go-github/v60/example go 1.21 @@ -6,7 +6,7 @@ require ( github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 github.com/bradleyfalzon/ghinstallation/v2 v2.0.4 github.com/gofri/go-github-ratelimit v1.0.3 - github.com/google/go-github/v59 v59.0.0 + github.com/google/go-github/v60 v60.0.0 golang.org/x/crypto v0.17.0 golang.org/x/term v0.15.0 google.golang.org/appengine v1.6.7 @@ -24,4 +24,4 @@ require ( ) // Use version at HEAD, not the latest published. -replace github.com/google/go-github/v59 => ../ +replace github.com/google/go-github/v60 => ../ diff --git a/example/listenvironments/main.go b/example/listenvironments/main.go index b6af06c2ca2..83cff102825 100644 --- a/example/listenvironments/main.go +++ b/example/listenvironments/main.go @@ -18,7 +18,7 @@ import ( "log" "os" - "github.com/google/go-github/v59/github" + "github.com/google/go-github/v60/github" ) func main() { diff --git a/example/migrations/main.go b/example/migrations/main.go index 37b578d4d01..8f3d80943c2 100644 --- a/example/migrations/main.go +++ b/example/migrations/main.go @@ -12,7 +12,7 @@ import ( "context" "fmt" - "github.com/google/go-github/v59/github" + "github.com/google/go-github/v60/github" ) func fetchAllUserMigrations() ([]*github.UserMigration, error) { diff --git a/example/newfilewithappauth/main.go b/example/newfilewithappauth/main.go index 787a60111ac..9754af7b71e 100644 --- a/example/newfilewithappauth/main.go +++ b/example/newfilewithappauth/main.go @@ -16,7 +16,7 @@ import ( "time" "github.com/bradleyfalzon/ghinstallation/v2" - "github.com/google/go-github/v59/github" + "github.com/google/go-github/v60/github" ) func main() { diff --git a/example/newrepo/main.go b/example/newrepo/main.go index 17681c28704..64f09a8f947 100644 --- a/example/newrepo/main.go +++ b/example/newrepo/main.go @@ -16,7 +16,7 @@ import ( "log" "os" - "github.com/google/go-github/v59/github" + "github.com/google/go-github/v60/github" ) var ( diff --git a/example/newreposecretwithlibsodium/go.mod b/example/newreposecretwithlibsodium/go.mod index 07619c05181..138068bca8f 100644 --- a/example/newreposecretwithlibsodium/go.mod +++ b/example/newreposecretwithlibsodium/go.mod @@ -6,10 +6,10 @@ toolchain go1.22.0 require ( github.com/GoKillers/libsodium-go v0.0.0-20171022220152-dd733721c3cb - github.com/google/go-github/v59 v59.0.0 + github.com/google/go-github/v60 v60.0.0 ) require github.com/google/go-querystring v1.1.0 // indirect // Use version at HEAD, not the latest published. -replace github.com/google/go-github/v59 => ../.. +replace github.com/google/go-github/v60 => ../.. diff --git a/example/newreposecretwithlibsodium/main.go b/example/newreposecretwithlibsodium/main.go index 93d6f5be03a..9eb40ac875c 100644 --- a/example/newreposecretwithlibsodium/main.go +++ b/example/newreposecretwithlibsodium/main.go @@ -36,7 +36,7 @@ import ( "os" sodium "github.com/GoKillers/libsodium-go/cryptobox" - "github.com/google/go-github/v59/github" + "github.com/google/go-github/v60/github" ) var ( diff --git a/example/newreposecretwithxcrypto/main.go b/example/newreposecretwithxcrypto/main.go index 8fb1b533b3e..660e3004e1e 100644 --- a/example/newreposecretwithxcrypto/main.go +++ b/example/newreposecretwithxcrypto/main.go @@ -36,7 +36,7 @@ import ( "log" "os" - "github.com/google/go-github/v59/github" + "github.com/google/go-github/v60/github" "golang.org/x/crypto/nacl/box" ) diff --git a/example/ratelimit/main.go b/example/ratelimit/main.go index 4728cb504ad..f7f8d1a52fc 100644 --- a/example/ratelimit/main.go +++ b/example/ratelimit/main.go @@ -13,7 +13,7 @@ import ( "fmt" "github.com/gofri/go-github-ratelimit/github_ratelimit" - "github.com/google/go-github/v59/github" + "github.com/google/go-github/v60/github" ) func main() { diff --git a/example/simple/main.go b/example/simple/main.go index 7df3f927fec..af8c6ae8f78 100644 --- a/example/simple/main.go +++ b/example/simple/main.go @@ -12,7 +12,7 @@ import ( "context" "fmt" - "github.com/google/go-github/v59/github" + "github.com/google/go-github/v60/github" ) // Fetch all the public organizations' membership of a user. diff --git a/example/tagprotection/main.go b/example/tagprotection/main.go index 825ef7b895b..2dad5a27369 100644 --- a/example/tagprotection/main.go +++ b/example/tagprotection/main.go @@ -18,7 +18,7 @@ import ( "os" "strings" - "github.com/google/go-github/v59/github" + "github.com/google/go-github/v60/github" "golang.org/x/term" ) diff --git a/example/tokenauth/main.go b/example/tokenauth/main.go index e4ed2e7dcab..04c6e5a4ef7 100644 --- a/example/tokenauth/main.go +++ b/example/tokenauth/main.go @@ -15,7 +15,7 @@ import ( "log" "os" - "github.com/google/go-github/v59/github" + "github.com/google/go-github/v60/github" "golang.org/x/term" ) diff --git a/example/topics/main.go b/example/topics/main.go index c29e0d45bd2..09ae6c203b5 100644 --- a/example/topics/main.go +++ b/example/topics/main.go @@ -12,7 +12,7 @@ import ( "context" "fmt" - "github.com/google/go-github/v59/github" + "github.com/google/go-github/v60/github" ) // Fetch and lists all the public topics associated with the specified GitHub topic diff --git a/github/doc.go b/github/doc.go index 7bb0d18dff4..1896244d7f0 100644 --- a/github/doc.go +++ b/github/doc.go @@ -8,7 +8,7 @@ Package github provides a client for using the GitHub API. Usage: - import "github.com/google/go-github/v59/github" // with go modules enabled (GO111MODULE=on or outside GOPATH) + import "github.com/google/go-github/v60/github" // with go modules enabled (GO111MODULE=on or outside GOPATH) import "github.com/google/go-github/github" // with go modules disabled Construct a new GitHub client, then use the various services on the client to diff --git a/github/examples_test.go b/github/examples_test.go index db26615f45d..cb22fecd95b 100644 --- a/github/examples_test.go +++ b/github/examples_test.go @@ -12,7 +12,7 @@ import ( "fmt" "log" - "github.com/google/go-github/v59/github" + "github.com/google/go-github/v60/github" ) func ExampleMarkdownService_Render() { diff --git a/github/github.go b/github/github.go index 805a3fed3da..05c3acd55b7 100644 --- a/github/github.go +++ b/github/github.go @@ -28,7 +28,7 @@ import ( ) const ( - Version = "v59.0.0" + Version = "v60.0.0" defaultAPIVersion = "2022-11-28" defaultBaseURL = "https://api.github.com/" diff --git a/go.mod b/go.mod index 32244bfb7d5..b00b053ad8c 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/google/go-github/v59 +module github.com/google/go-github/v60 require ( github.com/google/go-cmp v0.6.0 diff --git a/test/fields/fields.go b/test/fields/fields.go index 6be99aa23d1..5dea9bcfd43 100644 --- a/test/fields/fields.go +++ b/test/fields/fields.go @@ -25,7 +25,7 @@ import ( "reflect" "strings" - "github.com/google/go-github/v59/github" + "github.com/google/go-github/v60/github" ) var ( diff --git a/test/integration/activity_test.go b/test/integration/activity_test.go index f15a9e6188a..0a9744df1a3 100644 --- a/test/integration/activity_test.go +++ b/test/integration/activity_test.go @@ -12,7 +12,7 @@ import ( "context" "testing" - "github.com/google/go-github/v59/github" + "github.com/google/go-github/v60/github" ) const ( diff --git a/test/integration/authorizations_test.go b/test/integration/authorizations_test.go index 1942454eb54..f6edbd8aada 100644 --- a/test/integration/authorizations_test.go +++ b/test/integration/authorizations_test.go @@ -15,7 +15,7 @@ import ( "testing" "time" - "github.com/google/go-github/v59/github" + "github.com/google/go-github/v60/github" ) const msgEnvMissing = "Skipping test because the required environment variable (%v) is not present." diff --git a/test/integration/github_test.go b/test/integration/github_test.go index 4fc8c003070..642cb406ff0 100644 --- a/test/integration/github_test.go +++ b/test/integration/github_test.go @@ -15,7 +15,7 @@ import ( "net/http" "os" - "github.com/google/go-github/v59/github" + "github.com/google/go-github/v60/github" ) var ( diff --git a/test/integration/repos_test.go b/test/integration/repos_test.go index 9b32cc4a311..9451bf81e52 100644 --- a/test/integration/repos_test.go +++ b/test/integration/repos_test.go @@ -15,7 +15,7 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/google/go-github/v59/github" + "github.com/google/go-github/v60/github" ) func TestRepositories_CRUD(t *testing.T) { diff --git a/test/integration/users_test.go b/test/integration/users_test.go index 21e14c16a7d..0a2d9c8aebe 100644 --- a/test/integration/users_test.go +++ b/test/integration/users_test.go @@ -14,7 +14,7 @@ import ( "math/rand" "testing" - "github.com/google/go-github/v59/github" + "github.com/google/go-github/v60/github" ) func TestUsers_Get(t *testing.T) { diff --git a/tools/go.mod b/tools/go.mod index 4d6ad23eefa..b9e425c604f 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -8,7 +8,7 @@ require ( github.com/alecthomas/kong v0.8.1 github.com/getkin/kin-openapi v0.123.0 github.com/google/go-cmp v0.6.0 - github.com/google/go-github/v59 v59.0.0 + github.com/google/go-github/v60 v60.0.0 golang.org/x/sync v0.6.0 gopkg.in/yaml.v3 v3.0.1 ) @@ -25,4 +25,4 @@ require ( ) // Use version at HEAD, not the latest published. -replace github.com/google/go-github/v59 => ../ +replace github.com/google/go-github/v60 => ../ diff --git a/tools/metadata/main.go b/tools/metadata/main.go index a8c597ae00d..9b279fff182 100644 --- a/tools/metadata/main.go +++ b/tools/metadata/main.go @@ -15,7 +15,7 @@ import ( "path/filepath" "github.com/alecthomas/kong" - "github.com/google/go-github/v59/github" + "github.com/google/go-github/v60/github" ) var helpVars = kong.Vars{ diff --git a/tools/metadata/main_test.go b/tools/metadata/main_test.go index 0d850fb5b30..1118414d12f 100644 --- a/tools/metadata/main_test.go +++ b/tools/metadata/main_test.go @@ -23,7 +23,7 @@ import ( "github.com/alecthomas/kong" "github.com/getkin/kin-openapi/openapi3" "github.com/google/go-cmp/cmp" - "github.com/google/go-github/v59/github" + "github.com/google/go-github/v60/github" ) func TestUpdateGo(t *testing.T) { diff --git a/tools/metadata/metadata.go b/tools/metadata/metadata.go index 0818a14202e..4a87603e8d1 100644 --- a/tools/metadata/metadata.go +++ b/tools/metadata/metadata.go @@ -24,7 +24,7 @@ import ( "strings" "sync" - "github.com/google/go-github/v59/github" + "github.com/google/go-github/v60/github" "gopkg.in/yaml.v3" ) diff --git a/tools/metadata/openapi.go b/tools/metadata/openapi.go index e138e142bd4..ae18b66b258 100644 --- a/tools/metadata/openapi.go +++ b/tools/metadata/openapi.go @@ -14,7 +14,7 @@ import ( "strconv" "github.com/getkin/kin-openapi/openapi3" - "github.com/google/go-github/v59/github" + "github.com/google/go-github/v60/github" "golang.org/x/sync/errgroup" ) From a25989b0298916f638f33c35429ecda5d6c0850b Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Thu, 29 Feb 2024 12:31:09 -0500 Subject: [PATCH 117/145] Bump go-github from v59 to v60 in /scrape (#3087) --- scrape/apps.go | 2 +- scrape/apps_test.go | 2 +- scrape/go.mod | 11 +++++++++-- scrape/go.sum | 11 ++--------- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/scrape/apps.go b/scrape/apps.go index 5310f88ce62..fcf61588730 100644 --- a/scrape/apps.go +++ b/scrape/apps.go @@ -17,7 +17,7 @@ import ( "strings" "github.com/PuerkitoBio/goquery" - "github.com/google/go-github/v59/github" + "github.com/google/go-github/v60/github" ) // AppRestrictionsEnabled returns whether the specified organization has diff --git a/scrape/apps_test.go b/scrape/apps_test.go index 8cfbbdb0006..c0a6a751de3 100644 --- a/scrape/apps_test.go +++ b/scrape/apps_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/google/go-github/v59/github" + "github.com/google/go-github/v60/github" ) func Test_AppRestrictionsEnabled(t *testing.T) { diff --git a/scrape/go.mod b/scrape/go.mod index a59c0619622..7a41ce4f1b9 100644 --- a/scrape/go.mod +++ b/scrape/go.mod @@ -1,11 +1,18 @@ module github.com/google/go-github/scrape -go 1.13 +go 1.21 + +toolchain go1.22.0 require ( github.com/PuerkitoBio/goquery v1.9.0 github.com/google/go-cmp v0.6.0 - github.com/google/go-github/v59 v59.0.0 + github.com/google/go-github/v60 v60.0.0 github.com/xlzd/gotp v0.1.0 golang.org/x/net v0.21.0 ) + +require ( + github.com/andybalholm/cascadia v1.3.2 // indirect + github.com/google/go-querystring v1.1.0 // indirect +) diff --git a/scrape/go.sum b/scrape/go.sum index 452c976d664..22a8b903416 100644 --- a/scrape/go.sum +++ b/scrape/go.sum @@ -5,8 +5,8 @@ github.com/andybalholm/cascadia v1.3.2/go.mod h1:7gtRlve5FxPPgIgX36uWBX58OdBsSS6 github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-github/v59 v59.0.0 h1:7h6bgpF5as0YQLLkEiVqpgtJqjimMYhBkD4jT5aN3VA= -github.com/google/go-github/v59 v59.0.0/go.mod h1:rJU4R0rQHFVFDOkqGWxfLNo6vEk4dv40oDjhV/gH6wM= +github.com/google/go-github/v60 v60.0.0 h1:oLG98PsLauFvvu4D/YPxq374jhSxFYdzQGNCyONLfn8= +github.com/google/go-github/v60 v60.0.0/go.mod h1:ByhX2dP9XT9o/ll2yXAu2VD8l5eNVg8hD4Cr0S/LmQk= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/xlzd/gotp v0.1.0 h1:37blvlKCh38s+fkem+fFh7sMnceltoIEBYTVXyoa5Po= @@ -14,7 +14,6 @@ github.com/xlzd/gotp v0.1.0/go.mod h1:ndLJ3JKzi3xLmUProq4LLxCuECL93dG9WASNLpHz8q github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -22,7 +21,6 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -35,20 +33,15 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= -golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= -golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= From 9bb6bf428d6d02d0c7fdfb9b2e4c51885c76aa51 Mon Sep 17 00:00:00 2001 From: tomfeigin Date: Sun, 3 Mar 2024 15:51:07 +0200 Subject: [PATCH 118/145] Allow querying rule set information by ID with information returned from GetRulesFromBranch (#3089) --- github/repos_rules.go | 10 ++++++++-- github/repos_rules_test.go | 26 ++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/github/repos_rules.go b/github/repos_rules.go index 479806c2ee9..9f4e0245f08 100644 --- a/github/repos_rules.go +++ b/github/repos_rules.go @@ -112,8 +112,11 @@ type RequiredWorkflowsRuleParameters struct { // RepositoryRule represents a GitHub Rule. type RepositoryRule struct { - Type string `json:"type"` - Parameters *json.RawMessage `json:"parameters,omitempty"` + Type string `json:"type"` + Parameters *json.RawMessage `json:"parameters,omitempty"` + RulesetSourceType string `json:"ruleset_source_type"` + RulesetSource string `json:"ruleset_source"` + RulesetID int64 `json:"ruleset_id"` } // UnmarshalJSON implements the json.Unmarshaler interface. @@ -125,6 +128,9 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error { return err } + r.RulesetID = RepositoryRule.RulesetID + r.RulesetSourceType = RepositoryRule.RulesetSourceType + r.RulesetSource = RepositoryRule.RulesetSource r.Type = RepositoryRule.Type switch RepositoryRule.Type { diff --git a/github/repos_rules_test.go b/github/repos_rules_test.go index cd8e49c2e07..cbc3e5ce617 100644 --- a/github/repos_rules_test.go +++ b/github/repos_rules_test.go @@ -28,6 +28,20 @@ func TestRepositoryRule_UnmarshalJSON(t *testing.T) { }, wantErr: true, }, + "With Metadata": { + data: `{ + "type": "creation", + "ruleset_source_type": "Repository", + "ruleset_source": "google", + "ruleset_id": 1984 + }`, + want: &RepositoryRule{ + RulesetSource: "google", + RulesetSourceType: "Repository", + RulesetID: 1984, + Type: "creation", + }, + }, "Valid creation": { data: `{"type":"creation"}`, want: NewCreationRule(), @@ -262,9 +276,15 @@ func TestRepositoriesService_GetRulesForBranch(t *testing.T) { testMethod(t, r, "GET") fmt.Fprint(w, `[ { + "ruleset_id": 42069, + "ruleset_source_type": "Repository", + "ruleset_source": "google", "type": "creation" }, { + "ruleset_id": 42069, + "ruleset_source_type": "Organization", + "ruleset_source": "google", "type": "update", "parameters": { "update_allows_fetch_and_merge": true @@ -280,9 +300,15 @@ func TestRepositoriesService_GetRulesForBranch(t *testing.T) { } creationRule := NewCreationRule() + creationRule.RulesetID = 42069 + creationRule.RulesetSource = "google" + creationRule.RulesetSourceType = "Repository" updateRule := NewUpdateRule(&UpdateAllowsFetchAndMergeRuleParameters{ UpdateAllowsFetchAndMerge: true, }) + updateRule.RulesetID = 42069 + updateRule.RulesetSource = "google" + updateRule.RulesetSourceType = "Organization" want := []*RepositoryRule{ creationRule, From f034bcf4a7fd4b68ea475164635bc532a8628015 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Mar 2024 14:17:07 -0500 Subject: [PATCH 119/145] Bump codecov/codecov-action from 4.0.2 to 4.1.0 (#3091) --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cf6f7ec284c..fdde6151063 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -73,4 +73,4 @@ jobs: - name: Upload coverage to Codecov if: ${{ matrix.update-coverage }} - uses: codecov/codecov-action@0cfda1dd0a4ad9efc75517f399d859cd1ea4ced1 #v4.0.2 + uses: codecov/codecov-action@54bcd8715eee62d40e33596ef5e8f0f48dbbccab #v4.1.0 From 0e3ab5807f0e9bc6ea690f1b49e94b78259f3681 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Mar 2024 14:28:06 -0500 Subject: [PATCH 120/145] Bump github.com/PuerkitoBio/goquery from 1.9.0 to 1.9.1 in /scrape (#3092) --- scrape/go.mod | 2 +- scrape/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scrape/go.mod b/scrape/go.mod index 7a41ce4f1b9..17618d1dbf6 100644 --- a/scrape/go.mod +++ b/scrape/go.mod @@ -5,7 +5,7 @@ go 1.21 toolchain go1.22.0 require ( - github.com/PuerkitoBio/goquery v1.9.0 + github.com/PuerkitoBio/goquery v1.9.1 github.com/google/go-cmp v0.6.0 github.com/google/go-github/v60 v60.0.0 github.com/xlzd/gotp v0.1.0 diff --git a/scrape/go.sum b/scrape/go.sum index 22a8b903416..994ce7f0984 100644 --- a/scrape/go.sum +++ b/scrape/go.sum @@ -1,5 +1,5 @@ -github.com/PuerkitoBio/goquery v1.9.0 h1:zgjKkdpRY9T97Q5DCtcXwfqkcylSFIVCocZmn2huTp8= -github.com/PuerkitoBio/goquery v1.9.0/go.mod h1:cW1n6TmIMDoORQU5IU/P1T3tGFunOeXEpGP2WHRwkbY= +github.com/PuerkitoBio/goquery v1.9.1 h1:mTL6XjbJTZdpfL+Gwl5U2h1l9yEkJjhmlTeV9VPW7UI= +github.com/PuerkitoBio/goquery v1.9.1/go.mod h1:cW1n6TmIMDoORQU5IU/P1T3tGFunOeXEpGP2WHRwkbY= github.com/andybalholm/cascadia v1.3.2 h1:3Xi6Dw5lHF15JtdcmAHD3i1+T8plmv7BQ/nsViSLyss= github.com/andybalholm/cascadia v1.3.2/go.mod h1:7gtRlve5FxPPgIgX36uWBX58OdBsSS6lUvCFb+h7KvU= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= From 2c1b36c92f356f33521a5433477e5eae3f9e94a7 Mon Sep 17 00:00:00 2001 From: Jake Scaltreto Date: Mon, 11 Mar 2024 10:31:34 -0400 Subject: [PATCH 121/145] Add Protection to Branch struct (#3095) --- github/github-accessors.go | 8 ++++++++ github/github-accessors_test.go | 7 +++++++ github/repos.go | 8 ++++++++ github/repos_test.go | 14 ++++++++++++-- 4 files changed, 35 insertions(+), 2 deletions(-) diff --git a/github/github-accessors.go b/github/github-accessors.go index 89728d38df9..18aa42dd672 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -1574,6 +1574,14 @@ func (b *Branch) GetProtected() bool { return *b.Protected } +// GetProtection returns the Protection field. +func (b *Branch) GetProtection() *Protection { + if b == nil { + return nil + } + return b.Protection +} + // GetCommit returns the Commit field. func (b *BranchCommit) GetCommit() *Commit { if b == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 1dcb4dc2bb9..e187cd4aba5 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -1881,6 +1881,13 @@ func TestBranch_GetProtected(tt *testing.T) { b.GetProtected() } +func TestBranch_GetProtection(tt *testing.T) { + b := &Branch{} + b.GetProtection() + b = nil + b.GetProtection() +} + func TestBranchCommit_GetCommit(tt *testing.T) { b := &BranchCommit{} b.GetCommit() diff --git a/github/repos.go b/github/repos.go index 2fb4c6f190a..6fb0030a3b2 100644 --- a/github/repos.go +++ b/github/repos.go @@ -1003,6 +1003,14 @@ type Branch struct { Name *string `json:"name,omitempty"` Commit *RepositoryCommit `json:"commit,omitempty"` Protected *bool `json:"protected,omitempty"` + + // Protection will always be included in APIs which return the + // 'Branch With Protection' schema such as 'Get a branch', but may + // not be included in APIs that return the `Short Branch` schema + // such as 'List branches'. In such cases, if branch protection is + // enabled, Protected will be `true` but this will be nil, and + // additional protection details can be obtained by calling GetBranch(). + Protection *Protection `json:"protection,omitempty"` } // Protection represents a repository branch's protection. diff --git a/github/repos_test.go b/github/repos_test.go index 0ea381ebb56..2b742bef904 100644 --- a/github/repos_test.go +++ b/github/repos_test.go @@ -930,7 +930,7 @@ func TestRepositoriesService_GetBranch(t *testing.T) { for _, test := range tests { mux.HandleFunc(test.urlPath, func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - fmt.Fprint(w, `{"name":"n", "commit":{"sha":"s","commit":{"message":"m"}}, "protected":true}`) + fmt.Fprint(w, `{"name":"n", "commit":{"sha":"s","commit":{"message":"m"}}, "protected":true, "protection":{"required_status_checks":{"contexts":["c"]}}}`) }) ctx := context.Background() @@ -948,6 +948,11 @@ func TestRepositoriesService_GetBranch(t *testing.T) { }, }, Protected: Bool(true), + Protection: &Protection{ + RequiredStatusChecks: &RequiredStatusChecks{ + Contexts: &[]string{"c"}, + }, + }, } if !cmp.Equal(branch, want) { @@ -1000,7 +1005,7 @@ func TestRepositoriesService_GetBranch_StatusMovedPermanently_followRedirects(t }) mux.HandleFunc("/repos/o/r/branches/br", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - fmt.Fprint(w, `{"name":"n", "commit":{"sha":"s","commit":{"message":"m"}}, "protected":true}`) + fmt.Fprint(w, `{"name":"n", "commit":{"sha":"s","commit":{"message":"m"}}, "protected":true, "protection":{"required_status_checks":{"contexts":["c"]}}}`) }) ctx := context.Background() branch, resp, err := client.Repositories.GetBranch(ctx, "o", "r", "b", 1) @@ -1020,6 +1025,11 @@ func TestRepositoriesService_GetBranch_StatusMovedPermanently_followRedirects(t }, }, Protected: Bool(true), + Protection: &Protection{ + RequiredStatusChecks: &RequiredStatusChecks{ + Contexts: &[]string{"c"}, + }, + }, } if !cmp.Equal(branch, want) { t.Errorf("Repositories.GetBranch returned %+v, want %+v", branch, want) From 145c01b2815eb6963ac8c49c071224f95a869b58 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Mar 2024 20:14:18 -0400 Subject: [PATCH 122/145] Bump github.com/alecthomas/kong from 0.8.1 to 0.9.0 in /tools (#3097) --- tools/go.mod | 2 +- tools/go.sum | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/go.mod b/tools/go.mod index b9e425c604f..874aa769d2c 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -5,7 +5,7 @@ go 1.21 toolchain go1.22.0 require ( - github.com/alecthomas/kong v0.8.1 + github.com/alecthomas/kong v0.9.0 github.com/getkin/kin-openapi v0.123.0 github.com/google/go-cmp v0.6.0 github.com/google/go-github/v60 v60.0.0 diff --git a/tools/go.sum b/tools/go.sum index 87c9d843a96..ce5b0414f82 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -1,9 +1,9 @@ -github.com/alecthomas/assert/v2 v2.1.0 h1:tbredtNcQnoSd3QBhQWI7QZ3XHOVkw1Moklp2ojoH/0= -github.com/alecthomas/assert/v2 v2.1.0/go.mod h1:b/+1DI2Q6NckYi+3mXyH3wFb8qG37K/DuK80n7WefXA= -github.com/alecthomas/kong v0.8.1 h1:acZdn3m4lLRobeh3Zi2S2EpnXTd1mOL6U7xVml+vfkY= -github.com/alecthomas/kong v0.8.1/go.mod h1:n1iCIO2xS46oE8ZfYCNDqdR0b0wZNrXAIAqro/2132U= -github.com/alecthomas/repr v0.1.0 h1:ENn2e1+J3k09gyj2shc0dHr/yjaWSHRlrJ4DPMevDqE= -github.com/alecthomas/repr v0.1.0/go.mod h1:2kn6fqh/zIyPLmm3ugklbEi5hg5wS435eygvNfaDQL8= +github.com/alecthomas/assert/v2 v2.6.0 h1:o3WJwILtexrEUk3cUVal3oiQY2tfgr/FHWiz/v2n4FU= +github.com/alecthomas/assert/v2 v2.6.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k= +github.com/alecthomas/kong v0.9.0 h1:G5diXxc85KvoV2f0ZRVuMsi45IrBgx9zDNGNj165aPA= +github.com/alecthomas/kong v0.9.0/go.mod h1:Y47y5gKfHp1hDc7CH7OeXgLIpp+Q2m1Ni0L5s3bI8Os= +github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc= +github.com/alecthomas/repr v0.4.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/getkin/kin-openapi v0.123.0 h1:zIik0mRwFNLyvtXK274Q6ut+dPh6nlxBp0x7mNrPhs8= From f29e3f239cfde8214493d0c0952c375b3952e884 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Mar 2024 20:14:56 -0400 Subject: [PATCH 123/145] Bump golang.org/x/net from 0.21.0 to 0.22.0 in /scrape (#3096) --- scrape/go.mod | 2 +- scrape/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scrape/go.mod b/scrape/go.mod index 17618d1dbf6..f48713d021c 100644 --- a/scrape/go.mod +++ b/scrape/go.mod @@ -9,7 +9,7 @@ require ( github.com/google/go-cmp v0.6.0 github.com/google/go-github/v60 v60.0.0 github.com/xlzd/gotp v0.1.0 - golang.org/x/net v0.21.0 + golang.org/x/net v0.22.0 ) require ( diff --git a/scrape/go.sum b/scrape/go.sum index 994ce7f0984..3c8442f6aec 100644 --- a/scrape/go.sum +++ b/scrape/go.sum @@ -21,8 +21,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= -golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= From 169ad4d74d0fad23559bac97d8ad2095999a4f29 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Mar 2024 18:46:39 -0400 Subject: [PATCH 124/145] Bump google.golang.org/protobuf from 1.28.0 to 1.33.0 in /example (#3099) --- example/go.mod | 2 +- example/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/example/go.mod b/example/go.mod index 17e9dd10f60..7a2473934ed 100644 --- a/example/go.mod +++ b/example/go.mod @@ -20,7 +20,7 @@ require ( github.com/google/go-querystring v1.1.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.15.0 // indirect - google.golang.org/protobuf v1.28.0 // indirect + google.golang.org/protobuf v1.33.0 // indirect ) // Use version at HEAD, not the latest published. diff --git a/example/go.sum b/example/go.sum index 81f5d70a5b0..d8e05e56537 100644 --- a/example/go.sum +++ b/example/go.sum @@ -82,5 +82,5 @@ google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6 google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= -google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= From dbf91ee0f7104df9f5a36e01a0b8b48662f616fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Sal=C3=A9?= Date: Wed, 20 Mar 2024 13:53:47 +0100 Subject: [PATCH 125/145] Add audit log rate limit category and make rate limit category getter public (#3088) --- github/code-scanning_test.go | 2 +- github/enterprise_audit_log_test.go | 2 +- github/github-accessors.go | 8 +++ github/github-accessors_test.go | 7 +++ github/github.go | 59 ++++++++++---------- github/github_test.go | 35 ++++++------ github/orgs_audit_log_test.go | 2 +- github/rate_limit.go | 24 +++++---- github/rate_limit_test.go | 83 ++++++++++++++++++++--------- 9 files changed, 141 insertions(+), 81 deletions(-) diff --git a/github/code-scanning_test.go b/github/code-scanning_test.go index a081a6ba5f1..1edbebae0fa 100644 --- a/github/code-scanning_test.go +++ b/github/code-scanning_test.go @@ -93,7 +93,7 @@ func TestCodeScanningService_UploadSarif(t *testing.T) { return err }) - testNewRequestAndDoFailureCategory(t, methodName, client, codeScanningUploadCategory, func() (*Response, error) { + testNewRequestAndDoFailureCategory(t, methodName, client, CodeScanningUploadCategory, func() (*Response, error) { _, resp, err := client.CodeScanning.UploadSarif(ctx, "o", "r", sarifAnalysis) return resp, err }) diff --git a/github/enterprise_audit_log_test.go b/github/enterprise_audit_log_test.go index 0d9e44a3eb6..1ae94babb75 100644 --- a/github/enterprise_audit_log_test.go +++ b/github/enterprise_audit_log_test.go @@ -84,7 +84,7 @@ func TestEnterpriseService_GetAuditLog(t *testing.T) { return err }) - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + testNewRequestAndDoFailureCategory(t, methodName, client, AuditLogCategory, func() (*Response, error) { got, resp, err := client.Enterprise.GetAuditLog(ctx, "o", &GetAuditLogOptions{}) if got != nil { t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) diff --git a/github/github-accessors.go b/github/github-accessors.go index 18aa42dd672..01b81375234 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -17542,6 +17542,14 @@ func (r *RateLimits) GetActionsRunnerRegistration() *Rate { return r.ActionsRunnerRegistration } +// GetAuditLog returns the AuditLog field. +func (r *RateLimits) GetAuditLog() *Rate { + if r == nil { + return nil + } + return r.AuditLog +} + // GetCodeScanningUpload returns the CodeScanningUpload field. func (r *RateLimits) GetCodeScanningUpload() *Rate { if r == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index e187cd4aba5..ba3287351da 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -20317,6 +20317,13 @@ func TestRateLimits_GetActionsRunnerRegistration(tt *testing.T) { r.GetActionsRunnerRegistration() } +func TestRateLimits_GetAuditLog(tt *testing.T) { + r := &RateLimits{} + r.GetAuditLog() + r = nil + r.GetAuditLog() +} + func TestRateLimits_GetCodeScanningUpload(tt *testing.T) { r := &RateLimits{} r.GetCodeScanningUpload() diff --git a/github/github.go b/github/github.go index 05c3acd55b7..bf0b5715a89 100644 --- a/github/github.go +++ b/github/github.go @@ -170,7 +170,7 @@ type Client struct { UserAgent string rateMu sync.Mutex - rateLimits [categories]Rate // Rate limits for the client as determined by the most recent API calls. + rateLimits [Categories]Rate // Rate limits for the client as determined by the most recent API calls. secondaryRateLimitReset time.Time // Secondary rate limit reset for the client as determined by the most recent API calls. common service // Reuse a single struct instead of allocating one for each service on the heap. @@ -821,7 +821,7 @@ func (c *Client) BareDo(ctx context.Context, req *http.Request) (*Response, erro req = withContext(ctx, req) - rateLimitCategory := category(req.Method, req.URL.Path) + rateLimitCategory := GetRateLimitCategory(req.Method, req.URL.Path) if bypass := ctx.Value(bypassRateLimitCheck); bypass == nil { // If we've hit rate limit, don't make further requests before Reset time. @@ -937,7 +937,7 @@ func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*Res // current client state in order to quickly check if *RateLimitError can be immediately returned // from Client.Do, and if so, returns it so that Client.Do can skip making a network API call unnecessarily. // Otherwise it returns nil, and Client.Do should proceed normally. -func (c *Client) checkRateLimitBeforeDo(req *http.Request, rateLimitCategory rateLimitCategory) *RateLimitError { +func (c *Client) checkRateLimitBeforeDo(req *http.Request, rateLimitCategory RateLimitCategory) *RateLimitError { c.rateMu.Lock() rate := c.rateLimits[rateLimitCategory] c.rateMu.Unlock() @@ -1303,65 +1303,70 @@ func parseBoolResponse(err error) (bool, error) { return false, err } -type rateLimitCategory uint8 +type RateLimitCategory uint8 const ( - coreCategory rateLimitCategory = iota - searchCategory - graphqlCategory - integrationManifestCategory - sourceImportCategory - codeScanningUploadCategory - actionsRunnerRegistrationCategory - scimCategory - dependencySnapshotsCategory - codeSearchCategory - - categories // An array of this length will be able to contain all rate limit categories. + CoreCategory RateLimitCategory = iota + SearchCategory + GraphqlCategory + IntegrationManifestCategory + SourceImportCategory + CodeScanningUploadCategory + ActionsRunnerRegistrationCategory + ScimCategory + DependencySnapshotsCategory + CodeSearchCategory + AuditLogCategory + + Categories // An array of this length will be able to contain all rate limit categories. ) -// category returns the rate limit category of the endpoint, determined by HTTP method and Request.URL.Path. -func category(method, path string) rateLimitCategory { +// GetRateLimitCategory returns the rate limit RateLimitCategory of the endpoint, determined by HTTP method and Request.URL.Path. +func GetRateLimitCategory(method, path string) RateLimitCategory { switch { // https://docs.github.com/rest/rate-limit#about-rate-limits default: // NOTE: coreCategory is returned for actionsRunnerRegistrationCategory too, // because no API found for this category. - return coreCategory + return CoreCategory // https://docs.github.com/en/rest/search/search#search-code case strings.HasPrefix(path, "/search/code") && method == http.MethodGet: - return codeSearchCategory + return CodeSearchCategory case strings.HasPrefix(path, "/search/"): - return searchCategory + return SearchCategory case path == "/graphql": - return graphqlCategory + return GraphqlCategory case strings.HasPrefix(path, "/app-manifests/") && strings.HasSuffix(path, "/conversions") && method == http.MethodPost: - return integrationManifestCategory + return IntegrationManifestCategory // https://docs.github.com/rest/migrations/source-imports#start-an-import case strings.HasPrefix(path, "/repos/") && strings.HasSuffix(path, "/import") && method == http.MethodPut: - return sourceImportCategory + return SourceImportCategory // https://docs.github.com/rest/code-scanning#upload-an-analysis-as-sarif-data case strings.HasSuffix(path, "/code-scanning/sarifs"): - return codeScanningUploadCategory + return CodeScanningUploadCategory // https://docs.github.com/enterprise-cloud@latest/rest/scim case strings.HasPrefix(path, "/scim/"): - return scimCategory + return ScimCategory // https://docs.github.com/en/rest/dependency-graph/dependency-submission#create-a-snapshot-of-dependencies-for-a-repository case strings.HasPrefix(path, "/repos/") && strings.HasSuffix(path, "/dependency-graph/snapshots") && method == http.MethodPost: - return dependencySnapshotsCategory + return DependencySnapshotsCategory + + // https://docs.github.com/en/enterprise-cloud@latest/rest/orgs/orgs?apiVersion=2022-11-28#get-the-audit-log-for-an-organization + case strings.HasSuffix(path, "/audit-log"): + return AuditLogCategory } } diff --git a/github/github_test.go b/github/github_test.go index 9a369a25fd4..efc42d432fb 100644 --- a/github/github_test.go +++ b/github/github_test.go @@ -212,11 +212,11 @@ func testBadOptions(t *testing.T, methodName string, f func() error) { // Method f should be a regular call that would normally succeed, but // should return an error when NewRequest or s.client.Do fails. func testNewRequestAndDoFailure(t *testing.T, methodName string, client *Client, f func() (*Response, error)) { - testNewRequestAndDoFailureCategory(t, methodName, client, coreCategory, f) + testNewRequestAndDoFailureCategory(t, methodName, client, CoreCategory, f) } // testNewRequestAndDoFailureCategory works Like testNewRequestAndDoFailure, but allows setting the category -func testNewRequestAndDoFailureCategory(t *testing.T, methodName string, client *Client, category rateLimitCategory, f func() (*Response, error)) { +func testNewRequestAndDoFailureCategory(t *testing.T, methodName string, client *Client, category RateLimitCategory, f func() (*Response, error)) { t.Helper() if methodName == "" { t.Error("testNewRequestAndDoFailure: must supply method methodName") @@ -1132,68 +1132,73 @@ func TestDo_rateLimitCategory(t *testing.T) { tests := []struct { method string url string - category rateLimitCategory + category RateLimitCategory }{ { method: http.MethodGet, url: "/", - category: coreCategory, + category: CoreCategory, }, { method: http.MethodGet, url: "/search/issues?q=rate", - category: searchCategory, + category: SearchCategory, }, { method: http.MethodGet, url: "/graphql", - category: graphqlCategory, + category: GraphqlCategory, }, { method: http.MethodPost, url: "/app-manifests/code/conversions", - category: integrationManifestCategory, + category: IntegrationManifestCategory, }, { method: http.MethodGet, url: "/app-manifests/code/conversions", - category: coreCategory, // only POST requests are in the integration manifest category + category: CoreCategory, // only POST requests are in the integration manifest category }, { method: http.MethodPut, url: "/repos/google/go-github/import", - category: sourceImportCategory, + category: SourceImportCategory, }, { method: http.MethodGet, url: "/repos/google/go-github/import", - category: coreCategory, // only PUT requests are in the source import category + category: CoreCategory, // only PUT requests are in the source import category }, { method: http.MethodPost, url: "/repos/google/go-github/code-scanning/sarifs", - category: codeScanningUploadCategory, + category: CodeScanningUploadCategory, }, { method: http.MethodGet, url: "/scim/v2/organizations/ORG/Users", - category: scimCategory, + category: ScimCategory, }, { method: http.MethodPost, url: "/repos/google/go-github/dependency-graph/snapshots", - category: dependencySnapshotsCategory, + category: DependencySnapshotsCategory, }, { method: http.MethodGet, url: "/search/code?q=rate", - category: codeSearchCategory, + category: CodeSearchCategory, + }, + { + method: http.MethodGet, + url: "/orgs/google/audit-log", + category: AuditLogCategory, }, // missing a check for actionsRunnerRegistrationCategory: API not found } for _, tt := range tests { - if got, want := category(tt.method, tt.url), tt.category; got != want { + if got, want := GetRateLimitCategory(tt.method, tt.url), tt.category; got != want { t.Errorf("expecting category %v, found %v", got, want) } } diff --git a/github/orgs_audit_log_test.go b/github/orgs_audit_log_test.go index 7c8de74c650..feebd0affc7 100644 --- a/github/orgs_audit_log_test.go +++ b/github/orgs_audit_log_test.go @@ -164,7 +164,7 @@ func TestOrganizationService_GetAuditLog(t *testing.T) { return err }) - testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + testNewRequestAndDoFailureCategory(t, methodName, client, AuditLogCategory, func() (*Response, error) { got, resp, err := client.Organizations.GetAuditLog(ctx, "o", &GetAuditLogOptions{}) if got != nil { t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) diff --git a/github/rate_limit.go b/github/rate_limit.go index febe5edccfb..5b01b573d8a 100644 --- a/github/rate_limit.go +++ b/github/rate_limit.go @@ -54,6 +54,7 @@ type RateLimits struct { SCIM *Rate `json:"scim"` DependencySnapshots *Rate `json:"dependency_snapshots"` CodeSearch *Rate `json:"code_search"` + AuditLog *Rate `json:"audit_log"` } func (r RateLimits) String() string { @@ -85,34 +86,37 @@ func (s *RateLimitService) Get(ctx context.Context) (*RateLimits, *Response, err if response.Resources != nil { s.client.rateMu.Lock() if response.Resources.Core != nil { - s.client.rateLimits[coreCategory] = *response.Resources.Core + s.client.rateLimits[CoreCategory] = *response.Resources.Core } if response.Resources.Search != nil { - s.client.rateLimits[searchCategory] = *response.Resources.Search + s.client.rateLimits[SearchCategory] = *response.Resources.Search } if response.Resources.GraphQL != nil { - s.client.rateLimits[graphqlCategory] = *response.Resources.GraphQL + s.client.rateLimits[GraphqlCategory] = *response.Resources.GraphQL } if response.Resources.IntegrationManifest != nil { - s.client.rateLimits[integrationManifestCategory] = *response.Resources.IntegrationManifest + s.client.rateLimits[IntegrationManifestCategory] = *response.Resources.IntegrationManifest } if response.Resources.SourceImport != nil { - s.client.rateLimits[sourceImportCategory] = *response.Resources.SourceImport + s.client.rateLimits[SourceImportCategory] = *response.Resources.SourceImport } if response.Resources.CodeScanningUpload != nil { - s.client.rateLimits[codeScanningUploadCategory] = *response.Resources.CodeScanningUpload + s.client.rateLimits[CodeScanningUploadCategory] = *response.Resources.CodeScanningUpload } if response.Resources.ActionsRunnerRegistration != nil { - s.client.rateLimits[actionsRunnerRegistrationCategory] = *response.Resources.ActionsRunnerRegistration + s.client.rateLimits[ActionsRunnerRegistrationCategory] = *response.Resources.ActionsRunnerRegistration } if response.Resources.SCIM != nil { - s.client.rateLimits[scimCategory] = *response.Resources.SCIM + s.client.rateLimits[ScimCategory] = *response.Resources.SCIM } if response.Resources.DependencySnapshots != nil { - s.client.rateLimits[dependencySnapshotsCategory] = *response.Resources.DependencySnapshots + s.client.rateLimits[DependencySnapshotsCategory] = *response.Resources.DependencySnapshots } if response.Resources.CodeSearch != nil { - s.client.rateLimits[codeSearchCategory] = *response.Resources.CodeSearch + s.client.rateLimits[CodeSearchCategory] = *response.Resources.CodeSearch + } + if response.Resources.AuditLog != nil { + s.client.rateLimits[AuditLogCategory] = *response.Resources.AuditLog } s.client.rateMu.Unlock() } diff --git a/github/rate_limit_test.go b/github/rate_limit_test.go index da8a68c9106..6ff87824dda 100644 --- a/github/rate_limit_test.go +++ b/github/rate_limit_test.go @@ -27,8 +27,9 @@ func TestRateLimits_String(t *testing.T) { SCIM: &Rate{}, DependencySnapshots: &Rate{}, CodeSearch: &Rate{}, + AuditLog: &Rate{}, } - want := `github.RateLimits{Core:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, Search:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, GraphQL:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, IntegrationManifest:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, SourceImport:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, CodeScanningUpload:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, ActionsRunnerRegistration:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, SCIM:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, DependencySnapshots:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, CodeSearch:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}}` + want := `github.RateLimits{Core:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, Search:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, GraphQL:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, IntegrationManifest:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, SourceImport:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, CodeScanningUpload:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, ActionsRunnerRegistration:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, SCIM:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, DependencySnapshots:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, CodeSearch:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, AuditLog:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}}` if got := v.String(); got != want { t.Errorf("RateLimits.String = %v, want %v", got, want) } @@ -50,7 +51,8 @@ func TestRateLimits(t *testing.T) { "actions_runner_registration": {"limit":8,"remaining":7,"reset":1372700879}, "scim": {"limit":9,"remaining":8,"reset":1372700880}, "dependency_snapshots": {"limit":10,"remaining":9,"reset":1372700881}, - "code_search": {"limit":11,"remaining":10,"reset":1372700882} + "code_search": {"limit":11,"remaining":10,"reset":1372700882}, + "audit_log": {"limit": 12,"remaining":11,"reset":1372700883} }}`) }) @@ -111,54 +113,63 @@ func TestRateLimits(t *testing.T) { Remaining: 10, Reset: Timestamp{time.Date(2013, time.July, 1, 17, 48, 2, 0, time.UTC).Local()}, }, + AuditLog: &Rate{ + Limit: 12, + Remaining: 11, + Reset: Timestamp{time.Date(2013, time.July, 1, 17, 48, 3, 0, time.UTC).Local()}, + }, } if !cmp.Equal(rate, want) { t.Errorf("RateLimits returned %+v, want %+v", rate, want) } tests := []struct { - category rateLimitCategory + category RateLimitCategory rate *Rate }{ { - category: coreCategory, + category: CoreCategory, rate: want.Core, }, { - category: searchCategory, + category: SearchCategory, rate: want.Search, }, { - category: graphqlCategory, + category: GraphqlCategory, rate: want.GraphQL, }, { - category: integrationManifestCategory, + category: IntegrationManifestCategory, rate: want.IntegrationManifest, }, { - category: sourceImportCategory, + category: SourceImportCategory, rate: want.SourceImport, }, { - category: codeScanningUploadCategory, + category: CodeScanningUploadCategory, rate: want.CodeScanningUpload, }, { - category: actionsRunnerRegistrationCategory, + category: ActionsRunnerRegistrationCategory, rate: want.ActionsRunnerRegistration, }, { - category: scimCategory, + category: ScimCategory, rate: want.SCIM, }, { - category: dependencySnapshotsCategory, + category: DependencySnapshotsCategory, rate: want.DependencySnapshots, }, { - category: codeSearchCategory, + category: CodeSearchCategory, rate: want.CodeSearch, }, + { + category: AuditLogCategory, + rate: want.AuditLog, + }, } for _, tt := range tests { @@ -185,7 +196,7 @@ func TestRateLimits_overQuota(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - client.rateLimits[coreCategory] = Rate{ + client.rateLimits[CoreCategory] = Rate{ Limit: 1, Remaining: 0, Reset: Timestamp{time.Now().Add(time.Hour).Local()}, @@ -201,7 +212,8 @@ func TestRateLimits_overQuota(t *testing.T) { "actions_runner_registration": {"limit":8,"remaining":7,"reset":1372700879}, "scim": {"limit":9,"remaining":8,"reset":1372700880}, "dependency_snapshots": {"limit":10,"remaining":9,"reset":1372700881}, - "code_search": {"limit":11,"remaining":10,"reset":1372700882} + "code_search": {"limit":11,"remaining":10,"reset":1372700882}, + "audit_log": {"limit":12,"remaining":11,"reset":1372700883} }}`) }) @@ -262,55 +274,64 @@ func TestRateLimits_overQuota(t *testing.T) { Remaining: 10, Reset: Timestamp{time.Date(2013, time.July, 1, 17, 48, 2, 0, time.UTC).Local()}, }, + AuditLog: &Rate{ + Limit: 12, + Remaining: 11, + Reset: Timestamp{time.Date(2013, time.July, 1, 17, 48, 3, 0, time.UTC).Local()}, + }, } if !cmp.Equal(rate, want) { t.Errorf("RateLimits returned %+v, want %+v", rate, want) } tests := []struct { - category rateLimitCategory + category RateLimitCategory rate *Rate }{ { - category: coreCategory, + category: CoreCategory, rate: want.Core, }, { - category: searchCategory, + category: SearchCategory, rate: want.Search, }, { - category: graphqlCategory, + category: GraphqlCategory, rate: want.GraphQL, }, { - category: integrationManifestCategory, + category: IntegrationManifestCategory, rate: want.IntegrationManifest, }, { - category: sourceImportCategory, + category: SourceImportCategory, rate: want.SourceImport, }, { - category: codeScanningUploadCategory, + category: CodeScanningUploadCategory, rate: want.CodeScanningUpload, }, { - category: actionsRunnerRegistrationCategory, + category: ActionsRunnerRegistrationCategory, rate: want.ActionsRunnerRegistration, }, { - category: scimCategory, + category: ScimCategory, rate: want.SCIM, }, { - category: dependencySnapshotsCategory, + category: DependencySnapshotsCategory, rate: want.DependencySnapshots, }, { - category: codeSearchCategory, + category: CodeSearchCategory, rate: want.CodeSearch, }, + { + category: AuditLogCategory, + rate: want.AuditLog, + }, } for _, tt := range tests { if got, want := client.rateLimits[tt.category], *tt.rate; got != want { @@ -373,6 +394,11 @@ func TestRateLimits_Marshal(t *testing.T) { Remaining: 1, Reset: Timestamp{referenceTime}, }, + AuditLog: &Rate{ + Limit: 1, + Remaining: 1, + Reset: Timestamp{referenceTime}, + }, } want := `{ @@ -425,6 +451,11 @@ func TestRateLimits_Marshal(t *testing.T) { "limit": 1, "remaining": 1, "reset": ` + referenceTimeStr + ` + }, + "audit_log": { + "limit": 1, + "remaining": 1, + "reset": ` + referenceTimeStr + ` } }` From 17afef1b53bb8bd98a332d03db6420fc86a1ffeb Mon Sep 17 00:00:00 2001 From: Ryo Mimura <52129983+fchimpan@users.noreply.github.com> Date: Sun, 24 Mar 2024 11:10:42 +0900 Subject: [PATCH 126/145] Update README.md (#3110) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f2f1437744b..7e429525936 100644 --- a/README.md +++ b/README.md @@ -184,7 +184,7 @@ You can use [go-github-ratelimit](https://github.com/gofri/go-github-ratelimit) secondary rate limit sleep-and-retry for you. Learn more about GitHub secondary rate limiting at -https://docs.github.com/en/rest/overview/resources-in-the-rest-api#secondary-rate-limits . +https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28#about-secondary-rate-limits . ### Accepted Status ### From b3e96fdc1f002ce3c2aa71cba0e98214f5f50af9 Mon Sep 17 00:00:00 2001 From: Alex Rosenzweig <64241648+shellz-n-stuff@users.noreply.github.com> Date: Mon, 25 Mar 2024 08:29:11 +1100 Subject: [PATCH 127/145] Allow Installation of Custom Properties Permissions (#3108) --- github/apps.go | 1 + github/github-accessors.go | 8 ++++++++ github/github-accessors_test.go | 10 ++++++++++ 3 files changed, 19 insertions(+) diff --git a/github/apps.go b/github/apps.go index f0392f2d706..2ebfee505cd 100644 --- a/github/apps.go +++ b/github/apps.go @@ -77,6 +77,7 @@ type InstallationPermissions struct { Metadata *string `json:"metadata,omitempty"` Members *string `json:"members,omitempty"` OrganizationAdministration *string `json:"organization_administration,omitempty"` + OrganizationCustomProperties *string `json:"organization_custom_properties,omitempty"` OrganizationCustomRoles *string `json:"organization_custom_roles,omitempty"` OrganizationHooks *string `json:"organization_hooks,omitempty"` OrganizationPackages *string `json:"organization_packages,omitempty"` diff --git a/github/github-accessors.go b/github/github-accessors.go index 01b81375234..f95e4c3b9bd 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -8686,6 +8686,14 @@ func (i *InstallationPermissions) GetOrganizationAdministration() string { return *i.OrganizationAdministration } +// GetOrganizationCustomProperties returns the OrganizationCustomProperties field if it's non-nil, zero value otherwise. +func (i *InstallationPermissions) GetOrganizationCustomProperties() string { + if i == nil || i.OrganizationCustomProperties == nil { + return "" + } + return *i.OrganizationCustomProperties +} + // GetOrganizationCustomRoles returns the OrganizationCustomRoles field if it's non-nil, zero value otherwise. func (i *InstallationPermissions) GetOrganizationCustomRoles() string { if i == nil || i.OrganizationCustomRoles == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index ba3287351da..ca263064ffb 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -10177,6 +10177,16 @@ func TestInstallationPermissions_GetOrganizationAdministration(tt *testing.T) { i.GetOrganizationAdministration() } +func TestInstallationPermissions_GetOrganizationCustomProperties(tt *testing.T) { + var zeroValue string + i := &InstallationPermissions{OrganizationCustomProperties: &zeroValue} + i.GetOrganizationCustomProperties() + i = &InstallationPermissions{} + i.GetOrganizationCustomProperties() + i = nil + i.GetOrganizationCustomProperties() +} + func TestInstallationPermissions_GetOrganizationCustomRoles(tt *testing.T) { var zeroValue string i := &InstallationPermissions{OrganizationCustomRoles: &zeroValue} From 8bec011ec30db88863f28675d13c2be95ea5808d Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Mon, 25 Mar 2024 09:21:05 -0400 Subject: [PATCH 128/145] Add NotificationSetting to NewTeam (#3111) Fixes: #3107. --- github/github-accessors.go | 8 ++++++++ github/github-accessors_test.go | 10 ++++++++++ github/github-stringify_test.go | 21 +++++++++++---------- github/teams.go | 3 +++ github/teams_test.go | 18 ++++++++++-------- 5 files changed, 42 insertions(+), 18 deletions(-) diff --git a/github/github-accessors.go b/github/github-accessors.go index f95e4c3b9bd..57a7165f7ff 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -11982,6 +11982,14 @@ func (n *NewTeam) GetLDAPDN() string { return *n.LDAPDN } +// GetNotificationSetting returns the NotificationSetting field if it's non-nil, zero value otherwise. +func (n *NewTeam) GetNotificationSetting() string { + if n == nil || n.NotificationSetting == nil { + return "" + } + return *n.NotificationSetting +} + // GetParentTeamID returns the ParentTeamID field if it's non-nil, zero value otherwise. func (n *NewTeam) GetParentTeamID() int64 { if n == nil || n.ParentTeamID == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index ca263064ffb..bbf9fb8422c 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -13985,6 +13985,16 @@ func TestNewTeam_GetLDAPDN(tt *testing.T) { n.GetLDAPDN() } +func TestNewTeam_GetNotificationSetting(tt *testing.T) { + var zeroValue string + n := &NewTeam{NotificationSetting: &zeroValue} + n.GetNotificationSetting() + n = &NewTeam{} + n.GetNotificationSetting() + n = nil + n.GetNotificationSetting() +} + func TestNewTeam_GetParentTeamID(tt *testing.T) { var zeroValue int64 n := &NewTeam{ParentTeamID: &zeroValue} diff --git a/github/github-stringify_test.go b/github/github-stringify_test.go index 576db8ff29a..8633d837d12 100644 --- a/github/github-stringify_test.go +++ b/github/github-stringify_test.go @@ -962,16 +962,17 @@ func TestMilestoneStats_String(t *testing.T) { func TestNewTeam_String(t *testing.T) { v := NewTeam{ - Name: "", - Description: String(""), - Maintainers: []string{""}, - RepoNames: []string{""}, - ParentTeamID: Int64(0), - Permission: String(""), - Privacy: String(""), - LDAPDN: String(""), - } - want := `github.NewTeam{Name:"", Description:"", Maintainers:[""], RepoNames:[""], ParentTeamID:0, Permission:"", Privacy:"", LDAPDN:""}` + Name: "", + Description: String(""), + Maintainers: []string{""}, + RepoNames: []string{""}, + ParentTeamID: Int64(0), + NotificationSetting: String(""), + Permission: String(""), + Privacy: String(""), + LDAPDN: String(""), + } + want := `github.NewTeam{Name:"", Description:"", Maintainers:[""], RepoNames:[""], ParentTeamID:0, NotificationSetting:"", Permission:"", Privacy:"", LDAPDN:""}` if got := v.String(); got != want { t.Errorf("NewTeam.String = %v, want %v", got, want) } diff --git a/github/teams.go b/github/teams.go index fd22b792a66..0f6cc9d16e4 100644 --- a/github/teams.go +++ b/github/teams.go @@ -155,6 +155,9 @@ type NewTeam struct { RepoNames []string `json:"repo_names,omitempty"` ParentTeamID *int64 `json:"parent_team_id,omitempty"` + // NotificationSetting can be one of: "notifications_enabled", "notifications_disabled". + NotificationSetting *string `json:"notification_setting,omitempty"` + // Deprecated: Permission is deprecated when creating or editing a team in an org // using the new GitHub permission model. It no longer identifies the // permission a team has on its repos, but only specifies the default diff --git a/github/teams_test.go b/github/teams_test.go index c0ca1f6dd71..516c88f43ae 100644 --- a/github/teams_test.go +++ b/github/teams_test.go @@ -1590,14 +1590,15 @@ func TestNewTeam_Marshal(t *testing.T) { testJSONMarshal(t, &NewTeam{}, "{}") u := &NewTeam{ - Name: "n", - Description: String("d"), - Maintainers: []string{"m1", "m2"}, - RepoNames: []string{"repo1", "repo2"}, - ParentTeamID: Int64(1), - Permission: String("perm"), - Privacy: String("p"), - LDAPDN: String("l"), + Name: "n", + Description: String("d"), + Maintainers: []string{"m1", "m2"}, + RepoNames: []string{"repo1", "repo2"}, + NotificationSetting: String("notifications_enabled"), + ParentTeamID: Int64(1), + Permission: String("perm"), + Privacy: String("p"), + LDAPDN: String("l"), } want := `{ @@ -1606,6 +1607,7 @@ func TestNewTeam_Marshal(t *testing.T) { "maintainers": ["m1", "m2"], "repo_names": ["repo1", "repo2"], "parent_team_id": 1, + "notification_setting": "notifications_enabled", "permission": "perm", "privacy": "p", "ldap_dn": "l" From 189123903e78a8697f19baa1633b1c10a1603373 Mon Sep 17 00:00:00 2001 From: Alin Balutoiu Date: Tue, 26 Mar 2024 19:11:42 +0000 Subject: [PATCH 129/145] Fix pagination for ListCopilotSeats (#3112) --- github/copilot.go | 6 +++++- github/copilot_test.go | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/github/copilot.go b/github/copilot.go index 51c938c9748..50e05253ce5 100644 --- a/github/copilot.go +++ b/github/copilot.go @@ -161,8 +161,12 @@ func (s *CopilotService) GetCopilotBilling(ctx context.Context, org string) (*Co //meta:operation GET /orgs/{org}/copilot/billing/seats func (s *CopilotService) ListCopilotSeats(ctx context.Context, org string, opts *ListOptions) (*ListCopilotSeatsResponse, *Response, error) { u := fmt.Sprintf("orgs/%v/copilot/billing/seats", org) + u, err := addOptions(u, opts) + if err != nil { + return nil, nil, err + } - req, err := s.client.NewRequest("GET", u, opts) + req, err := s.client.NewRequest("GET", u, nil) if err != nil { return nil, nil, err } diff --git a/github/copilot_test.go b/github/copilot_test.go index c65fda0f217..bc295af3a61 100644 --- a/github/copilot_test.go +++ b/github/copilot_test.go @@ -584,8 +584,9 @@ func TestCopilotService_ListCopilotSeats(t *testing.T) { const methodName = "ListCopilotSeats" + opts := &ListOptions{Page: 2} testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Copilot.ListCopilotSeats(ctx, "\n", nil) + _, _, err = client.Copilot.ListCopilotSeats(ctx, "\n", opts) return err }) From 8c1032ac9889c9aa5dae32b196fb3c3164d64bc1 Mon Sep 17 00:00:00 2001 From: Hari Charan Korrapati <80394987+HariCharan-001@users.noreply.github.com> Date: Fri, 29 Mar 2024 00:03:35 +0530 Subject: [PATCH 130/145] feat!: Update deprecated endpoints in github/action_variables.go (#3104) Fixes: #3103. BREAKING-CHANGE: The following endpoints now take `owner` and `repo` (string) names instead of an integer repo ID: ActionsService.ListEnvVariables ActionsService.GetEnvVariable ActionsService.CreateEnvVariable ActionsService.UpdateEnvVariable ActionsService.DeleteEnvVariable --- github/actions_secrets.go | 10 +- github/actions_variables.go | 30 +- github/actions_variables_test.go | 40 +- github/admin.go | 4 +- github/admin_orgs.go | 6 +- github/admin_stats.go | 2 +- github/admin_users.go | 8 +- github/authorizations.go | 4 +- github/copilot.go | 14 +- github/repos_autolinks.go | 2 +- github/repos_prereceive_hooks.go | 8 +- github/users_administration.go | 8 +- openapi_operations.yaml | 2322 ++++++++++++++++-------------- 13 files changed, 1300 insertions(+), 1158 deletions(-) diff --git a/github/actions_secrets.go b/github/actions_secrets.go index d8d405c06d7..ec519838eab 100644 --- a/github/actions_secrets.go +++ b/github/actions_secrets.go @@ -84,7 +84,7 @@ func (s *ActionsService) GetOrgPublicKey(ctx context.Context, org string) (*Publ // GetEnvPublicKey gets a public key that should be used for secret encryption. // -// GitHub API docs: https://docs.github.com/rest/actions/secrets#get-an-environment-public-key +// GitHub API docs: https://docs.github.com/enterprise-server@3.7/rest/actions/secrets#get-an-environment-public-key // //meta:operation GET /repositories/{repository_id}/environments/{environment_name}/secrets/public-key func (s *ActionsService) GetEnvPublicKey(ctx context.Context, repoID int, env string) (*PublicKey, *Response, error) { @@ -162,7 +162,7 @@ func (s *ActionsService) ListOrgSecrets(ctx context.Context, org string, opts *L // ListEnvSecrets lists all secrets available in an environment. // -// GitHub API docs: https://docs.github.com/rest/actions/secrets#list-environment-secrets +// GitHub API docs: https://docs.github.com/enterprise-server@3.7/rest/actions/secrets#list-environment-secrets // //meta:operation GET /repositories/{repository_id}/environments/{environment_name}/secrets func (s *ActionsService) ListEnvSecrets(ctx context.Context, repoID int, env string, opts *ListOptions) (*Secrets, *Response, error) { @@ -207,7 +207,7 @@ func (s *ActionsService) GetOrgSecret(ctx context.Context, org, name string) (*S // GetEnvSecret gets a single environment secret without revealing its encrypted value. // -// GitHub API docs: https://docs.github.com/rest/actions/secrets#get-an-environment-secret +// GitHub API docs: https://docs.github.com/enterprise-server@3.7/rest/actions/secrets#get-an-environment-secret // //meta:operation GET /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name} func (s *ActionsService) GetEnvSecret(ctx context.Context, repoID int, env, secretName string) (*Secret, *Response, error) { @@ -262,7 +262,7 @@ func (s *ActionsService) CreateOrUpdateOrgSecret(ctx context.Context, org string // CreateOrUpdateEnvSecret creates or updates a single environment secret with an encrypted value. // -// GitHub API docs: https://docs.github.com/rest/actions/secrets#create-or-update-an-environment-secret +// GitHub API docs: https://docs.github.com/enterprise-server@3.7/rest/actions/secrets#create-or-update-an-environment-secret // //meta:operation PUT /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name} func (s *ActionsService) CreateOrUpdateEnvSecret(ctx context.Context, repoID int, env string, eSecret *EncryptedSecret) (*Response, error) { @@ -301,7 +301,7 @@ func (s *ActionsService) DeleteOrgSecret(ctx context.Context, org, name string) // DeleteEnvSecret deletes a secret in an environment using the secret name. // -// GitHub API docs: https://docs.github.com/rest/actions/secrets#delete-an-environment-secret +// GitHub API docs: https://docs.github.com/enterprise-server@3.7/rest/actions/secrets#delete-an-environment-secret // //meta:operation DELETE /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name} func (s *ActionsService) DeleteEnvSecret(ctx context.Context, repoID int, env, secretName string) (*Response, error) { diff --git a/github/actions_variables.go b/github/actions_variables.go index aa0f23ca48d..bca46b6df6b 100644 --- a/github/actions_variables.go +++ b/github/actions_variables.go @@ -83,9 +83,9 @@ func (s *ActionsService) ListOrgVariables(ctx context.Context, org string, opts // // GitHub API docs: https://docs.github.com/rest/actions/variables#list-environment-variables // -//meta:operation GET /repositories/{repository_id}/environments/{environment_name}/variables -func (s *ActionsService) ListEnvVariables(ctx context.Context, repoID int, env string, opts *ListOptions) (*ActionsVariables, *Response, error) { - url := fmt.Sprintf("repositories/%v/environments/%v/variables", repoID, env) +//meta:operation GET /repos/{owner}/{repo}/environments/{environment_name}/variables +func (s *ActionsService) ListEnvVariables(ctx context.Context, owner, repo, env string, opts *ListOptions) (*ActionsVariables, *Response, error) { + url := fmt.Sprintf("repos/%v/%v/environments/%v/variables", owner, repo, env) return s.listVariables(ctx, url, opts) } @@ -128,9 +128,9 @@ func (s *ActionsService) GetOrgVariable(ctx context.Context, org, name string) ( // // GitHub API docs: https://docs.github.com/rest/actions/variables#get-an-environment-variable // -//meta:operation GET /repositories/{repository_id}/environments/{environment_name}/variables/{name} -func (s *ActionsService) GetEnvVariable(ctx context.Context, repoID int, env, variableName string) (*ActionsVariable, *Response, error) { - url := fmt.Sprintf("repositories/%v/environments/%v/variables/%v", repoID, env, variableName) +//meta:operation GET /repos/{owner}/{repo}/environments/{environment_name}/variables/{name} +func (s *ActionsService) GetEnvVariable(ctx context.Context, owner, repo, env, variableName string) (*ActionsVariable, *Response, error) { + url := fmt.Sprintf("repos/%v/%v/environments/%v/variables/%v", owner, repo, env, variableName) return s.getVariable(ctx, url) } @@ -166,9 +166,9 @@ func (s *ActionsService) CreateOrgVariable(ctx context.Context, org string, vari // // GitHub API docs: https://docs.github.com/rest/actions/variables#create-an-environment-variable // -//meta:operation POST /repositories/{repository_id}/environments/{environment_name}/variables -func (s *ActionsService) CreateEnvVariable(ctx context.Context, repoID int, env string, variable *ActionsVariable) (*Response, error) { - url := fmt.Sprintf("repositories/%v/environments/%v/variables", repoID, env) +//meta:operation POST /repos/{owner}/{repo}/environments/{environment_name}/variables +func (s *ActionsService) CreateEnvVariable(ctx context.Context, owner, repo, env string, variable *ActionsVariable) (*Response, error) { + url := fmt.Sprintf("repos/%v/%v/environments/%v/variables", owner, repo, env) return s.postVariable(ctx, url, variable) } @@ -204,9 +204,9 @@ func (s *ActionsService) UpdateOrgVariable(ctx context.Context, org string, vari // // GitHub API docs: https://docs.github.com/rest/actions/variables#update-an-environment-variable // -//meta:operation PATCH /repositories/{repository_id}/environments/{environment_name}/variables/{name} -func (s *ActionsService) UpdateEnvVariable(ctx context.Context, repoID int, env string, variable *ActionsVariable) (*Response, error) { - url := fmt.Sprintf("repositories/%v/environments/%v/variables/%v", repoID, env, variable.Name) +//meta:operation PATCH /repos/{owner}/{repo}/environments/{environment_name}/variables/{name} +func (s *ActionsService) UpdateEnvVariable(ctx context.Context, owner, repo, env string, variable *ActionsVariable) (*Response, error) { + url := fmt.Sprintf("repos/%v/%v/environments/%v/variables/%v", owner, repo, env, variable.Name) return s.patchVariable(ctx, url, variable) } @@ -243,9 +243,9 @@ func (s *ActionsService) DeleteOrgVariable(ctx context.Context, org, name string // // GitHub API docs: https://docs.github.com/rest/actions/variables#delete-an-environment-variable // -//meta:operation DELETE /repositories/{repository_id}/environments/{environment_name}/variables/{name} -func (s *ActionsService) DeleteEnvVariable(ctx context.Context, repoID int, env, variableName string) (*Response, error) { - url := fmt.Sprintf("repositories/%v/environments/%v/variables/%v", repoID, env, variableName) +//meta:operation DELETE /repos/{owner}/{repo}/environments/{environment_name}/variables/{name} +func (s *ActionsService) DeleteEnvVariable(ctx context.Context, owner, repo, env, variableName string) (*Response, error) { + url := fmt.Sprintf("repos/%v/%v/environments/%v/variables/%v", owner, repo, env, variableName) return s.deleteVariable(ctx, url) } diff --git a/github/actions_variables_test.go b/github/actions_variables_test.go index dcd648c25c3..37c1a2613ac 100644 --- a/github/actions_variables_test.go +++ b/github/actions_variables_test.go @@ -533,7 +533,7 @@ func TestActionsService_ListEnvVariables(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - mux.HandleFunc("/repositories/1/environments/e/variables", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/usr/1/environments/e/variables", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") testFormValues(t, r, values{"per_page": "2", "page": "2"}) fmt.Fprint(w, `{"total_count":4,"variables":[{"name":"A","value":"AA","created_at":"2019-01-02T15:04:05Z","updated_at":"2020-01-02T15:04:05Z"},{"name":"B","value":"BB","created_at":"2019-01-02T15:04:05Z","updated_at":"2020-01-02T15:04:05Z"}]}`) @@ -541,7 +541,7 @@ func TestActionsService_ListEnvVariables(t *testing.T) { opts := &ListOptions{Page: 2, PerPage: 2} ctx := context.Background() - variables, _, err := client.Actions.ListEnvVariables(ctx, 1, "e", opts) + variables, _, err := client.Actions.ListEnvVariables(ctx, "usr", "1", "e", opts) if err != nil { t.Errorf("Actions.ListEnvVariables returned error: %v", err) } @@ -559,12 +559,12 @@ func TestActionsService_ListEnvVariables(t *testing.T) { const methodName = "ListEnvVariables" testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Actions.ListEnvVariables(ctx, 0.0, "\n", opts) + _, _, err = client.Actions.ListEnvVariables(ctx, "usr", "0", "\n", opts) return err }) testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Actions.ListEnvVariables(ctx, 1, "e", opts) + got, resp, err := client.Actions.ListEnvVariables(ctx, "usr", "1", "e", opts) if got != nil { t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) } @@ -576,13 +576,13 @@ func TestActionsService_GetEnvVariable(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - mux.HandleFunc("/repositories/1/environments/e/variables/variable", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/usr/1/environments/e/variables/variable", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") fmt.Fprint(w, `{"name":"variable","value":"VAR","created_at":"2019-01-02T15:04:05Z","updated_at":"2020-01-02T15:04:05Z"}`) }) ctx := context.Background() - variable, _, err := client.Actions.GetEnvVariable(ctx, 1, "e", "variable") + variable, _, err := client.Actions.GetEnvVariable(ctx, "usr", "1", "e", "variable") if err != nil { t.Errorf("Actions.GetEnvVariable returned error: %v", err) } @@ -599,12 +599,12 @@ func TestActionsService_GetEnvVariable(t *testing.T) { const methodName = "GetEnvVariable" testBadOptions(t, methodName, func() (err error) { - _, _, err = client.Actions.GetEnvVariable(ctx, 0.0, "\n", "\n") + _, _, err = client.Actions.GetEnvVariable(ctx, "usr", "0", "\n", "\n") return err }) testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - got, resp, err := client.Actions.GetEnvVariable(ctx, 1, "e", "variable") + got, resp, err := client.Actions.GetEnvVariable(ctx, "usr", "1", "e", "variable") if got != nil { t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) } @@ -616,7 +616,7 @@ func TestActionsService_CreateEnvVariable(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - mux.HandleFunc("/repositories/1/environments/e/variables", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/usr/1/environments/e/variables", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "POST") testHeader(t, r, "Content-Type", "application/json") testBody(t, r, `{"name":"variable","value":"VAR"}`+"\n") @@ -628,19 +628,19 @@ func TestActionsService_CreateEnvVariable(t *testing.T) { Value: "VAR", } ctx := context.Background() - _, err := client.Actions.CreateEnvVariable(ctx, 1, "e", input) + _, err := client.Actions.CreateEnvVariable(ctx, "usr", "1", "e", input) if err != nil { t.Errorf("Actions.CreateEnvVariable returned error: %v", err) } const methodName = "CreateEnvVariable" testBadOptions(t, methodName, func() (err error) { - _, err = client.Actions.CreateEnvVariable(ctx, 0.0, "\n", input) + _, err = client.Actions.CreateEnvVariable(ctx, "usr", "0", "\n", input) return err }) testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - return client.Actions.CreateEnvVariable(ctx, 1, "e", input) + return client.Actions.CreateEnvVariable(ctx, "usr", "1", "e", input) }) } @@ -648,7 +648,7 @@ func TestActionsService_UpdateEnvVariable(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - mux.HandleFunc("/repositories/1/environments/e/variables/variable", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/usr/1/environments/e/variables/variable", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "PATCH") testHeader(t, r, "Content-Type", "application/json") testBody(t, r, `{"name":"variable","value":"VAR"}`+"\n") @@ -660,19 +660,19 @@ func TestActionsService_UpdateEnvVariable(t *testing.T) { Value: "VAR", } ctx := context.Background() - _, err := client.Actions.UpdateEnvVariable(ctx, 1, "e", input) + _, err := client.Actions.UpdateEnvVariable(ctx, "usr", "1", "e", input) if err != nil { t.Errorf("Actions.UpdateEnvVariable returned error: %v", err) } const methodName = "UpdateEnvVariable" testBadOptions(t, methodName, func() (err error) { - _, err = client.Actions.UpdateEnvVariable(ctx, 0.0, "\n", input) + _, err = client.Actions.UpdateEnvVariable(ctx, "usr", "1", "\n", input) return err }) testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - return client.Actions.UpdateEnvVariable(ctx, 1, "e", input) + return client.Actions.UpdateEnvVariable(ctx, "usr", "1", "e", input) }) } @@ -680,24 +680,24 @@ func TestActionsService_DeleteEnvVariable(t *testing.T) { client, mux, _, teardown := setup() defer teardown() - mux.HandleFunc("/repositories/1/environments/e/variables/variable", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/repos/usr/1/environments/e/variables/variable", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "DELETE") }) ctx := context.Background() - _, err := client.Actions.DeleteEnvVariable(ctx, 1, "e", "variable") + _, err := client.Actions.DeleteEnvVariable(ctx, "usr", "1", "e", "variable") if err != nil { t.Errorf("Actions.DeleteEnvVariable returned error: %v", err) } const methodName = "DeleteEnvVariable" testBadOptions(t, methodName, func() (err error) { - _, err = client.Actions.DeleteEnvVariable(ctx, 0.0, "\n", "\n") + _, err = client.Actions.DeleteEnvVariable(ctx, "usr", "0", "\n", "\n") return err }) testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { - return client.Actions.DeleteEnvVariable(ctx, 1, "r", "variable") + return client.Actions.DeleteEnvVariable(ctx, "usr", "1", "r", "variable") }) } diff --git a/github/admin.go b/github/admin.go index c1f7066c7ad..e93c2266bd1 100644 --- a/github/admin.go +++ b/github/admin.go @@ -82,7 +82,7 @@ func (m Enterprise) String() string { // UpdateUserLDAPMapping updates the mapping between a GitHub user and an LDAP user. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-user +// GitHub API docs: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-user // //meta:operation PATCH /admin/ldap/users/{username}/mapping func (s *AdminService) UpdateUserLDAPMapping(ctx context.Context, user string, mapping *UserLDAPMapping) (*UserLDAPMapping, *Response, error) { @@ -103,7 +103,7 @@ func (s *AdminService) UpdateUserLDAPMapping(ctx context.Context, user string, m // UpdateTeamLDAPMapping updates the mapping between a GitHub team and an LDAP group. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-team +// GitHub API docs: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-team // //meta:operation PATCH /admin/ldap/teams/{team_id}/mapping func (s *AdminService) UpdateTeamLDAPMapping(ctx context.Context, team int64, mapping *TeamLDAPMapping) (*TeamLDAPMapping, *Response, error) { diff --git a/github/admin_orgs.go b/github/admin_orgs.go index e1b3641e003..cb11fe47f42 100644 --- a/github/admin_orgs.go +++ b/github/admin_orgs.go @@ -22,7 +22,7 @@ type createOrgRequest struct { // Note that only a subset of the org fields are used and org must // not be nil. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/orgs#create-an-organization +// GitHub API docs: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/orgs#create-an-organization // //meta:operation POST /admin/organizations func (s *AdminService) CreateOrg(ctx context.Context, org *Organization, admin string) (*Organization, *Response, error) { @@ -61,7 +61,7 @@ type RenameOrgResponse struct { // RenameOrg renames an organization in GitHub Enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/orgs#update-an-organization-name +// GitHub API docs: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/orgs#update-an-organization-name // //meta:operation PATCH /admin/organizations/{org} func (s *AdminService) RenameOrg(ctx context.Context, org *Organization, newName string) (*RenameOrgResponse, *Response, error) { @@ -70,7 +70,7 @@ func (s *AdminService) RenameOrg(ctx context.Context, org *Organization, newName // RenameOrgByName renames an organization in GitHub Enterprise using its current name. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/orgs#update-an-organization-name +// GitHub API docs: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/orgs#update-an-organization-name // //meta:operation PATCH /admin/organizations/{org} func (s *AdminService) RenameOrgByName(ctx context.Context, org, newName string) (*RenameOrgResponse, *Response, error) { diff --git a/github/admin_stats.go b/github/admin_stats.go index f26b393e02f..70412625147 100644 --- a/github/admin_stats.go +++ b/github/admin_stats.go @@ -152,7 +152,7 @@ func (s RepoStats) String() string { // Please note that this is only available to site administrators, // otherwise it will error with a 404 not found (instead of 401 or 403). // -// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/admin-stats#get-all-statistics +// GitHub API docs: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/admin-stats#get-all-statistics // //meta:operation GET /enterprise/stats/all func (s *AdminService) GetAdminStats(ctx context.Context) (*AdminStats, *Response, error) { diff --git a/github/admin_users.go b/github/admin_users.go index e134ff34dbf..82e568a0ac6 100644 --- a/github/admin_users.go +++ b/github/admin_users.go @@ -20,7 +20,7 @@ type CreateUserRequest struct { // CreateUser creates a new user in GitHub Enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#create-a-user +// GitHub API docs: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/users#create-a-user // //meta:operation POST /admin/users func (s *AdminService) CreateUser(ctx context.Context, userReq CreateUserRequest) (*User, *Response, error) { @@ -42,7 +42,7 @@ func (s *AdminService) CreateUser(ctx context.Context, userReq CreateUserRequest // DeleteUser deletes a user in GitHub Enterprise. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#delete-a-user +// GitHub API docs: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/users#delete-a-user // //meta:operation DELETE /admin/users/{username} func (s *AdminService) DeleteUser(ctx context.Context, username string) (*Response, error) { @@ -95,7 +95,7 @@ type UserAuthorization struct { // CreateUserImpersonation creates an impersonation OAuth token. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#create-an-impersonation-oauth-token +// GitHub API docs: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/users#create-an-impersonation-oauth-token // //meta:operation POST /admin/users/{username}/authorizations func (s *AdminService) CreateUserImpersonation(ctx context.Context, username string, opts *ImpersonateUserOptions) (*UserAuthorization, *Response, error) { @@ -117,7 +117,7 @@ func (s *AdminService) CreateUserImpersonation(ctx context.Context, username str // DeleteUserImpersonation deletes an impersonation OAuth token. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#delete-an-impersonation-oauth-token +// GitHub API docs: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/users#delete-an-impersonation-oauth-token // //meta:operation DELETE /admin/users/{username}/authorizations func (s *AdminService) DeleteUserImpersonation(ctx context.Context, username string) (*Response, error) { diff --git a/github/authorizations.go b/github/authorizations.go index 931b77299b0..9bfff7330ab 100644 --- a/github/authorizations.go +++ b/github/authorizations.go @@ -257,7 +257,7 @@ func (s *AuthorizationsService) DeleteGrant(ctx context.Context, clientID, acces // you can e.g. create or delete a user's public SSH key. NOTE: creating a // new token automatically revokes an existing one. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#create-an-impersonation-oauth-token +// GitHub API docs: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/users#create-an-impersonation-oauth-token // //meta:operation POST /admin/users/{username}/authorizations func (s *AuthorizationsService) CreateImpersonation(ctx context.Context, username string, authReq *AuthorizationRequest) (*Authorization, *Response, error) { @@ -279,7 +279,7 @@ func (s *AuthorizationsService) CreateImpersonation(ctx context.Context, usernam // // NOTE: there can be only one at a time. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#delete-an-impersonation-oauth-token +// GitHub API docs: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/users#delete-an-impersonation-oauth-token // //meta:operation DELETE /admin/users/{username}/authorizations func (s *AuthorizationsService) DeleteImpersonation(ctx context.Context, username string) (*Response, error) { diff --git a/github/copilot.go b/github/copilot.go index 50e05253ce5..2697b71850c 100644 --- a/github/copilot.go +++ b/github/copilot.go @@ -132,7 +132,7 @@ func (cp *CopilotSeatDetails) GetOrganization() (*Organization, bool) { // GetCopilotBilling gets Copilot for Business billing information and settings for an organization. // -// GitHub API docs: https://docs.github.com/rest/copilot/copilot-business#get-copilot-business-seat-information-and-settings-for-an-organization +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management#get-copilot-seat-information-and-settings-for-an-organization // //meta:operation GET /orgs/{org}/copilot/billing func (s *CopilotService) GetCopilotBilling(ctx context.Context, org string) (*CopilotOrganizationDetails, *Response, error) { @@ -156,7 +156,7 @@ func (s *CopilotService) GetCopilotBilling(ctx context.Context, org string) (*Co // // To paginate through all seats, populate 'Page' with the number of the last page. // -// GitHub API docs: https://docs.github.com/rest/copilot/copilot-business#list-all-copilot-business-seat-assignments-for-an-organization +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management#list-all-copilot-seat-assignments-for-an-organization // //meta:operation GET /orgs/{org}/copilot/billing/seats func (s *CopilotService) ListCopilotSeats(ctx context.Context, org string, opts *ListOptions) (*ListCopilotSeatsResponse, *Response, error) { @@ -182,7 +182,7 @@ func (s *CopilotService) ListCopilotSeats(ctx context.Context, org string, opts // AddCopilotTeams adds teams to the Copilot for Business subscription for an organization. // -// GitHub API docs: https://docs.github.com/rest/copilot/copilot-business#add-teams-to-the-copilot-business-subscription-for-an-organization +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management#add-teams-to-the-copilot-subscription-for-an-organization // //meta:operation POST /orgs/{org}/copilot/billing/selected_teams func (s *CopilotService) AddCopilotTeams(ctx context.Context, org string, teamNames []string) (*SeatAssignments, *Response, error) { @@ -210,7 +210,7 @@ func (s *CopilotService) AddCopilotTeams(ctx context.Context, org string, teamNa // RemoveCopilotTeams removes teams from the Copilot for Business subscription for an organization. // -// GitHub API docs: https://docs.github.com/rest/copilot/copilot-business#remove-teams-from-the-copilot-business-subscription-for-an-organization +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management#remove-teams-from-the-copilot-subscription-for-an-organization // //meta:operation DELETE /orgs/{org}/copilot/billing/selected_teams func (s *CopilotService) RemoveCopilotTeams(ctx context.Context, org string, teamNames []string) (*SeatCancellations, *Response, error) { @@ -238,7 +238,7 @@ func (s *CopilotService) RemoveCopilotTeams(ctx context.Context, org string, tea // AddCopilotUsers adds users to the Copilot for Business subscription for an organization // -// GitHub API docs: https://docs.github.com/rest/copilot/copilot-business#add-users-to-the-copilot-business-subscription-for-an-organization +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management#add-users-to-the-copilot-subscription-for-an-organization // //meta:operation POST /orgs/{org}/copilot/billing/selected_users func (s *CopilotService) AddCopilotUsers(ctx context.Context, org string, users []string) (*SeatAssignments, *Response, error) { @@ -266,7 +266,7 @@ func (s *CopilotService) AddCopilotUsers(ctx context.Context, org string, users // RemoveCopilotUsers removes users from the Copilot for Business subscription for an organization. // -// GitHub API docs: https://docs.github.com/rest/copilot/copilot-business#remove-users-from-the-copilot-business-subscription-for-an-organization +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management#remove-users-from-the-copilot-subscription-for-an-organization // //meta:operation DELETE /orgs/{org}/copilot/billing/selected_users func (s *CopilotService) RemoveCopilotUsers(ctx context.Context, org string, users []string) (*SeatCancellations, *Response, error) { @@ -294,7 +294,7 @@ func (s *CopilotService) RemoveCopilotUsers(ctx context.Context, org string, use // GetSeatDetails gets Copilot for Business seat assignment details for a user. // -// GitHub API docs: https://docs.github.com/rest/copilot/copilot-business#get-copilot-business-seat-assignment-details-for-a-user +// GitHub API docs: https://docs.github.com/rest/copilot/copilot-user-management#get-copilot-seat-assignment-details-for-a-user // //meta:operation GET /orgs/{org}/members/{username}/copilot func (s *CopilotService) GetSeatDetails(ctx context.Context, org, user string) (*CopilotSeatDetails, *Response, error) { diff --git a/github/repos_autolinks.go b/github/repos_autolinks.go index 200605aa0b2..6c209b2d5e8 100644 --- a/github/repos_autolinks.go +++ b/github/repos_autolinks.go @@ -28,7 +28,7 @@ type Autolink struct { // ListAutolinks returns a list of autolinks configured for the given repository. // Information about autolinks are only available to repository administrators. // -// GitHub API docs: https://docs.github.com/rest/repos/autolinks#list-all-autolinks-of-a-repository +// GitHub API docs: https://docs.github.com/rest/repos/autolinks#get-all-autolinks-of-a-repository // //meta:operation GET /repos/{owner}/{repo}/autolinks func (s *RepositoriesService) ListAutolinks(ctx context.Context, owner, repo string, opts *ListOptions) ([]*Autolink, *Response, error) { diff --git a/github/repos_prereceive_hooks.go b/github/repos_prereceive_hooks.go index b1d3f3c818d..7d85c873620 100644 --- a/github/repos_prereceive_hooks.go +++ b/github/repos_prereceive_hooks.go @@ -24,7 +24,7 @@ func (p PreReceiveHook) String() string { // ListPreReceiveHooks lists all pre-receive hooks for the specified repository. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/repo-pre-receive-hooks#list-pre-receive-hooks-for-a-repository +// GitHub API docs: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/repo-pre-receive-hooks#list-pre-receive-hooks-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/pre-receive-hooks func (s *RepositoriesService) ListPreReceiveHooks(ctx context.Context, owner, repo string, opts *ListOptions) ([]*PreReceiveHook, *Response, error) { @@ -53,7 +53,7 @@ func (s *RepositoriesService) ListPreReceiveHooks(ctx context.Context, owner, re // GetPreReceiveHook returns a single specified pre-receive hook. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/repo-pre-receive-hooks#get-a-pre-receive-hook-for-a-repository +// GitHub API docs: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/repo-pre-receive-hooks#get-a-pre-receive-hook-for-a-repository // //meta:operation GET /repos/{owner}/{repo}/pre-receive-hooks/{pre_receive_hook_id} func (s *RepositoriesService) GetPreReceiveHook(ctx context.Context, owner, repo string, id int64) (*PreReceiveHook, *Response, error) { @@ -77,7 +77,7 @@ func (s *RepositoriesService) GetPreReceiveHook(ctx context.Context, owner, repo // UpdatePreReceiveHook updates a specified pre-receive hook. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/repo-pre-receive-hooks#update-pre-receive-hook-enforcement-for-a-repository +// GitHub API docs: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/repo-pre-receive-hooks#update-pre-receive-hook-enforcement-for-a-repository // //meta:operation PATCH /repos/{owner}/{repo}/pre-receive-hooks/{pre_receive_hook_id} func (s *RepositoriesService) UpdatePreReceiveHook(ctx context.Context, owner, repo string, id int64, hook *PreReceiveHook) (*PreReceiveHook, *Response, error) { @@ -101,7 +101,7 @@ func (s *RepositoriesService) UpdatePreReceiveHook(ctx context.Context, owner, r // DeletePreReceiveHook deletes a specified pre-receive hook. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/repo-pre-receive-hooks#remove-pre-receive-hook-enforcement-for-a-repository +// GitHub API docs: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/repo-pre-receive-hooks#remove-pre-receive-hook-enforcement-for-a-repository // //meta:operation DELETE /repos/{owner}/{repo}/pre-receive-hooks/{pre_receive_hook_id} func (s *RepositoriesService) DeletePreReceiveHook(ctx context.Context, owner, repo string, id int64) (*Response, error) { diff --git a/github/users_administration.go b/github/users_administration.go index 5b9e1de8c60..2c86af7336d 100644 --- a/github/users_administration.go +++ b/github/users_administration.go @@ -12,7 +12,7 @@ import ( // PromoteSiteAdmin promotes a user to a site administrator of a GitHub Enterprise instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#promote-a-user-to-be-a-site-administrator +// GitHub API docs: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/users#promote-a-user-to-be-a-site-administrator // //meta:operation PUT /users/{username}/site_admin func (s *UsersService) PromoteSiteAdmin(ctx context.Context, user string) (*Response, error) { @@ -28,7 +28,7 @@ func (s *UsersService) PromoteSiteAdmin(ctx context.Context, user string) (*Resp // DemoteSiteAdmin demotes a user from site administrator of a GitHub Enterprise instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#demote-a-site-administrator +// GitHub API docs: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/users#demote-a-site-administrator // //meta:operation DELETE /users/{username}/site_admin func (s *UsersService) DemoteSiteAdmin(ctx context.Context, user string) (*Response, error) { @@ -49,7 +49,7 @@ type UserSuspendOptions struct { // Suspend a user on a GitHub Enterprise instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#suspend-a-user +// GitHub API docs: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/users#suspend-a-user // //meta:operation PUT /users/{username}/suspended func (s *UsersService) Suspend(ctx context.Context, user string, opts *UserSuspendOptions) (*Response, error) { @@ -65,7 +65,7 @@ func (s *UsersService) Suspend(ctx context.Context, user string, opts *UserSuspe // Unsuspend a user on a GitHub Enterprise instance. // -// GitHub API docs: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#unsuspend-a-user +// GitHub API docs: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/users#unsuspend-a-user // //meta:operation DELETE /users/{username}/suspended func (s *UsersService) Unsuspend(ctx context.Context, user string) (*Response, error) { diff --git a/openapi_operations.yaml b/openapi_operations.yaml index 53fe8c5fe52..2cc8bde30a7 100644 --- a/openapi_operations.yaml +++ b/openapi_operations.yaml @@ -48,260 +48,260 @@ operation_overrides: documentation_url: https://docs.github.com/rest/pages/pages#request-a-github-pages-build - name: GET /repos/{owner}/{repo}/pages/builds/{build_id} documentation_url: https://docs.github.com/rest/pages/pages#get-github-pages-build -openapi_commit: 6922a6cfe785e1069e93d6e501805cf6e1891076 +openapi_commit: b65cdcaa8a1453dd394cb898b35696a2130f4504 openapi_operations: - name: GET / documentation_url: https://docs.github.com/rest/meta/meta#github-api-root openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /admin/hooks - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/global-webhooks#list-global-webhooks + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/global-webhooks#list-global-webhooks openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /admin/hooks - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/global-webhooks#create-a-global-webhook + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/global-webhooks#create-a-global-webhook openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /admin/hooks/{hook_id} - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/global-webhooks#delete-a-global-webhook + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/global-webhooks#delete-a-global-webhook openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /admin/hooks/{hook_id} - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/global-webhooks#get-a-global-webhook + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/global-webhooks#get-a-global-webhook openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /admin/hooks/{hook_id} - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/global-webhooks#update-a-global-webhook + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/global-webhooks#update-a-global-webhook openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /admin/hooks/{hook_id}/pings - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/global-webhooks#ping-a-global-webhook + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/global-webhooks#ping-a-global-webhook openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /admin/keys - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#list-public-keys + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/users#list-public-keys openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /admin/keys/{key_ids} - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#delete-a-public-key + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/users#delete-a-public-key openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /admin/ldap/teams/{team_id}/mapping - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-team + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-team openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /admin/ldap/teams/{team_id}/sync - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/ldap#sync-ldap-mapping-for-a-team + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/ldap#sync-ldap-mapping-for-a-team openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /admin/ldap/users/{username}/mapping - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-user + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/ldap#update-ldap-mapping-for-a-user openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /admin/ldap/users/{username}/sync - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/ldap#sync-ldap-mapping-for-a-user + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/ldap#sync-ldap-mapping-for-a-user openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /admin/organizations - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/orgs#create-an-organization + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/orgs#create-an-organization openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /admin/organizations/{org} - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/orgs#update-an-organization-name + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/orgs#update-an-organization-name openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /admin/pre-receive-environments - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/pre-receive-environments#list-pre-receive-environments + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/pre-receive-environments#list-pre-receive-environments openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /admin/pre-receive-environments - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/pre-receive-environments#create-a-pre-receive-environment + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/pre-receive-environments#create-a-pre-receive-environment openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /admin/pre-receive-environments/{pre_receive_environment_id} - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/pre-receive-environments#delete-a-pre-receive-environment + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/pre-receive-environments#delete-a-pre-receive-environment openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /admin/pre-receive-environments/{pre_receive_environment_id} - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/pre-receive-environments#get-a-pre-receive-environment + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/pre-receive-environments#get-a-pre-receive-environment openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /admin/pre-receive-environments/{pre_receive_environment_id} - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/pre-receive-environments#update-a-pre-receive-environment + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/pre-receive-environments#update-a-pre-receive-environment openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /admin/pre-receive-environments/{pre_receive_environment_id}/downloads - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/pre-receive-environments#start-a-pre-receive-environment-download + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/pre-receive-environments#start-a-pre-receive-environment-download openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /admin/pre-receive-environments/{pre_receive_environment_id}/downloads/latest - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/pre-receive-environments#get-the-download-status-for-a-pre-receive-environment + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/pre-receive-environments#get-the-download-status-for-a-pre-receive-environment openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /admin/pre-receive-hooks - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/pre-receive-hooks#list-pre-receive-hooks + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/pre-receive-hooks#list-pre-receive-hooks openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /admin/pre-receive-hooks - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/pre-receive-hooks#create-a-pre-receive-hook + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/pre-receive-hooks#create-a-pre-receive-hook openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /admin/pre-receive-hooks/{pre_receive_hook_id} - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/pre-receive-hooks#delete-a-pre-receive-hook + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/pre-receive-hooks#delete-a-pre-receive-hook openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /admin/pre-receive-hooks/{pre_receive_hook_id} - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/pre-receive-hooks#get-a-pre-receive-hook + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/pre-receive-hooks#get-a-pre-receive-hook openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /admin/pre-receive-hooks/{pre_receive_hook_id} - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/pre-receive-hooks#update-a-pre-receive-hook + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/pre-receive-hooks#update-a-pre-receive-hook openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /admin/tokens - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#list-personal-access-tokens + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/users#list-personal-access-tokens openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /admin/tokens/{token_id} - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#delete-a-personal-access-token + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/users#delete-a-personal-access-token openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /admin/users - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#create-a-user + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/users#create-a-user openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /admin/users/{username} - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#delete-a-user + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/users#delete-a-user openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /admin/users/{username} - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#update-the-username-for-a-user + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/users#update-the-username-for-a-user openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /admin/users/{username}/authorizations - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#delete-an-impersonation-oauth-token + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/users#delete-an-impersonation-oauth-token openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /admin/users/{username}/authorizations - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#create-an-impersonation-oauth-token + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/users#create-an-impersonation-oauth-token openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /advisories documentation_url: https://docs.github.com/rest/security-advisories/global-advisories#list-global-security-advisories openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /advisories/{ghsa_id} documentation_url: https://docs.github.com/rest/security-advisories/global-advisories#get-a-global-security-advisory openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /app documentation_url: https://docs.github.com/rest/apps/apps#get-the-authenticated-app openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /app-manifests/{code}/conversions documentation_url: https://docs.github.com/rest/apps/apps#create-a-github-app-from-a-manifest openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /app/hook/config documentation_url: https://docs.github.com/rest/apps/webhooks#get-a-webhook-configuration-for-an-app openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /app/hook/config documentation_url: https://docs.github.com/rest/apps/webhooks#update-a-webhook-configuration-for-an-app openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /app/hook/deliveries documentation_url: https://docs.github.com/rest/apps/webhooks#list-deliveries-for-an-app-webhook openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /app/hook/deliveries/{delivery_id} documentation_url: https://docs.github.com/rest/apps/webhooks#get-a-delivery-for-an-app-webhook openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /app/hook/deliveries/{delivery_id}/attempts documentation_url: https://docs.github.com/rest/apps/webhooks#redeliver-a-delivery-for-an-app-webhook openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /app/installation-requests documentation_url: https://docs.github.com/rest/apps/apps#list-installation-requests-for-the-authenticated-app openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /app/installations documentation_url: https://docs.github.com/rest/apps/apps#list-installations-for-the-authenticated-app openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /app/installations/{installation_id} documentation_url: https://docs.github.com/rest/apps/apps#delete-an-installation-for-the-authenticated-app openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /app/installations/{installation_id} documentation_url: https://docs.github.com/rest/apps/apps#get-an-installation-for-the-authenticated-app openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /app/installations/{installation_id}/access_tokens documentation_url: https://docs.github.com/rest/apps/apps#create-an-installation-access-token-for-an-app openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /app/installations/{installation_id}/suspended documentation_url: https://docs.github.com/rest/apps/apps#unsuspend-an-app-installation openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /app/installations/{installation_id}/suspended documentation_url: https://docs.github.com/rest/apps/apps#suspend-an-app-installation openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /applications/grants - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/oauth-authorizations/oauth-authorizations#list-your-grants + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/oauth-authorizations/oauth-authorizations#list-your-grants openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /applications/grants/{grant_id} - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/oauth-authorizations/oauth-authorizations#delete-a-grant + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/oauth-authorizations/oauth-authorizations#delete-a-grant openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /applications/grants/{grant_id} - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/oauth-authorizations/oauth-authorizations#get-a-single-grant + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/oauth-authorizations/oauth-authorizations#get-a-single-grant openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /applications/{client_id}/grant documentation_url: https://docs.github.com/rest/apps/oauth-applications#delete-an-app-authorization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /applications/{client_id}/grants/{access_token} documentation_url: https://docs.github.com/enterprise-server@3.3/rest/reference/apps#revoke-a-grant-for-an-application openapi_files: @@ -311,25 +311,25 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /applications/{client_id}/token documentation_url: https://docs.github.com/rest/apps/oauth-applications#reset-a-token openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /applications/{client_id}/token documentation_url: https://docs.github.com/rest/apps/oauth-applications#check-a-token openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /applications/{client_id}/token/scoped documentation_url: https://docs.github.com/rest/apps/apps#create-a-scoped-access-token openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /applications/{client_id}/tokens/{access_token} documentation_url: https://docs.github.com/enterprise-server@3.3/rest/reference/apps#revoke-an-authorization-for-an-application openapi_files: @@ -347,7 +347,7 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /assignments/{assignment_id} documentation_url: https://docs.github.com/rest/classroom/classroom#get-an-assignment openapi_files: @@ -364,33 +364,33 @@ openapi_operations: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - name: GET /authorizations - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/oauth-authorizations/oauth-authorizations#list-your-authorizations + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/oauth-authorizations/oauth-authorizations#list-your-authorizations openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /authorizations - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/oauth-authorizations/oauth-authorizations#create-a-new-authorization + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/oauth-authorizations/oauth-authorizations#create-a-new-authorization openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /authorizations/clients/{client_id} - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/oauth-authorizations/oauth-authorizations#get-or-create-an-authorization-for-a-specific-app + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/oauth-authorizations/oauth-authorizations#get-or-create-an-authorization-for-a-specific-app openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /authorizations/clients/{client_id}/{fingerprint} - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/oauth-authorizations/oauth-authorizations#get-or-create-an-authorization-for-a-specific-app-and-fingerprint + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/oauth-authorizations/oauth-authorizations#get-or-create-an-authorization-for-a-specific-app-and-fingerprint openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /authorizations/{authorization_id} - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/oauth-authorizations/oauth-authorizations#delete-an-authorization + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/oauth-authorizations/oauth-authorizations#delete-an-authorization openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /authorizations/{authorization_id} - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/oauth-authorizations/oauth-authorizations#get-a-single-authorization + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/oauth-authorizations/oauth-authorizations#get-a-single-authorization openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /authorizations/{authorization_id} - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/oauth-authorizations/oauth-authorizations#update-an-existing-authorization + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/oauth-authorizations/oauth-authorizations#update-an-existing-authorization openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /classrooms documentation_url: https://docs.github.com/rest/classroom/classroom#list-classrooms openapi_files: @@ -411,100 +411,100 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /codes_of_conduct/{key} documentation_url: https://docs.github.com/rest/codes-of-conduct/codes-of-conduct#get-a-code-of-conduct openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /emojis documentation_url: https://docs.github.com/rest/emojis/emojis#get-emojis openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /enterprise-installation/{enterprise_or_org}/server-statistics documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/admin-stats#get-github-enterprise-server-statistics openapi_files: - descriptions/ghec/ghec.json - name: DELETE /enterprise/announcement - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/announcement#remove-the-global-announcement-banner + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/announcement#remove-the-global-announcement-banner openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /enterprise/announcement - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/announcement#get-the-global-announcement-banner + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/announcement#get-the-global-announcement-banner openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /enterprise/announcement - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/announcement#set-the-global-announcement-banner + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/announcement#set-the-global-announcement-banner openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /enterprise/settings/license - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/license#get-license-information + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/license#get-license-information openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /enterprise/stats/all - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/admin-stats#get-all-statistics + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/admin-stats#get-all-statistics openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /enterprise/stats/comments - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/admin-stats#get-comment-statistics + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/admin-stats#get-comment-statistics openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /enterprise/stats/gists - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/admin-stats#get-gist-statistics + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/admin-stats#get-gist-statistics openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /enterprise/stats/hooks - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/admin-stats#get-hooks-statistics + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/admin-stats#get-hooks-statistics openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /enterprise/stats/issues - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/admin-stats#get-issue-statistics + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/admin-stats#get-issue-statistics openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /enterprise/stats/milestones - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/admin-stats#get-milestone-statistics + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/admin-stats#get-milestone-statistics openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /enterprise/stats/orgs - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/admin-stats#get-organization-statistics + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/admin-stats#get-organization-statistics openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /enterprise/stats/pages - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/admin-stats#get-pages-statistics + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/admin-stats#get-pages-statistics openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /enterprise/stats/pulls - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/admin-stats#get-pull-request-statistics + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/admin-stats#get-pull-request-statistics openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /enterprise/stats/repos - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/admin-stats#get-repository-statistics + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/admin-stats#get-repository-statistics openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /enterprise/stats/security-products - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/admin-stats#get-security-products-statistics + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/admin-stats#get-security-products-statistics openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /enterprise/stats/users - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/admin-stats#get-users-statistics + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/admin-stats#get-users-statistics openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /enterprises/{enterprise}/actions/cache/usage documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/cache#get-github-actions-cache-usage-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /enterprises/{enterprise}/actions/cache/usage-policy - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/actions/cache#get-github-actions-cache-usage-policy-for-an-enterprise + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/actions/cache#get-github-actions-cache-usage-policy-for-an-enterprise openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /enterprises/{enterprise}/actions/cache/usage-policy - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/actions/cache#set-github-actions-cache-usage-policy-for-an-enterprise + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/actions/cache#set-github-actions-cache-usage-policy-for-an-enterprise openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /enterprises/{enterprise}/actions/oidc/customization/issuer documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/oidc#set-the-github-actions-oidc-custom-issuer-policy-for-an-enterprise openapi_files: @@ -513,177 +513,177 @@ openapi_operations: documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/permissions#get-github-actions-permissions-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /enterprises/{enterprise}/actions/permissions documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/permissions#set-github-actions-permissions-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /enterprises/{enterprise}/actions/permissions/organizations documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/permissions#list-selected-organizations-enabled-for-github-actions-in-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /enterprises/{enterprise}/actions/permissions/organizations documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/permissions#set-selected-organizations-enabled-for-github-actions-in-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /enterprises/{enterprise}/actions/permissions/organizations/{org_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/permissions#disable-a-selected-organization-for-github-actions-in-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /enterprises/{enterprise}/actions/permissions/organizations/{org_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/permissions#enable-a-selected-organization-for-github-actions-in-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /enterprises/{enterprise}/actions/permissions/selected-actions documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /enterprises/{enterprise}/actions/permissions/selected-actions documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /enterprises/{enterprise}/actions/permissions/workflow documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/permissions#get-default-workflow-permissions-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /enterprises/{enterprise}/actions/permissions/workflow documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/permissions#set-default-workflow-permissions-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /enterprises/{enterprise}/actions/runner-groups documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#list-self-hosted-runner-groups-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /enterprises/{enterprise}/actions/runner-groups documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#create-a-self-hosted-runner-group-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /enterprises/{enterprise}/actions/runner-groups/{runner_group_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#delete-a-self-hosted-runner-group-from-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /enterprises/{enterprise}/actions/runner-groups/{runner_group_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#get-a-self-hosted-runner-group-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /enterprises/{enterprise}/actions/runner-groups/{runner_group_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#update-a-self-hosted-runner-group-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#list-organization-access-to-a-self-hosted-runner-group-in-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#set-organization-access-for-a-self-hosted-runner-group-in-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations/{org_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#remove-organization-access-to-a-self-hosted-runner-group-in-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations/{org_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#add-organization-access-to-a-self-hosted-runner-group-in-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#list-self-hosted-runners-in-a-group-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#set-self-hosted-runners-in-a-group-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners/{runner_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#remove-a-self-hosted-runner-from-a-group-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners/{runner_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#add-a-self-hosted-runner-to-a-group-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /enterprises/{enterprise}/actions/runners documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runners#list-self-hosted-runners-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /enterprises/{enterprise}/actions/runners/downloads documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runners#list-runner-applications-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /enterprises/{enterprise}/actions/runners/generate-jitconfig documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runners#create-configuration-for-a-just-in-time-runner-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /enterprises/{enterprise}/actions/runners/registration-token documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runners#create-a-registration-token-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /enterprises/{enterprise}/actions/runners/remove-token documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runners#create-a-remove-token-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /enterprises/{enterprise}/actions/runners/{runner_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runners#delete-a-self-hosted-runner-from-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /enterprises/{enterprise}/actions/runners/{runner_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runners#get-a-self-hosted-runner-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /enterprises/{enterprise}/actions/runners/{runner_id}/labels documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runners#remove-all-custom-labels-from-a-self-hosted-runner-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /enterprises/{enterprise}/actions/runners/{runner_id}/labels documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runners#list-labels-for-a-self-hosted-runner-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /enterprises/{enterprise}/actions/runners/{runner_id}/labels documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runners#add-custom-labels-to-a-self-hosted-runner-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /enterprises/{enterprise}/actions/runners/{runner_id}/labels documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runners#set-custom-labels-for-a-self-hosted-runner-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /enterprises/{enterprise}/actions/runners/{runner_id}/labels/{name} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runners#remove-a-custom-label-from-a-self-hosted-runner-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /enterprises/{enterprise}/announcement documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/announcement-banners/enterprises#remove-announcement-banner-from-enterprise openapi_files: @@ -700,22 +700,22 @@ openapi_operations: documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/audit-log#get-the-audit-log-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /enterprises/{enterprise}/code-scanning/alerts documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/code-scanning/code-scanning#list-code-scanning-alerts-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /enterprises/{enterprise}/code_security_and_analysis documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/code-security-and-analysis#get-code-security-and-analysis-features-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /enterprises/{enterprise}/code_security_and_analysis documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/code-security-and-analysis#update-code-security-and-analysis-features-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /enterprises/{enterprise}/consumed-licenses documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/license#list-enterprise-consumed-licenses openapi_files: @@ -725,7 +725,7 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /enterprises/{enterprise}/license-sync-status documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/license#get-a-license-sync-status openapi_files: @@ -735,7 +735,7 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /enterprises/{enterprise}/settings/billing/actions documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/billing#get-github-actions-billing-for-an-enterprise openapi_files: @@ -744,7 +744,7 @@ openapi_operations: documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/billing#get-github-advanced-security-active-committers-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /enterprises/{enterprise}/settings/billing/packages documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/billing#get-github-packages-billing-for-an-enterprise openapi_files: @@ -757,207 +757,247 @@ openapi_operations: documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/code-security-and-analysis#enable-or-disable-a-security-feature openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /events documentation_url: https://docs.github.com/rest/activity/events#list-public-events openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /feeds documentation_url: https://docs.github.com/rest/activity/feeds#get-feeds openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /gists documentation_url: https://docs.github.com/rest/gists/gists#list-gists-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /gists documentation_url: https://docs.github.com/rest/gists/gists#create-a-gist openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /gists/public documentation_url: https://docs.github.com/rest/gists/gists#list-public-gists openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /gists/starred documentation_url: https://docs.github.com/rest/gists/gists#list-starred-gists openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /gists/{gist_id} documentation_url: https://docs.github.com/rest/gists/gists#delete-a-gist openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /gists/{gist_id} documentation_url: https://docs.github.com/rest/gists/gists#get-a-gist openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /gists/{gist_id} documentation_url: https://docs.github.com/rest/gists/gists#update-a-gist openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /gists/{gist_id}/comments documentation_url: https://docs.github.com/rest/gists/comments#list-gist-comments openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /gists/{gist_id}/comments documentation_url: https://docs.github.com/rest/gists/comments#create-a-gist-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /gists/{gist_id}/comments/{comment_id} documentation_url: https://docs.github.com/rest/gists/comments#delete-a-gist-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /gists/{gist_id}/comments/{comment_id} documentation_url: https://docs.github.com/rest/gists/comments#get-a-gist-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /gists/{gist_id}/comments/{comment_id} documentation_url: https://docs.github.com/rest/gists/comments#update-a-gist-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /gists/{gist_id}/commits documentation_url: https://docs.github.com/rest/gists/gists#list-gist-commits openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /gists/{gist_id}/forks documentation_url: https://docs.github.com/rest/gists/gists#list-gist-forks openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /gists/{gist_id}/forks documentation_url: https://docs.github.com/rest/gists/gists#fork-a-gist openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /gists/{gist_id}/star documentation_url: https://docs.github.com/rest/gists/gists#unstar-a-gist openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /gists/{gist_id}/star documentation_url: https://docs.github.com/rest/gists/gists#check-if-a-gist-is-starred openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /gists/{gist_id}/star documentation_url: https://docs.github.com/rest/gists/gists#star-a-gist openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /gists/{gist_id}/{sha} documentation_url: https://docs.github.com/rest/gists/gists#get-a-gist-revision openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /gitignore/templates documentation_url: https://docs.github.com/rest/gitignore/gitignore#get-all-gitignore-templates openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /gitignore/templates/{name} documentation_url: https://docs.github.com/rest/gitignore/gitignore#get-a-gitignore-template openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /installation/repositories documentation_url: https://docs.github.com/rest/apps/installations#list-repositories-accessible-to-the-app-installation openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /installation/token documentation_url: https://docs.github.com/rest/apps/installations#revoke-an-installation-access-token openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /issues documentation_url: https://docs.github.com/rest/issues/issues#list-issues-assigned-to-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /licenses documentation_url: https://docs.github.com/rest/licenses/licenses#get-all-commonly-used-licenses openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /licenses/{license} documentation_url: https://docs.github.com/rest/licenses/licenses#get-a-license openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json + - name: DELETE /manage/v1/access/ssh + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/manage-ghes#delete-ssh-key + openapi_files: + - descriptions/ghes-3.12/ghes-3.12.json + - name: GET /manage/v1/access/ssh + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/manage-ghes#get-ssh-keys + openapi_files: + - descriptions/ghes-3.12/ghes-3.12.json + - name: POST /manage/v1/access/ssh + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/manage-ghes#set-ssh-key + openapi_files: + - descriptions/ghes-3.12/ghes-3.12.json + - name: GET /manage/v1/checks/system-requirements + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/manage-ghes#get-system-requirements-check-results-on-configured-nodes + openapi_files: + - descriptions/ghes-3.12/ghes-3.12.json + - name: POST /manage/v1/config/init + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/manage-ghes#initialize-instance-configuration-with-license-upload + openapi_files: + - descriptions/ghes-3.12/ghes-3.12.json + - name: GET /manage/v1/config/license + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/manage-ghes#get-the-enterprise-license-information + openapi_files: + - descriptions/ghes-3.12/ghes-3.12.json + - name: PUT /manage/v1/config/license + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/manage-ghes#upload-an-enterprise-license + openapi_files: + - descriptions/ghes-3.12/ghes-3.12.json + - name: GET /manage/v1/config/license/check + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/manage-ghes#check-a-license + openapi_files: + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /manage/v1/config/nodes - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/manage-ghes#get-ghes-node-metadata-for-all-nodes + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/manage-ghes#get-ghes-node-metadata-for-all-nodes openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json + - name: GET /manage/v1/config/settings + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/manage-ghes#get-settings + openapi_files: + - descriptions/ghes-3.12/ghes-3.12.json + - name: PUT /manage/v1/config/settings + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/manage-ghes#set-settings + openapi_files: + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /manage/v1/maintenance - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/manage-ghes#get-the-status-of-maintenance-mode + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/manage-ghes#get-the-status-of-maintenance-mode openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /manage/v1/maintenance - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/manage-ghes#set-the-status-of-maintenance-mode + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/manage-ghes#set-the-status-of-maintenance-mode openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /manage/v1/replication/status - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/manage-ghes#get-the-status-of-services-running-on-all-replica-nodes + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/manage-ghes#get-the-status-of-services-running-on-all-replica-nodes openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /manage/v1/version - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/manage-ghes#get-all-ghes-release-versions-for-all-nodes + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/manage-ghes#get-all-ghes-release-versions-for-all-nodes openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /markdown documentation_url: https://docs.github.com/rest/markdown/markdown#render-a-markdown-document openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /markdown/raw documentation_url: https://docs.github.com/rest/markdown/markdown#render-a-markdown-document-in-raw-mode openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /marketplace_listing/accounts/{account_id} documentation_url: https://docs.github.com/rest/apps/marketplace#get-a-subscription-plan-for-an-account openapi_files: @@ -993,439 +1033,444 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /networks/{owner}/{repo}/events documentation_url: https://docs.github.com/rest/activity/events#list-public-events-for-a-network-of-repositories openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /notifications documentation_url: https://docs.github.com/rest/activity/notifications#list-notifications-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /notifications documentation_url: https://docs.github.com/rest/activity/notifications#mark-notifications-as-read openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json + - name: DELETE /notifications/threads/{thread_id} + documentation_url: https://docs.github.com/rest/activity/notifications#mark-a-thread-as-done + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json - name: GET /notifications/threads/{thread_id} documentation_url: https://docs.github.com/rest/activity/notifications#get-a-thread openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /notifications/threads/{thread_id} documentation_url: https://docs.github.com/rest/activity/notifications#mark-a-thread-as-read openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /notifications/threads/{thread_id}/subscription documentation_url: https://docs.github.com/rest/activity/notifications#delete-a-thread-subscription openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /notifications/threads/{thread_id}/subscription documentation_url: https://docs.github.com/rest/activity/notifications#get-a-thread-subscription-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /notifications/threads/{thread_id}/subscription documentation_url: https://docs.github.com/rest/activity/notifications#set-a-thread-subscription openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /octocat documentation_url: https://docs.github.com/rest/meta/meta#get-octocat openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /organizations documentation_url: https://docs.github.com/rest/orgs/orgs#list-organizations openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /organizations/{organization_id}/custom_roles documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/orgs/custom-roles#deprecated---list-custom-repository-roles-in-an-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /orgs/{org} documentation_url: https://docs.github.com/rest/orgs/orgs#delete-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org} documentation_url: https://docs.github.com/rest/orgs/orgs#get-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /orgs/{org} documentation_url: https://docs.github.com/rest/orgs/orgs#update-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/actions/cache/usage documentation_url: https://docs.github.com/rest/actions/cache#get-github-actions-cache-usage-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/actions/cache/usage-by-repository documentation_url: https://docs.github.com/rest/actions/cache#list-repositories-with-github-actions-cache-usage-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/actions/oidc/customization/sub documentation_url: https://docs.github.com/rest/actions/oidc#get-the-customization-template-for-an-oidc-subject-claim-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /orgs/{org}/actions/oidc/customization/sub documentation_url: https://docs.github.com/rest/actions/oidc#set-the-customization-template-for-an-oidc-subject-claim-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/actions/permissions documentation_url: https://docs.github.com/rest/actions/permissions#get-github-actions-permissions-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /orgs/{org}/actions/permissions documentation_url: https://docs.github.com/rest/actions/permissions#set-github-actions-permissions-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/actions/permissions/repositories documentation_url: https://docs.github.com/rest/actions/permissions#list-selected-repositories-enabled-for-github-actions-in-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /orgs/{org}/actions/permissions/repositories documentation_url: https://docs.github.com/rest/actions/permissions#set-selected-repositories-enabled-for-github-actions-in-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /orgs/{org}/actions/permissions/repositories/{repository_id} documentation_url: https://docs.github.com/rest/actions/permissions#disable-a-selected-repository-for-github-actions-in-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /orgs/{org}/actions/permissions/repositories/{repository_id} documentation_url: https://docs.github.com/rest/actions/permissions#enable-a-selected-repository-for-github-actions-in-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/actions/permissions/selected-actions documentation_url: https://docs.github.com/rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /orgs/{org}/actions/permissions/selected-actions documentation_url: https://docs.github.com/rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/actions/permissions/workflow documentation_url: https://docs.github.com/rest/actions/permissions#get-default-workflow-permissions-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /orgs/{org}/actions/permissions/workflow documentation_url: https://docs.github.com/rest/actions/permissions#set-default-workflow-permissions-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/actions/runner-groups documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#list-self-hosted-runner-groups-for-an-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /orgs/{org}/actions/runner-groups documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#create-a-self-hosted-runner-group-for-an-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /orgs/{org}/actions/runner-groups/{runner_group_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#delete-a-self-hosted-runner-group-from-an-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/actions/runner-groups/{runner_group_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#get-a-self-hosted-runner-group-for-an-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /orgs/{org}/actions/runner-groups/{runner_group_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#update-a-self-hosted-runner-group-for-an-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#list-repository-access-to-a-self-hosted-runner-group-in-an-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#set-repository-access-for-a-self-hosted-runner-group-in-an-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories/{repository_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#remove-repository-access-to-a-self-hosted-runner-group-in-an-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories/{repository_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#add-repository-access-to-a-self-hosted-runner-group-in-an-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/actions/runner-groups/{runner_group_id}/runners documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#list-self-hosted-runners-in-a-group-for-an-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /orgs/{org}/actions/runner-groups/{runner_group_id}/runners documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#set-self-hosted-runners-in-a-group-for-an-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /orgs/{org}/actions/runner-groups/{runner_group_id}/runners/{runner_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#remove-a-self-hosted-runner-from-a-group-for-an-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /orgs/{org}/actions/runner-groups/{runner_group_id}/runners/{runner_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/actions/self-hosted-runner-groups#add-a-self-hosted-runner-to-a-group-for-an-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/actions/runners documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#list-self-hosted-runners-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/actions/runners/downloads documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#list-runner-applications-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /orgs/{org}/actions/runners/generate-jitconfig documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#create-configuration-for-a-just-in-time-runner-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /orgs/{org}/actions/runners/registration-token documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#create-a-registration-token-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /orgs/{org}/actions/runners/remove-token documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#create-a-remove-token-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /orgs/{org}/actions/runners/{runner_id} documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#delete-a-self-hosted-runner-from-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/actions/runners/{runner_id} documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#get-a-self-hosted-runner-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /orgs/{org}/actions/runners/{runner_id}/labels documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#remove-all-custom-labels-from-a-self-hosted-runner-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/actions/runners/{runner_id}/labels documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#list-labels-for-a-self-hosted-runner-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /orgs/{org}/actions/runners/{runner_id}/labels documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#add-custom-labels-to-a-self-hosted-runner-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /orgs/{org}/actions/runners/{runner_id}/labels documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#set-custom-labels-for-a-self-hosted-runner-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /orgs/{org}/actions/runners/{runner_id}/labels/{name} documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#remove-a-custom-label-from-a-self-hosted-runner-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/actions/secrets documentation_url: https://docs.github.com/rest/actions/secrets#list-organization-secrets openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/actions/secrets/public-key documentation_url: https://docs.github.com/rest/actions/secrets#get-an-organization-public-key openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /orgs/{org}/actions/secrets/{secret_name} documentation_url: https://docs.github.com/rest/actions/secrets#delete-an-organization-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/actions/secrets/{secret_name} documentation_url: https://docs.github.com/rest/actions/secrets#get-an-organization-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /orgs/{org}/actions/secrets/{secret_name} documentation_url: https://docs.github.com/rest/actions/secrets#create-or-update-an-organization-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/actions/secrets/{secret_name}/repositories documentation_url: https://docs.github.com/rest/actions/secrets#list-selected-repositories-for-an-organization-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /orgs/{org}/actions/secrets/{secret_name}/repositories documentation_url: https://docs.github.com/rest/actions/secrets#set-selected-repositories-for-an-organization-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id} documentation_url: https://docs.github.com/rest/actions/secrets#remove-selected-repository-from-an-organization-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id} documentation_url: https://docs.github.com/rest/actions/secrets#add-selected-repository-to-an-organization-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/actions/variables documentation_url: https://docs.github.com/rest/actions/variables#list-organization-variables openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /orgs/{org}/actions/variables documentation_url: https://docs.github.com/rest/actions/variables#create-an-organization-variable openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /orgs/{org}/actions/variables/{name} documentation_url: https://docs.github.com/rest/actions/variables#delete-an-organization-variable openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/actions/variables/{name} documentation_url: https://docs.github.com/rest/actions/variables#get-an-organization-variable openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /orgs/{org}/actions/variables/{name} documentation_url: https://docs.github.com/rest/actions/variables#update-an-organization-variable openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/actions/variables/{name}/repositories documentation_url: https://docs.github.com/rest/actions/variables#list-selected-repositories-for-an-organization-variable openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /orgs/{org}/actions/variables/{name}/repositories documentation_url: https://docs.github.com/rest/actions/variables#set-selected-repositories-for-an-organization-variable openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /orgs/{org}/actions/variables/{name}/repositories/{repository_id} documentation_url: https://docs.github.com/rest/actions/variables#remove-selected-repository-from-an-organization-variable openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /orgs/{org}/actions/variables/{name}/repositories/{repository_id} documentation_url: https://docs.github.com/rest/actions/variables#add-selected-repository-to-an-organization-variable openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /orgs/{org}/announcement documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/announcement-banners/organizations#remove-announcement-banner-from-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/announcement documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/announcement-banners/organizations#get-announcement-banner-for-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /orgs/{org}/announcement documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/announcement-banners/organizations#set-announcement-banner-for-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/audit-log documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/orgs/orgs#get-the-audit-log-for-an-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/blocks documentation_url: https://docs.github.com/rest/orgs/blocking#list-users-blocked-by-an-organization openapi_files: @@ -1451,7 +1496,7 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/codespaces documentation_url: https://docs.github.com/rest/codespaces/organizations#list-codespaces-for-the-organization openapi_files: @@ -1518,32 +1563,32 @@ openapi_operations: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - name: GET /orgs/{org}/copilot/billing - documentation_url: https://docs.github.com/rest/copilot/copilot-business#get-copilot-business-seat-information-and-settings-for-an-organization + documentation_url: https://docs.github.com/rest/copilot/copilot-user-management#get-copilot-seat-information-and-settings-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - name: GET /orgs/{org}/copilot/billing/seats - documentation_url: https://docs.github.com/rest/copilot/copilot-business#list-all-copilot-business-seat-assignments-for-an-organization + documentation_url: https://docs.github.com/rest/copilot/copilot-user-management#list-all-copilot-seat-assignments-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - name: DELETE /orgs/{org}/copilot/billing/selected_teams - documentation_url: https://docs.github.com/rest/copilot/copilot-business#remove-teams-from-the-copilot-business-subscription-for-an-organization + documentation_url: https://docs.github.com/rest/copilot/copilot-user-management#remove-teams-from-the-copilot-subscription-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - name: POST /orgs/{org}/copilot/billing/selected_teams - documentation_url: https://docs.github.com/rest/copilot/copilot-business#add-teams-to-the-copilot-business-subscription-for-an-organization + documentation_url: https://docs.github.com/rest/copilot/copilot-user-management#add-teams-to-the-copilot-subscription-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - name: DELETE /orgs/{org}/copilot/billing/selected_users - documentation_url: https://docs.github.com/rest/copilot/copilot-business#remove-users-from-the-copilot-business-subscription-for-an-organization + documentation_url: https://docs.github.com/rest/copilot/copilot-user-management#remove-users-from-the-copilot-subscription-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - name: POST /orgs/{org}/copilot/billing/selected_users - documentation_url: https://docs.github.com/rest/copilot/copilot-business#add-users-to-the-copilot-business-subscription-for-an-organization + documentation_url: https://docs.github.com/rest/copilot/copilot-user-management#add-users-to-the-copilot-subscription-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json @@ -1559,27 +1604,27 @@ openapi_operations: documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/orgs/custom-roles#list-custom-repository-roles-in-an-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /orgs/{org}/custom-repository-roles documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/orgs/custom-roles#create-a-custom-repository-role openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /orgs/{org}/custom-repository-roles/{role_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/orgs/custom-roles#delete-a-custom-repository-role openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/custom-repository-roles/{role_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/orgs/custom-roles#get-a-custom-repository-role openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /orgs/{org}/custom-repository-roles/{role_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/orgs/custom-roles#update-a-custom-repository-role openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /orgs/{org}/custom_roles documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/orgs/custom-roles#deprecated---create-a-custom-role openapi_files: @@ -1601,83 +1646,83 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/dependabot/secrets documentation_url: https://docs.github.com/rest/dependabot/secrets#list-organization-secrets openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/dependabot/secrets/public-key documentation_url: https://docs.github.com/rest/dependabot/secrets#get-an-organization-public-key openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /orgs/{org}/dependabot/secrets/{secret_name} documentation_url: https://docs.github.com/rest/dependabot/secrets#delete-an-organization-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/dependabot/secrets/{secret_name} documentation_url: https://docs.github.com/rest/dependabot/secrets#get-an-organization-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /orgs/{org}/dependabot/secrets/{secret_name} documentation_url: https://docs.github.com/rest/dependabot/secrets#create-or-update-an-organization-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/dependabot/secrets/{secret_name}/repositories documentation_url: https://docs.github.com/rest/dependabot/secrets#list-selected-repositories-for-an-organization-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /orgs/{org}/dependabot/secrets/{secret_name}/repositories documentation_url: https://docs.github.com/rest/dependabot/secrets#set-selected-repositories-for-an-organization-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /orgs/{org}/dependabot/secrets/{secret_name}/repositories/{repository_id} documentation_url: https://docs.github.com/rest/dependabot/secrets#remove-selected-repository-from-an-organization-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /orgs/{org}/dependabot/secrets/{secret_name}/repositories/{repository_id} documentation_url: https://docs.github.com/rest/dependabot/secrets#add-selected-repository-to-an-organization-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/docker/conflicts documentation_url: https://docs.github.com/rest/packages/packages#get-list-of-conflicting-packages-during-docker-migration-for-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/events documentation_url: https://docs.github.com/rest/activity/events#list-public-organization-events openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/external-group/{group_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/teams/external-groups#get-an-external-group openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/external-groups documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/teams/external-groups#list-external-groups-in-an-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/failed_invitations documentation_url: https://docs.github.com/rest/orgs/members#list-failed-organization-invitations openapi_files: @@ -1692,79 +1737,79 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /orgs/{org}/hooks documentation_url: https://docs.github.com/rest/orgs/webhooks#create-an-organization-webhook openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /orgs/{org}/hooks/{hook_id} documentation_url: https://docs.github.com/rest/orgs/webhooks#delete-an-organization-webhook openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/hooks/{hook_id} documentation_url: https://docs.github.com/rest/orgs/webhooks#get-an-organization-webhook openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /orgs/{org}/hooks/{hook_id} documentation_url: https://docs.github.com/rest/orgs/webhooks#update-an-organization-webhook openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/hooks/{hook_id}/config documentation_url: https://docs.github.com/rest/orgs/webhooks#get-a-webhook-configuration-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /orgs/{org}/hooks/{hook_id}/config documentation_url: https://docs.github.com/rest/orgs/webhooks#update-a-webhook-configuration-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/hooks/{hook_id}/deliveries documentation_url: https://docs.github.com/rest/orgs/webhooks#list-deliveries-for-an-organization-webhook openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/hooks/{hook_id}/deliveries/{delivery_id} documentation_url: https://docs.github.com/rest/orgs/webhooks#get-a-webhook-delivery-for-an-organization-webhook openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /orgs/{org}/hooks/{hook_id}/deliveries/{delivery_id}/attempts documentation_url: https://docs.github.com/rest/orgs/webhooks#redeliver-a-delivery-for-an-organization-webhook openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /orgs/{org}/hooks/{hook_id}/pings documentation_url: https://docs.github.com/rest/orgs/webhooks#ping-an-organization-webhook openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/installation documentation_url: https://docs.github.com/rest/apps/apps#get-an-organization-installation-for-the-authenticated-app openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/installations documentation_url: https://docs.github.com/rest/orgs/orgs#list-app-installations-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /orgs/{org}/interaction-limits documentation_url: https://docs.github.com/rest/interactions/orgs#remove-interaction-restrictions-for-an-organization openapi_files: @@ -1805,25 +1850,25 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/members documentation_url: https://docs.github.com/rest/orgs/members#list-organization-members openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /orgs/{org}/members/{username} documentation_url: https://docs.github.com/rest/orgs/members#remove-an-organization-member openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/members/{username} documentation_url: https://docs.github.com/rest/orgs/members#check-organization-membership-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/members/{username}/codespaces documentation_url: https://docs.github.com/rest/codespaces/organizations#list-codespaces-for-a-user-in-organization openapi_files: @@ -1840,7 +1885,7 @@ openapi_operations: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - name: GET /orgs/{org}/members/{username}/copilot - documentation_url: https://docs.github.com/rest/copilot/copilot-business#get-copilot-business-seat-assignment-details-for-a-user + documentation_url: https://docs.github.com/rest/copilot/copilot-user-management#get-copilot-seat-assignment-details-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json @@ -1849,61 +1894,61 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/memberships/{username} documentation_url: https://docs.github.com/rest/orgs/members#get-organization-membership-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /orgs/{org}/memberships/{username} documentation_url: https://docs.github.com/rest/orgs/members#set-organization-membership-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/migrations documentation_url: https://docs.github.com/rest/migrations/orgs#list-organization-migrations openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /orgs/{org}/migrations documentation_url: https://docs.github.com/rest/migrations/orgs#start-an-organization-migration openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/migrations/{migration_id} documentation_url: https://docs.github.com/rest/migrations/orgs#get-an-organization-migration-status openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /orgs/{org}/migrations/{migration_id}/archive documentation_url: https://docs.github.com/rest/migrations/orgs#delete-an-organization-migration-archive openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/migrations/{migration_id}/archive documentation_url: https://docs.github.com/rest/migrations/orgs#download-an-organization-migration-archive openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /orgs/{org}/migrations/{migration_id}/repos/{repo_name}/lock documentation_url: https://docs.github.com/rest/migrations/orgs#unlock-an-organization-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/migrations/{migration_id}/repositories documentation_url: https://docs.github.com/rest/migrations/orgs#list-repositories-in-an-organization-migration openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/organization-fine-grained-permissions documentation_url: https://docs.github.com/rest/orgs/organization-roles#list-organization-fine-grained-permissions-for-an-organization openapi_files: @@ -1979,143 +2024,143 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /orgs/{org}/outside_collaborators/{username} documentation_url: https://docs.github.com/rest/orgs/outside-collaborators#remove-outside-collaborator-from-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /orgs/{org}/outside_collaborators/{username} documentation_url: https://docs.github.com/rest/orgs/outside-collaborators#convert-an-organization-member-to-outside-collaborator openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/packages documentation_url: https://docs.github.com/rest/packages/packages#list-packages-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /orgs/{org}/packages/{package_type}/{package_name} documentation_url: https://docs.github.com/rest/packages/packages#delete-a-package-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/packages/{package_type}/{package_name} documentation_url: https://docs.github.com/rest/packages/packages#get-a-package-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /orgs/{org}/packages/{package_type}/{package_name}/restore documentation_url: https://docs.github.com/rest/packages/packages#restore-a-package-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/packages/{package_type}/{package_name}/versions documentation_url: https://docs.github.com/rest/packages/packages#list-package-versions-for-a-package-owned-by-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id} documentation_url: https://docs.github.com/rest/packages/packages#delete-package-version-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id} documentation_url: https://docs.github.com/rest/packages/packages#get-a-package-version-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /orgs/{org}/packages/{package_type}/{package_name}/versions/{package_version_id}/restore documentation_url: https://docs.github.com/rest/packages/packages#restore-package-version-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/personal-access-token-requests documentation_url: https://docs.github.com/rest/orgs/personal-access-tokens#list-requests-to-access-organization-resources-with-fine-grained-personal-access-tokens openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /orgs/{org}/personal-access-token-requests documentation_url: https://docs.github.com/rest/orgs/personal-access-tokens#review-requests-to-access-organization-resources-with-fine-grained-personal-access-tokens openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /orgs/{org}/personal-access-token-requests/{pat_request_id} documentation_url: https://docs.github.com/rest/orgs/personal-access-tokens#review-a-request-to-access-organization-resources-with-a-fine-grained-personal-access-token openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/personal-access-token-requests/{pat_request_id}/repositories documentation_url: https://docs.github.com/rest/orgs/personal-access-tokens#list-repositories-requested-to-be-accessed-by-a-fine-grained-personal-access-token openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/personal-access-tokens documentation_url: https://docs.github.com/rest/orgs/personal-access-tokens#list-fine-grained-personal-access-tokens-with-access-to-organization-resources openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /orgs/{org}/personal-access-tokens documentation_url: https://docs.github.com/rest/orgs/personal-access-tokens#update-the-access-to-organization-resources-via-fine-grained-personal-access-tokens openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /orgs/{org}/personal-access-tokens/{pat_id} documentation_url: https://docs.github.com/rest/orgs/personal-access-tokens#update-the-access-a-fine-grained-personal-access-token-has-to-organization-resources openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/personal-access-tokens/{pat_id}/repositories documentation_url: https://docs.github.com/rest/orgs/personal-access-tokens#list-repositories-a-fine-grained-personal-access-token-has-access-to openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/pre-receive-hooks - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/org-pre-receive-hooks#list-pre-receive-hooks-for-an-organization + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/org-pre-receive-hooks#list-pre-receive-hooks-for-an-organization openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /orgs/{org}/pre-receive-hooks/{pre_receive_hook_id} - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/org-pre-receive-hooks#remove-pre-receive-hook-enforcement-for-an-organization + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/org-pre-receive-hooks#remove-pre-receive-hook-enforcement-for-an-organization openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/pre-receive-hooks/{pre_receive_hook_id} - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/org-pre-receive-hooks#get-a-pre-receive-hook-for-an-organization + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/org-pre-receive-hooks#get-a-pre-receive-hook-for-an-organization openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /orgs/{org}/pre-receive-hooks/{pre_receive_hook_id} - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/org-pre-receive-hooks#update-pre-receive-hook-enforcement-for-an-organization + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/org-pre-receive-hooks#update-pre-receive-hook-enforcement-for-an-organization openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/projects documentation_url: https://docs.github.com/rest/projects/projects#list-organization-projects openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /orgs/{org}/projects documentation_url: https://docs.github.com/rest/projects/projects#create-an-organization-project openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/properties/schema documentation_url: https://docs.github.com/rest/orgs/custom-properties#get-all-custom-properties-for-an-organization openapi_files: @@ -2156,88 +2201,90 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /orgs/{org}/public_members/{username} documentation_url: https://docs.github.com/rest/orgs/members#remove-public-organization-membership-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/public_members/{username} documentation_url: https://docs.github.com/rest/orgs/members#check-public-organization-membership-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /orgs/{org}/public_members/{username} documentation_url: https://docs.github.com/rest/orgs/members#set-public-organization-membership-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/repos documentation_url: https://docs.github.com/rest/repos/repos#list-organization-repositories openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /orgs/{org}/repos documentation_url: https://docs.github.com/rest/repos/repos#create-an-organization-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/repository-fine-grained-permissions documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/orgs/custom-roles#list-repository-fine-grained-permissions-for-an-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/rulesets documentation_url: https://docs.github.com/rest/orgs/rules#get-all-organization-repository-rulesets openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /orgs/{org}/rulesets documentation_url: https://docs.github.com/rest/orgs/rules#create-an-organization-repository-ruleset openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/rulesets/rule-suites documentation_url: https://docs.github.com/rest/orgs/rule-suites#list-organization-rule-suites openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/rulesets/rule-suites/{rule_suite_id} documentation_url: https://docs.github.com/rest/orgs/rule-suites#get-an-organization-rule-suite openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /orgs/{org}/rulesets/{ruleset_id} documentation_url: https://docs.github.com/rest/orgs/rules#delete-an-organization-repository-ruleset openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/rulesets/{ruleset_id} documentation_url: https://docs.github.com/rest/orgs/rules#get-an-organization-repository-ruleset openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /orgs/{org}/rulesets/{ruleset_id} documentation_url: https://docs.github.com/rest/orgs/rules#update-an-organization-repository-ruleset openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/secret-scanning/alerts documentation_url: https://docs.github.com/rest/secret-scanning/secret-scanning#list-secret-scanning-alerts-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/security-advisories documentation_url: https://docs.github.com/rest/security-advisories/repository-advisories#list-repository-security-advisories-for-an-organization openapi_files: @@ -2248,19 +2295,19 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /orgs/{org}/security-managers/teams/{team_slug} documentation_url: https://docs.github.com/rest/orgs/security-managers#remove-a-security-manager-team openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /orgs/{org}/security-managers/teams/{team_slug} documentation_url: https://docs.github.com/rest/orgs/security-managers#add-a-security-manager-team openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/settings/billing/actions documentation_url: https://docs.github.com/rest/billing/billing#get-github-actions-billing-for-an-organization openapi_files: @@ -2270,7 +2317,7 @@ openapi_operations: documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/billing/billing#get-github-advanced-security-active-committers-for-an-organization openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/settings/billing/packages documentation_url: https://docs.github.com/rest/billing/billing#get-github-packages-billing-for-an-organization openapi_files: @@ -2290,142 +2337,142 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /orgs/{org}/teams documentation_url: https://docs.github.com/rest/teams/teams#create-a-team openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /orgs/{org}/teams/{team_slug} documentation_url: https://docs.github.com/rest/teams/teams#delete-a-team openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/teams/{team_slug} documentation_url: https://docs.github.com/rest/teams/teams#get-a-team-by-name openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /orgs/{org}/teams/{team_slug} documentation_url: https://docs.github.com/rest/teams/teams#update-a-team openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/teams/{team_slug}/discussions documentation_url: https://docs.github.com/rest/teams/discussions#list-discussions openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /orgs/{org}/teams/{team_slug}/discussions documentation_url: https://docs.github.com/rest/teams/discussions#create-a-discussion openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number} documentation_url: https://docs.github.com/rest/teams/discussions#delete-a-discussion openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number} documentation_url: https://docs.github.com/rest/teams/discussions#get-a-discussion openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /orgs/{org}/teams/{team_slug}/discussions/{discussion_number} documentation_url: https://docs.github.com/rest/teams/discussions#update-a-discussion openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments documentation_url: https://docs.github.com/rest/teams/discussion-comments#list-discussion-comments openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments documentation_url: https://docs.github.com/rest/teams/discussion-comments#create-a-discussion-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number} documentation_url: https://docs.github.com/rest/teams/discussion-comments#delete-a-discussion-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number} documentation_url: https://docs.github.com/rest/teams/discussion-comments#get-a-discussion-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number} documentation_url: https://docs.github.com/rest/teams/discussion-comments#update-a-discussion-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions documentation_url: https://docs.github.com/rest/reactions/reactions#list-reactions-for-a-team-discussion-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions documentation_url: https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-team-discussion-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions/{reaction_id} documentation_url: https://docs.github.com/rest/reactions/reactions#delete-team-discussion-comment-reaction openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions documentation_url: https://docs.github.com/rest/reactions/reactions#list-reactions-for-a-team-discussion openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions documentation_url: https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-team-discussion openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions/{reaction_id} documentation_url: https://docs.github.com/rest/reactions/reactions#delete-team-discussion-reaction openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /orgs/{org}/teams/{team_slug}/external-groups documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/teams/external-groups#remove-the-connection-between-an-external-group-and-a-team openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/teams/{team_slug}/external-groups documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/teams/external-groups#list-a-connection-between-an-external-group-and-a-team openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /orgs/{org}/teams/{team_slug}/external-groups documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/teams/external-groups#update-the-connection-between-an-external-group-and-a-team openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/teams/{team_slug}/invitations documentation_url: https://docs.github.com/rest/teams/members#list-pending-team-invitations openapi_files: @@ -2436,73 +2483,73 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /orgs/{org}/teams/{team_slug}/memberships/{username} documentation_url: https://docs.github.com/rest/teams/members#remove-team-membership-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/teams/{team_slug}/memberships/{username} documentation_url: https://docs.github.com/rest/teams/members#get-team-membership-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /orgs/{org}/teams/{team_slug}/memberships/{username} documentation_url: https://docs.github.com/rest/teams/members#add-or-update-team-membership-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/teams/{team_slug}/projects documentation_url: https://docs.github.com/rest/teams/teams#list-team-projects openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /orgs/{org}/teams/{team_slug}/projects/{project_id} documentation_url: https://docs.github.com/rest/teams/teams#remove-a-project-from-a-team openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/teams/{team_slug}/projects/{project_id} documentation_url: https://docs.github.com/rest/teams/teams#check-team-permissions-for-a-project openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /orgs/{org}/teams/{team_slug}/projects/{project_id} documentation_url: https://docs.github.com/rest/teams/teams#add-or-update-team-project-permissions openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/teams/{team_slug}/repos documentation_url: https://docs.github.com/rest/teams/teams#list-team-repositories openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} documentation_url: https://docs.github.com/rest/teams/teams#remove-a-repository-from-a-team openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} documentation_url: https://docs.github.com/rest/teams/teams#check-team-permissions-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} documentation_url: https://docs.github.com/rest/teams/teams#add-or-update-team-repository-permissions openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /orgs/{org}/teams/{team_slug}/team-sync/group-mappings documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/teams/team-sync#list-idp-groups-for-a-team openapi_files: @@ -2516,133 +2563,133 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /orgs/{org}/{security_product}/{enablement} documentation_url: https://docs.github.com/rest/orgs/orgs#enable-or-disable-a-security-feature-for-an-organization openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /projects/columns/cards/{card_id} documentation_url: https://docs.github.com/rest/projects/cards#delete-a-project-card openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /projects/columns/cards/{card_id} documentation_url: https://docs.github.com/rest/projects/cards#get-a-project-card openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /projects/columns/cards/{card_id} documentation_url: https://docs.github.com/rest/projects/cards#update-an-existing-project-card openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /projects/columns/cards/{card_id}/moves documentation_url: https://docs.github.com/rest/projects/cards#move-a-project-card openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /projects/columns/{column_id} documentation_url: https://docs.github.com/rest/projects/columns#delete-a-project-column openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /projects/columns/{column_id} documentation_url: https://docs.github.com/rest/projects/columns#get-a-project-column openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /projects/columns/{column_id} documentation_url: https://docs.github.com/rest/projects/columns#update-an-existing-project-column openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /projects/columns/{column_id}/cards documentation_url: https://docs.github.com/rest/projects/cards#list-project-cards openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /projects/columns/{column_id}/cards documentation_url: https://docs.github.com/rest/projects/cards#create-a-project-card openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /projects/columns/{column_id}/moves documentation_url: https://docs.github.com/rest/projects/columns#move-a-project-column openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /projects/{project_id} documentation_url: https://docs.github.com/rest/projects/projects#delete-a-project openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /projects/{project_id} documentation_url: https://docs.github.com/rest/projects/projects#get-a-project openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /projects/{project_id} documentation_url: https://docs.github.com/rest/projects/projects#update-a-project openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /projects/{project_id}/collaborators documentation_url: https://docs.github.com/rest/projects/collaborators#list-project-collaborators openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /projects/{project_id}/collaborators/{username} documentation_url: https://docs.github.com/rest/projects/collaborators#remove-user-as-a-collaborator openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /projects/{project_id}/collaborators/{username} documentation_url: https://docs.github.com/rest/projects/collaborators#add-project-collaborator openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /projects/{project_id}/collaborators/{username}/permission documentation_url: https://docs.github.com/rest/projects/collaborators#get-project-permission-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /projects/{project_id}/columns documentation_url: https://docs.github.com/rest/projects/columns#list-project-columns openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /projects/{project_id}/columns documentation_url: https://docs.github.com/rest/projects/columns#create-a-project-column openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /rate_limit documentation_url: https://docs.github.com/rest/rate-limit/rate-limit#get-rate-limit-status-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /reactions/{reaction_id} documentation_url: https://docs.github.com/enterprise-server@3.4/rest/reference/reactions/#delete-a-reaction-legacy openapi_files: @@ -2652,261 +2699,261 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo} documentation_url: https://docs.github.com/rest/repos/repos#get-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /repos/{owner}/{repo} documentation_url: https://docs.github.com/rest/repos/repos#update-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/actions/artifacts documentation_url: https://docs.github.com/rest/actions/artifacts#list-artifacts-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/actions/artifacts/{artifact_id} documentation_url: https://docs.github.com/rest/actions/artifacts#delete-an-artifact openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id} documentation_url: https://docs.github.com/rest/actions/artifacts#get-an-artifact openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}/{archive_format} documentation_url: https://docs.github.com/rest/actions/artifacts#download-an-artifact openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/actions/cache/usage documentation_url: https://docs.github.com/rest/actions/cache#get-github-actions-cache-usage-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/actions/cache/usage-policy - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/actions/cache#get-github-actions-cache-usage-policy-for-a-repository + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/actions/cache#get-github-actions-cache-usage-policy-for-a-repository openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /repos/{owner}/{repo}/actions/cache/usage-policy - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/actions/cache#set-github-actions-cache-usage-policy-for-a-repository + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/actions/cache#set-github-actions-cache-usage-policy-for-a-repository openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/actions/caches documentation_url: https://docs.github.com/rest/actions/cache#delete-github-actions-caches-for-a-repository-using-a-cache-key openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/actions/caches documentation_url: https://docs.github.com/rest/actions/cache#list-github-actions-caches-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/actions/caches/{cache_id} documentation_url: https://docs.github.com/rest/actions/cache#delete-a-github-actions-cache-for-a-repository-using-a-cache-id openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/actions/jobs/{job_id} documentation_url: https://docs.github.com/rest/actions/workflow-jobs#get-a-job-for-a-workflow-run openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/actions/jobs/{job_id}/logs documentation_url: https://docs.github.com/rest/actions/workflow-jobs#download-job-logs-for-a-workflow-run openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/actions/jobs/{job_id}/rerun documentation_url: https://docs.github.com/rest/actions/workflow-runs#re-run-a-job-from-a-workflow-run openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/actions/oidc/customization/sub documentation_url: https://docs.github.com/rest/actions/oidc#get-the-customization-template-for-an-oidc-subject-claim-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /repos/{owner}/{repo}/actions/oidc/customization/sub documentation_url: https://docs.github.com/rest/actions/oidc#set-the-customization-template-for-an-oidc-subject-claim-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/actions/organization-secrets documentation_url: https://docs.github.com/rest/actions/secrets#list-repository-organization-secrets openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/actions/organization-variables documentation_url: https://docs.github.com/rest/actions/variables#list-repository-organization-variables openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/actions/permissions documentation_url: https://docs.github.com/rest/actions/permissions#get-github-actions-permissions-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /repos/{owner}/{repo}/actions/permissions documentation_url: https://docs.github.com/rest/actions/permissions#set-github-actions-permissions-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/actions/permissions/access documentation_url: https://docs.github.com/rest/actions/permissions#get-the-level-of-access-for-workflows-outside-of-the-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /repos/{owner}/{repo}/actions/permissions/access documentation_url: https://docs.github.com/rest/actions/permissions#set-the-level-of-access-for-workflows-outside-of-the-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/actions/permissions/selected-actions documentation_url: https://docs.github.com/rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /repos/{owner}/{repo}/actions/permissions/selected-actions documentation_url: https://docs.github.com/rest/actions/permissions#set-allowed-actions-and-reusable-workflows-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/actions/permissions/workflow documentation_url: https://docs.github.com/rest/actions/permissions#get-default-workflow-permissions-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /repos/{owner}/{repo}/actions/permissions/workflow documentation_url: https://docs.github.com/rest/actions/permissions#set-default-workflow-permissions-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/actions/runners documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#list-self-hosted-runners-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/actions/runners/downloads documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#list-runner-applications-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/actions/runners/generate-jitconfig documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#create-configuration-for-a-just-in-time-runner-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/actions/runners/registration-token documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#create-a-registration-token-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/actions/runners/remove-token documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#create-a-remove-token-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/actions/runners/{runner_id} documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#delete-a-self-hosted-runner-from-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/actions/runners/{runner_id} documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#get-a-self-hosted-runner-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/actions/runners/{runner_id}/labels documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#remove-all-custom-labels-from-a-self-hosted-runner-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/actions/runners/{runner_id}/labels documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#list-labels-for-a-self-hosted-runner-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/actions/runners/{runner_id}/labels documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#add-custom-labels-to-a-self-hosted-runner-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /repos/{owner}/{repo}/actions/runners/{runner_id}/labels documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#set-custom-labels-for-a-self-hosted-runner-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/actions/runners/{runner_id}/labels/{name} documentation_url: https://docs.github.com/rest/actions/self-hosted-runners#remove-a-custom-label-from-a-self-hosted-runner-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/actions/runs documentation_url: https://docs.github.com/rest/actions/workflow-runs#list-workflow-runs-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/actions/runs/{run_id} documentation_url: https://docs.github.com/rest/actions/workflow-runs#delete-a-workflow-run openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/actions/runs/{run_id} documentation_url: https://docs.github.com/rest/actions/workflow-runs#get-a-workflow-run openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/actions/runs/{run_id}/approvals documentation_url: https://docs.github.com/rest/actions/workflow-runs#get-the-review-history-for-a-workflow-run openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/actions/runs/{run_id}/approve documentation_url: https://docs.github.com/rest/actions/workflow-runs#approve-a-workflow-run-for-a-fork-pull-request openapi_files: @@ -2917,84 +2964,85 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number} documentation_url: https://docs.github.com/rest/actions/workflow-runs#get-a-workflow-run-attempt openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/jobs documentation_url: https://docs.github.com/rest/actions/workflow-jobs#list-jobs-for-a-workflow-run-attempt openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/actions/runs/{run_id}/attempts/{attempt_number}/logs documentation_url: https://docs.github.com/rest/actions/workflow-runs#download-workflow-run-attempt-logs openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/actions/runs/{run_id}/cancel documentation_url: https://docs.github.com/rest/actions/workflow-runs#cancel-a-workflow-run openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/actions/runs/{run_id}/deployment_protection_rule documentation_url: https://docs.github.com/rest/actions/workflow-runs#review-custom-deployment-protection-rules-for-a-workflow-run openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/actions/runs/{run_id}/force-cancel documentation_url: https://docs.github.com/rest/actions/workflow-runs#force-cancel-a-workflow-run openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs documentation_url: https://docs.github.com/rest/actions/workflow-jobs#list-jobs-for-a-workflow-run openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/actions/runs/{run_id}/logs documentation_url: https://docs.github.com/rest/actions/workflow-runs#delete-workflow-run-logs openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/actions/runs/{run_id}/logs documentation_url: https://docs.github.com/rest/actions/workflow-runs#download-workflow-run-logs openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments documentation_url: https://docs.github.com/rest/actions/workflow-runs#get-pending-deployments-for-a-workflow-run openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments documentation_url: https://docs.github.com/rest/actions/workflow-runs#review-pending-deployments-for-a-workflow-run openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/actions/runs/{run_id}/rerun documentation_url: https://docs.github.com/rest/actions/workflow-runs#re-run-a-workflow openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/actions/runs/{run_id}/rerun-failed-jobs documentation_url: https://docs.github.com/rest/actions/workflow-runs#re-run-failed-jobs-from-a-workflow-run openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/actions/runs/{run_id}/timing documentation_url: https://docs.github.com/rest/actions/workflow-runs#get-workflow-run-usage openapi_files: @@ -3005,97 +3053,97 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/actions/secrets/public-key documentation_url: https://docs.github.com/rest/actions/secrets#get-a-repository-public-key openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/actions/secrets/{secret_name} documentation_url: https://docs.github.com/rest/actions/secrets#delete-a-repository-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/actions/secrets/{secret_name} documentation_url: https://docs.github.com/rest/actions/secrets#get-a-repository-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /repos/{owner}/{repo}/actions/secrets/{secret_name} documentation_url: https://docs.github.com/rest/actions/secrets#create-or-update-a-repository-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/actions/variables documentation_url: https://docs.github.com/rest/actions/variables#list-repository-variables openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/actions/variables documentation_url: https://docs.github.com/rest/actions/variables#create-a-repository-variable openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/actions/variables/{name} documentation_url: https://docs.github.com/rest/actions/variables#delete-a-repository-variable openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/actions/variables/{name} documentation_url: https://docs.github.com/rest/actions/variables#get-a-repository-variable openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /repos/{owner}/{repo}/actions/variables/{name} documentation_url: https://docs.github.com/rest/actions/variables#update-a-repository-variable openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/actions/workflows documentation_url: https://docs.github.com/rest/actions/workflows#list-repository-workflows openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/actions/workflows/{workflow_id} documentation_url: https://docs.github.com/rest/actions/workflows#get-a-workflow openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable documentation_url: https://docs.github.com/rest/actions/workflows#disable-a-workflow openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches documentation_url: https://docs.github.com/rest/actions/workflows#create-a-workflow-dispatch-event openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable documentation_url: https://docs.github.com/rest/actions/workflows#enable-a-workflow openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs documentation_url: https://docs.github.com/rest/actions/workflow-runs#list-workflow-runs-for-a-workflow openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/timing documentation_url: https://docs.github.com/rest/actions/workflows#get-workflow-usage openapi_files: @@ -3106,43 +3154,43 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/assignees documentation_url: https://docs.github.com/rest/issues/assignees#list-assignees openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/assignees/{assignee} documentation_url: https://docs.github.com/rest/issues/assignees#check-if-a-user-can-be-assigned openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/autolinks - documentation_url: https://docs.github.com/rest/repos/autolinks#list-all-autolinks-of-a-repository + documentation_url: https://docs.github.com/rest/repos/autolinks#get-all-autolinks-of-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/autolinks documentation_url: https://docs.github.com/rest/repos/autolinks#create-an-autolink-reference-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/autolinks/{autolink_id} documentation_url: https://docs.github.com/rest/repos/autolinks#delete-an-autolink-reference-from-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/autolinks/{autolink_id} documentation_url: https://docs.github.com/rest/repos/autolinks#get-an-autolink-reference-of-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/automated-security-fixes documentation_url: https://docs.github.com/rest/repos/repos#disable-automated-security-fixes openapi_files: @@ -3153,7 +3201,7 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /repos/{owner}/{repo}/automated-security-fixes documentation_url: https://docs.github.com/rest/repos/repos#enable-automated-security-fixes openapi_files: @@ -3164,319 +3212,319 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/branches/{branch} documentation_url: https://docs.github.com/rest/branches/branches#get-a-branch openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/branches/{branch}/protection documentation_url: https://docs.github.com/rest/branches/branch-protection#delete-branch-protection openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/branches/{branch}/protection documentation_url: https://docs.github.com/rest/branches/branch-protection#get-branch-protection openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /repos/{owner}/{repo}/branches/{branch}/protection documentation_url: https://docs.github.com/rest/branches/branch-protection#update-branch-protection openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins documentation_url: https://docs.github.com/rest/branches/branch-protection#delete-admin-branch-protection openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins documentation_url: https://docs.github.com/rest/branches/branch-protection#get-admin-branch-protection openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins documentation_url: https://docs.github.com/rest/branches/branch-protection#set-admin-branch-protection openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews documentation_url: https://docs.github.com/rest/branches/branch-protection#delete-pull-request-review-protection openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews documentation_url: https://docs.github.com/rest/branches/branch-protection#get-pull-request-review-protection openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews documentation_url: https://docs.github.com/rest/branches/branch-protection#update-pull-request-review-protection openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures documentation_url: https://docs.github.com/rest/branches/branch-protection#delete-commit-signature-protection openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures documentation_url: https://docs.github.com/rest/branches/branch-protection#get-commit-signature-protection openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures documentation_url: https://docs.github.com/rest/branches/branch-protection#create-commit-signature-protection openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks documentation_url: https://docs.github.com/rest/branches/branch-protection#remove-status-check-protection openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks documentation_url: https://docs.github.com/rest/branches/branch-protection#get-status-checks-protection openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks documentation_url: https://docs.github.com/rest/branches/branch-protection#update-status-check-protection openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts documentation_url: https://docs.github.com/rest/branches/branch-protection#remove-status-check-contexts openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts documentation_url: https://docs.github.com/rest/branches/branch-protection#get-all-status-check-contexts openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts documentation_url: https://docs.github.com/rest/branches/branch-protection#add-status-check-contexts openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts documentation_url: https://docs.github.com/rest/branches/branch-protection#set-status-check-contexts openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions documentation_url: https://docs.github.com/rest/branches/branch-protection#delete-access-restrictions openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions documentation_url: https://docs.github.com/rest/branches/branch-protection#get-access-restrictions openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps documentation_url: https://docs.github.com/rest/branches/branch-protection#remove-app-access-restrictions openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps documentation_url: https://docs.github.com/rest/branches/branch-protection#get-apps-with-access-to-the-protected-branch openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps documentation_url: https://docs.github.com/rest/branches/branch-protection#add-app-access-restrictions openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps documentation_url: https://docs.github.com/rest/branches/branch-protection#set-app-access-restrictions openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams documentation_url: https://docs.github.com/rest/branches/branch-protection#remove-team-access-restrictions openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams documentation_url: https://docs.github.com/rest/branches/branch-protection#get-teams-with-access-to-the-protected-branch openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams documentation_url: https://docs.github.com/rest/branches/branch-protection#add-team-access-restrictions openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams documentation_url: https://docs.github.com/rest/branches/branch-protection#set-team-access-restrictions openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users documentation_url: https://docs.github.com/rest/branches/branch-protection#remove-user-access-restrictions openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users documentation_url: https://docs.github.com/rest/branches/branch-protection#get-users-with-access-to-the-protected-branch openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users documentation_url: https://docs.github.com/rest/branches/branch-protection#add-user-access-restrictions openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users documentation_url: https://docs.github.com/rest/branches/branch-protection#set-user-access-restrictions openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/branches/{branch}/rename documentation_url: https://docs.github.com/rest/branches/branches#rename-a-branch openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/check-runs documentation_url: https://docs.github.com/rest/checks/runs#create-a-check-run openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/check-runs/{check_run_id} documentation_url: https://docs.github.com/rest/checks/runs#get-a-check-run openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /repos/{owner}/{repo}/check-runs/{check_run_id} documentation_url: https://docs.github.com/rest/checks/runs#update-a-check-run openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/check-runs/{check_run_id}/annotations documentation_url: https://docs.github.com/rest/checks/runs#list-check-run-annotations openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/check-runs/{check_run_id}/rerequest documentation_url: https://docs.github.com/rest/checks/runs#rerequest-a-check-run openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/check-suites documentation_url: https://docs.github.com/rest/checks/suites#create-a-check-suite openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /repos/{owner}/{repo}/check-suites/preferences documentation_url: https://docs.github.com/rest/checks/suites#update-repository-preferences-for-check-suites openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/check-suites/{check_suite_id} documentation_url: https://docs.github.com/rest/checks/suites#get-a-check-suite openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/check-suites/{check_suite_id}/check-runs documentation_url: https://docs.github.com/rest/checks/runs#list-check-runs-in-a-check-suite openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/check-suites/{check_suite_id}/rerequest documentation_url: https://docs.github.com/rest/checks/suites#rerequest-a-check-suite openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/code-scanning/alerts documentation_url: https://docs.github.com/rest/code-scanning/code-scanning#list-code-scanning-alerts-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number} documentation_url: https://docs.github.com/rest/code-scanning/code-scanning#get-a-code-scanning-alert openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /repos/{owner}/{repo}/code-scanning/alerts/{alert_number} documentation_url: https://docs.github.com/rest/code-scanning/code-scanning#update-a-code-scanning-alert openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances documentation_url: https://docs.github.com/rest/code-scanning/code-scanning#list-instances-of-a-code-scanning-alert openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/code-scanning/analyses documentation_url: https://docs.github.com/rest/code-scanning/code-scanning#list-code-scanning-analyses-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/code-scanning/analyses/{analysis_id} documentation_url: https://docs.github.com/rest/code-scanning/code-scanning#delete-a-code-scanning-analysis-from-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/code-scanning/analyses/{analysis_id} documentation_url: https://docs.github.com/rest/code-scanning/code-scanning#get-a-code-scanning-analysis-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/code-scanning/codeql/databases documentation_url: https://docs.github.com/rest/code-scanning/code-scanning#list-codeql-databases-for-a-repository openapi_files: @@ -3492,31 +3540,31 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /repos/{owner}/{repo}/code-scanning/default-setup documentation_url: https://docs.github.com/rest/code-scanning/code-scanning#update-a-code-scanning-default-setup-configuration openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/code-scanning/sarifs documentation_url: https://docs.github.com/rest/code-scanning/code-scanning#upload-an-analysis-as-sarif-data openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/code-scanning/sarifs/{sarif_id} documentation_url: https://docs.github.com/rest/code-scanning/code-scanning#get-information-about-a-sarif-upload openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/codeowners/errors documentation_url: https://docs.github.com/rest/repos/repos#list-codeowners-errors openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/codespaces documentation_url: https://docs.github.com/rest/codespaces/codespaces#list-codespaces-in-a-repository-for-the-authenticated-user openapi_files: @@ -3577,133 +3625,133 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/collaborators/{username} documentation_url: https://docs.github.com/rest/collaborators/collaborators#remove-a-repository-collaborator openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/collaborators/{username} documentation_url: https://docs.github.com/rest/collaborators/collaborators#check-if-a-user-is-a-repository-collaborator openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /repos/{owner}/{repo}/collaborators/{username} documentation_url: https://docs.github.com/rest/collaborators/collaborators#add-a-repository-collaborator openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/collaborators/{username}/permission documentation_url: https://docs.github.com/rest/collaborators/collaborators#get-repository-permissions-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/comments documentation_url: https://docs.github.com/rest/commits/comments#list-commit-comments-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/comments/{comment_id} documentation_url: https://docs.github.com/rest/commits/comments#delete-a-commit-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/comments/{comment_id} documentation_url: https://docs.github.com/rest/commits/comments#get-a-commit-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /repos/{owner}/{repo}/comments/{comment_id} documentation_url: https://docs.github.com/rest/commits/comments#update-a-commit-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/comments/{comment_id}/reactions documentation_url: https://docs.github.com/rest/reactions/reactions#list-reactions-for-a-commit-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/comments/{comment_id}/reactions documentation_url: https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-commit-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/comments/{comment_id}/reactions/{reaction_id} documentation_url: https://docs.github.com/rest/reactions/reactions#delete-a-commit-comment-reaction openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/commits documentation_url: https://docs.github.com/rest/commits/commits#list-commits openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/commits/{commit_sha}/branches-where-head documentation_url: https://docs.github.com/rest/commits/commits#list-branches-for-head-commit openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/commits/{commit_sha}/comments documentation_url: https://docs.github.com/rest/commits/comments#list-commit-comments openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/commits/{commit_sha}/comments documentation_url: https://docs.github.com/rest/commits/comments#create-a-commit-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls documentation_url: https://docs.github.com/rest/commits/commits#list-pull-requests-associated-with-a-commit openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/commits/{ref} documentation_url: https://docs.github.com/rest/commits/commits#get-a-commit openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/commits/{ref}/check-runs documentation_url: https://docs.github.com/rest/checks/runs#list-check-runs-for-a-git-reference openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/commits/{ref}/check-suites documentation_url: https://docs.github.com/rest/checks/suites#list-check-suites-for-a-git-reference openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/commits/{ref}/status documentation_url: https://docs.github.com/rest/commits/statuses#get-the-combined-status-for-a-specific-reference openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/commits/{ref}/statuses documentation_url: https://docs.github.com/rest/commits/statuses#list-commit-statuses-for-a-reference openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/community/profile documentation_url: https://docs.github.com/rest/metrics/community#get-community-profile-metrics openapi_files: @@ -3714,7 +3762,7 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/content_references/{content_reference_id}/attachments documentation_url: https://docs.github.com/enterprise-server@3.3/rest/reference/apps#create-a-content-attachment openapi_files: @@ -3724,391 +3772,451 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/contents/{path} documentation_url: https://docs.github.com/rest/repos/contents#get-repository-content openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /repos/{owner}/{repo}/contents/{path} documentation_url: https://docs.github.com/rest/repos/contents#create-or-update-file-contents openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/contributors documentation_url: https://docs.github.com/rest/repos/repos#list-repository-contributors openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/dependabot/alerts documentation_url: https://docs.github.com/rest/dependabot/alerts#list-dependabot-alerts-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/dependabot/alerts/{alert_number} documentation_url: https://docs.github.com/rest/dependabot/alerts#get-a-dependabot-alert openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /repos/{owner}/{repo}/dependabot/alerts/{alert_number} documentation_url: https://docs.github.com/rest/dependabot/alerts#update-a-dependabot-alert openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/dependabot/secrets documentation_url: https://docs.github.com/rest/dependabot/secrets#list-repository-secrets openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/dependabot/secrets/public-key documentation_url: https://docs.github.com/rest/dependabot/secrets#get-a-repository-public-key openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/dependabot/secrets/{secret_name} documentation_url: https://docs.github.com/rest/dependabot/secrets#delete-a-repository-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/dependabot/secrets/{secret_name} documentation_url: https://docs.github.com/rest/dependabot/secrets#get-a-repository-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /repos/{owner}/{repo}/dependabot/secrets/{secret_name} documentation_url: https://docs.github.com/rest/dependabot/secrets#create-or-update-a-repository-secret openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/dependency-graph/compare/{basehead} documentation_url: https://docs.github.com/rest/dependency-graph/dependency-review#get-a-diff-of-the-dependencies-between-commits openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/dependency-graph/sbom documentation_url: https://docs.github.com/rest/dependency-graph/sboms#export-a-software-bill-of-materials-sbom-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/dependency-graph/snapshots documentation_url: https://docs.github.com/rest/dependency-graph/dependency-submission#create-a-snapshot-of-dependencies-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/deployments documentation_url: https://docs.github.com/rest/deployments/deployments#list-deployments openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/deployments documentation_url: https://docs.github.com/rest/deployments/deployments#create-a-deployment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/deployments/{deployment_id} documentation_url: https://docs.github.com/rest/deployments/deployments#delete-a-deployment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/deployments/{deployment_id} documentation_url: https://docs.github.com/rest/deployments/deployments#get-a-deployment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses documentation_url: https://docs.github.com/rest/deployments/statuses#list-deployment-statuses openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/deployments/{deployment_id}/statuses documentation_url: https://docs.github.com/rest/deployments/statuses#create-a-deployment-status openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses/{status_id} documentation_url: https://docs.github.com/rest/deployments/statuses#get-a-deployment-status openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/dispatches documentation_url: https://docs.github.com/rest/repos/repos#create-a-repository-dispatch-event openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/environments documentation_url: https://docs.github.com/rest/deployments/environments#list-environments openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/environments/{environment_name} documentation_url: https://docs.github.com/rest/deployments/environments#delete-an-environment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/environments/{environment_name} documentation_url: https://docs.github.com/rest/deployments/environments#get-an-environment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /repos/{owner}/{repo}/environments/{environment_name} documentation_url: https://docs.github.com/rest/deployments/environments#create-or-update-an-environment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies documentation_url: https://docs.github.com/rest/deployments/branch-policies#list-deployment-branch-policies openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies documentation_url: https://docs.github.com/rest/deployments/branch-policies#create-a-deployment-branch-policy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id} documentation_url: https://docs.github.com/rest/deployments/branch-policies#delete-a-deployment-branch-policy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id} documentation_url: https://docs.github.com/rest/deployments/branch-policies#get-a-deployment-branch-policy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id} documentation_url: https://docs.github.com/rest/deployments/branch-policies#update-a-deployment-branch-policy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules documentation_url: https://docs.github.com/rest/deployments/protection-rules#get-all-deployment-protection-rules-for-an-environment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules documentation_url: https://docs.github.com/rest/deployments/protection-rules#create-a-custom-deployment-protection-rule-on-an-environment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/apps documentation_url: https://docs.github.com/rest/deployments/protection-rules#list-custom-deployment-rule-integrations-available-for-an-environment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/{protection_rule_id} documentation_url: https://docs.github.com/rest/deployments/protection-rules#disable-a-custom-protection-rule-for-an-environment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/{protection_rule_id} documentation_url: https://docs.github.com/rest/deployments/protection-rules#get-a-custom-deployment-protection-rule openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json + - name: GET /repos/{owner}/{repo}/environments/{environment_name}/secrets + documentation_url: https://docs.github.com/rest/actions/secrets#list-environment-secrets + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.12/ghes-3.12.json + - name: GET /repos/{owner}/{repo}/environments/{environment_name}/secrets/public-key + documentation_url: https://docs.github.com/rest/actions/secrets#get-an-environment-public-key + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.12/ghes-3.12.json + - name: DELETE /repos/{owner}/{repo}/environments/{environment_name}/secrets/{secret_name} + documentation_url: https://docs.github.com/rest/actions/secrets#delete-an-environment-secret + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.12/ghes-3.12.json + - name: GET /repos/{owner}/{repo}/environments/{environment_name}/secrets/{secret_name} + documentation_url: https://docs.github.com/rest/actions/secrets#get-an-environment-secret + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.12/ghes-3.12.json + - name: PUT /repos/{owner}/{repo}/environments/{environment_name}/secrets/{secret_name} + documentation_url: https://docs.github.com/rest/actions/secrets#create-or-update-an-environment-secret + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.12/ghes-3.12.json + - name: GET /repos/{owner}/{repo}/environments/{environment_name}/variables + documentation_url: https://docs.github.com/rest/actions/variables#list-environment-variables + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.12/ghes-3.12.json + - name: POST /repos/{owner}/{repo}/environments/{environment_name}/variables + documentation_url: https://docs.github.com/rest/actions/variables#create-an-environment-variable + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.12/ghes-3.12.json + - name: DELETE /repos/{owner}/{repo}/environments/{environment_name}/variables/{name} + documentation_url: https://docs.github.com/rest/actions/variables#delete-an-environment-variable + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.12/ghes-3.12.json + - name: GET /repos/{owner}/{repo}/environments/{environment_name}/variables/{name} + documentation_url: https://docs.github.com/rest/actions/variables#get-an-environment-variable + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.12/ghes-3.12.json + - name: PATCH /repos/{owner}/{repo}/environments/{environment_name}/variables/{name} + documentation_url: https://docs.github.com/rest/actions/variables#update-an-environment-variable + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/events documentation_url: https://docs.github.com/rest/activity/events#list-repository-events openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/forks documentation_url: https://docs.github.com/rest/repos/forks#list-forks openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/forks documentation_url: https://docs.github.com/rest/repos/forks#create-a-fork openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/git/blobs documentation_url: https://docs.github.com/rest/git/blobs#create-a-blob openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/git/blobs/{file_sha} documentation_url: https://docs.github.com/rest/git/blobs#get-a-blob openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/git/commits documentation_url: https://docs.github.com/rest/git/commits#create-a-commit openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/git/commits/{commit_sha} documentation_url: https://docs.github.com/rest/git/commits#get-a-commit-object openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/git/matching-refs/{ref} documentation_url: https://docs.github.com/rest/git/refs#list-matching-references openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/git/ref/{ref} documentation_url: https://docs.github.com/rest/git/refs#get-a-reference openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/git/refs documentation_url: https://docs.github.com/rest/git/refs#create-a-reference openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/git/refs/{ref} documentation_url: https://docs.github.com/rest/git/refs#delete-a-reference openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /repos/{owner}/{repo}/git/refs/{ref} documentation_url: https://docs.github.com/rest/git/refs#update-a-reference openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/git/tags documentation_url: https://docs.github.com/rest/git/tags#create-a-tag-object openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/git/tags/{tag_sha} documentation_url: https://docs.github.com/rest/git/tags#get-a-tag openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/git/trees documentation_url: https://docs.github.com/rest/git/trees#create-a-tree openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/git/trees/{tree_sha} documentation_url: https://docs.github.com/rest/git/trees#get-a-tree openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/hooks documentation_url: https://docs.github.com/rest/repos/webhooks#list-repository-webhooks openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/hooks documentation_url: https://docs.github.com/rest/repos/webhooks#create-a-repository-webhook openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/hooks/{hook_id} documentation_url: https://docs.github.com/rest/repos/webhooks#delete-a-repository-webhook openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/hooks/{hook_id} documentation_url: https://docs.github.com/rest/repos/webhooks#get-a-repository-webhook openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /repos/{owner}/{repo}/hooks/{hook_id} documentation_url: https://docs.github.com/rest/repos/webhooks#update-a-repository-webhook openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/hooks/{hook_id}/config documentation_url: https://docs.github.com/rest/repos/webhooks#get-a-webhook-configuration-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /repos/{owner}/{repo}/hooks/{hook_id}/config documentation_url: https://docs.github.com/rest/repos/webhooks#update-a-webhook-configuration-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries documentation_url: https://docs.github.com/rest/repos/webhooks#list-deliveries-for-a-repository-webhook openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries/{delivery_id} documentation_url: https://docs.github.com/rest/repos/webhooks#get-a-delivery-for-a-repository-webhook openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/hooks/{hook_id}/deliveries/{delivery_id}/attempts documentation_url: https://docs.github.com/rest/repos/webhooks#redeliver-a-delivery-for-a-repository-webhook openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/hooks/{hook_id}/pings documentation_url: https://docs.github.com/rest/repos/webhooks#ping-a-repository-webhook openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/hooks/{hook_id}/tests documentation_url: https://docs.github.com/rest/repos/webhooks#test-the-push-repository-webhook openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/import documentation_url: https://docs.github.com/rest/migrations/source-imports#cancel-an-import openapi_files: @@ -4154,7 +4262,7 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/interaction-limits documentation_url: https://docs.github.com/rest/interactions/repos#remove-interaction-restrictions-for-a-repository openapi_files: @@ -4175,415 +4283,434 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/invitations/{invitation_id} documentation_url: https://docs.github.com/rest/collaborators/invitations#delete-a-repository-invitation openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /repos/{owner}/{repo}/invitations/{invitation_id} documentation_url: https://docs.github.com/rest/collaborators/invitations#update-a-repository-invitation openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/issues documentation_url: https://docs.github.com/rest/issues/issues#list-repository-issues openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/issues documentation_url: https://docs.github.com/rest/issues/issues#create-an-issue openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/issues/comments documentation_url: https://docs.github.com/rest/issues/comments#list-issue-comments-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/issues/comments/{comment_id} documentation_url: https://docs.github.com/rest/issues/comments#delete-an-issue-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/issues/comments/{comment_id} documentation_url: https://docs.github.com/rest/issues/comments#get-an-issue-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /repos/{owner}/{repo}/issues/comments/{comment_id} documentation_url: https://docs.github.com/rest/issues/comments#update-an-issue-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions documentation_url: https://docs.github.com/rest/reactions/reactions#list-reactions-for-an-issue-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions documentation_url: https://docs.github.com/rest/reactions/reactions#create-reaction-for-an-issue-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/issues/comments/{comment_id}/reactions/{reaction_id} documentation_url: https://docs.github.com/rest/reactions/reactions#delete-an-issue-comment-reaction openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/issues/events documentation_url: https://docs.github.com/rest/issues/events#list-issue-events-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/issues/events/{event_id} documentation_url: https://docs.github.com/rest/issues/events#get-an-issue-event openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/issues/{issue_number} documentation_url: https://docs.github.com/rest/issues/issues#get-an-issue openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /repos/{owner}/{repo}/issues/{issue_number} documentation_url: https://docs.github.com/rest/issues/issues#update-an-issue openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/issues/{issue_number}/assignees documentation_url: https://docs.github.com/rest/issues/assignees#remove-assignees-from-an-issue openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/issues/{issue_number}/assignees documentation_url: https://docs.github.com/rest/issues/assignees#add-assignees-to-an-issue openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/issues/{issue_number}/assignees/{assignee} documentation_url: https://docs.github.com/rest/issues/assignees#check-if-a-user-can-be-assigned-to-a-issue openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/issues/{issue_number}/comments documentation_url: https://docs.github.com/rest/issues/comments#list-issue-comments openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/issues/{issue_number}/comments documentation_url: https://docs.github.com/rest/issues/comments#create-an-issue-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/issues/{issue_number}/events documentation_url: https://docs.github.com/rest/issues/events#list-issue-events openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels documentation_url: https://docs.github.com/rest/issues/labels#remove-all-labels-from-an-issue openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/issues/{issue_number}/labels documentation_url: https://docs.github.com/rest/issues/labels#list-labels-for-an-issue openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/issues/{issue_number}/labels documentation_url: https://docs.github.com/rest/issues/labels#add-labels-to-an-issue openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /repos/{owner}/{repo}/issues/{issue_number}/labels documentation_url: https://docs.github.com/rest/issues/labels#set-labels-for-an-issue openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels/{name} documentation_url: https://docs.github.com/rest/issues/labels#remove-a-label-from-an-issue openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/issues/{issue_number}/lock documentation_url: https://docs.github.com/rest/issues/issues#unlock-an-issue openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /repos/{owner}/{repo}/issues/{issue_number}/lock documentation_url: https://docs.github.com/rest/issues/issues#lock-an-issue openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/issues/{issue_number}/reactions documentation_url: https://docs.github.com/rest/reactions/reactions#list-reactions-for-an-issue openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/issues/{issue_number}/reactions documentation_url: https://docs.github.com/rest/reactions/reactions#create-reaction-for-an-issue openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/issues/{issue_number}/reactions/{reaction_id} documentation_url: https://docs.github.com/rest/reactions/reactions#delete-an-issue-reaction openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/issues/{issue_number}/timeline documentation_url: https://docs.github.com/rest/issues/timeline#list-timeline-events-for-an-issue openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/keys documentation_url: https://docs.github.com/rest/deploy-keys/deploy-keys#list-deploy-keys openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/keys documentation_url: https://docs.github.com/rest/deploy-keys/deploy-keys#create-a-deploy-key openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/keys/{key_id} documentation_url: https://docs.github.com/rest/deploy-keys/deploy-keys#delete-a-deploy-key openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/keys/{key_id} documentation_url: https://docs.github.com/rest/deploy-keys/deploy-keys#get-a-deploy-key openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/labels documentation_url: https://docs.github.com/rest/issues/labels#list-labels-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/labels documentation_url: https://docs.github.com/rest/issues/labels#create-a-label openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/labels/{name} documentation_url: https://docs.github.com/rest/issues/labels#delete-a-label openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/labels/{name} documentation_url: https://docs.github.com/rest/issues/labels#get-a-label openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /repos/{owner}/{repo}/labels/{name} documentation_url: https://docs.github.com/rest/issues/labels#update-a-label openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/languages documentation_url: https://docs.github.com/rest/repos/repos#list-repository-languages openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/lfs documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/repos/lfs#disable-git-lfs-for-a-repository openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /repos/{owner}/{repo}/lfs documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/repos/lfs#enable-git-lfs-for-a-repository openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/license documentation_url: https://docs.github.com/rest/licenses/licenses#get-the-license-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/merge-upstream documentation_url: https://docs.github.com/rest/branches/branches#sync-a-fork-branch-with-the-upstream-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/merges documentation_url: https://docs.github.com/rest/branches/branches#merge-a-branch openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/milestones documentation_url: https://docs.github.com/rest/issues/milestones#list-milestones openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/milestones documentation_url: https://docs.github.com/rest/issues/milestones#create-a-milestone openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/milestones/{milestone_number} documentation_url: https://docs.github.com/rest/issues/milestones#delete-a-milestone openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/milestones/{milestone_number} documentation_url: https://docs.github.com/rest/issues/milestones#get-a-milestone openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /repos/{owner}/{repo}/milestones/{milestone_number} documentation_url: https://docs.github.com/rest/issues/milestones#update-a-milestone openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/milestones/{milestone_number}/labels documentation_url: https://docs.github.com/rest/issues/labels#list-labels-for-issues-in-a-milestone openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/notifications documentation_url: https://docs.github.com/rest/activity/notifications#list-repository-notifications-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /repos/{owner}/{repo}/notifications documentation_url: https://docs.github.com/rest/activity/notifications#mark-repository-notifications-as-read openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/pages documentation_url: https://docs.github.com/rest/pages/pages#delete-a-apiname-pages-site openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/pages documentation_url: https://docs.github.com/rest/pages/pages#get-a-apiname-pages-site openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/pages documentation_url: https://docs.github.com/rest/pages/pages#create-a-apiname-pages-site openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /repos/{owner}/{repo}/pages documentation_url: https://docs.github.com/rest/pages/pages#update-information-about-a-apiname-pages-site openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/pages/builds documentation_url: https://docs.github.com/rest/pages/pages#list-apiname-pages-builds openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/pages/builds documentation_url: https://docs.github.com/rest/pages/pages#request-a-apiname-pages-build openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/pages/builds/latest documentation_url: https://docs.github.com/rest/pages/pages#get-latest-pages-build openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/pages/builds/{build_id} documentation_url: https://docs.github.com/rest/pages/pages#get-apiname-pages-build openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/pages/deployment + documentation_url: https://docs.github.com/enterprise-server@3.7/rest/pages/pages#create-a-github-pages-deployment + openapi_files: + - descriptions/ghes-3.7/ghes-3.7.json + - name: POST /repos/{owner}/{repo}/pages/deployments documentation_url: https://docs.github.com/rest/pages/pages#create-a-github-pages-deployment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json + - name: GET /repos/{owner}/{repo}/pages/deployments/{pages_deployment_id} + documentation_url: https://docs.github.com/rest/pages/pages#get-the-status-of-a-github-pages-deployment + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json + - name: POST /repos/{owner}/{repo}/pages/deployments/{pages_deployment_id}/cancel + documentation_url: https://docs.github.com/rest/pages/pages#cancel-a-github-pages-deployment + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json - name: GET /repos/{owner}/{repo}/pages/health documentation_url: https://docs.github.com/rest/pages/pages#get-a-dns-health-check-for-github-pages openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - name: GET /repos/{owner}/{repo}/pre-receive-hooks - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/repo-pre-receive-hooks#list-pre-receive-hooks-for-a-repository + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/repo-pre-receive-hooks#list-pre-receive-hooks-for-a-repository openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/pre-receive-hooks/{pre_receive_hook_id} - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/repo-pre-receive-hooks#remove-pre-receive-hook-enforcement-for-a-repository + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/repo-pre-receive-hooks#remove-pre-receive-hook-enforcement-for-a-repository openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/pre-receive-hooks/{pre_receive_hook_id} - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/repo-pre-receive-hooks#get-a-pre-receive-hook-for-a-repository + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/repo-pre-receive-hooks#get-a-pre-receive-hook-for-a-repository openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /repos/{owner}/{repo}/pre-receive-hooks/{pre_receive_hook_id} - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/repo-pre-receive-hooks#update-pre-receive-hook-enforcement-for-a-repository + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/repo-pre-receive-hooks#update-pre-receive-hook-enforcement-for-a-repository openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/private-vulnerability-reporting documentation_url: https://docs.github.com/rest/repos/repos#disable-private-vulnerability-reporting-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json + - name: GET /repos/{owner}/{repo}/private-vulnerability-reporting + documentation_url: https://docs.github.com/rest/repos/repos#check-if-private-vulnerability-reporting-is-enabled-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json - name: PUT /repos/{owner}/{repo}/private-vulnerability-reporting documentation_url: https://docs.github.com/rest/repos/repos#enable-private-vulnerability-reporting-for-a-repository openapi_files: @@ -4594,84 +4721,89 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/projects documentation_url: https://docs.github.com/rest/projects/projects#create-a-repository-project openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/properties/values documentation_url: https://docs.github.com/rest/repos/custom-properties#get-all-custom-property-values-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json + - name: PATCH /repos/{owner}/{repo}/properties/values + documentation_url: https://docs.github.com/rest/repos/custom-properties#create-or-update-custom-property-values-for-a-repository + openapi_files: + - descriptions/api.github.com/api.github.com.json + - descriptions/ghec/ghec.json - name: GET /repos/{owner}/{repo}/pulls documentation_url: https://docs.github.com/rest/pulls/pulls#list-pull-requests openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/pulls documentation_url: https://docs.github.com/rest/pulls/pulls#create-a-pull-request openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/pulls/comments documentation_url: https://docs.github.com/rest/pulls/comments#list-review-comments-in-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id} documentation_url: https://docs.github.com/rest/pulls/comments#delete-a-review-comment-for-a-pull-request openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/pulls/comments/{comment_id} documentation_url: https://docs.github.com/rest/pulls/comments#get-a-review-comment-for-a-pull-request openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /repos/{owner}/{repo}/pulls/comments/{comment_id} documentation_url: https://docs.github.com/rest/pulls/comments#update-a-review-comment-for-a-pull-request openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions documentation_url: https://docs.github.com/rest/reactions/reactions#list-reactions-for-a-pull-request-review-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions documentation_url: https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-pull-request-review-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions/{reaction_id} documentation_url: https://docs.github.com/rest/reactions/reactions#delete-a-pull-request-comment-reaction openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/pulls/{pull_number} documentation_url: https://docs.github.com/rest/pulls/pulls#get-a-pull-request openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /repos/{owner}/{repo}/pulls/{pull_number} documentation_url: https://docs.github.com/rest/pulls/pulls#update-a-pull-request openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/pulls/{pull_number}/codespaces documentation_url: https://docs.github.com/rest/codespaces/codespaces#create-a-codespace-from-a-pull-request openapi_files: @@ -4682,297 +4814,299 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/pulls/{pull_number}/comments documentation_url: https://docs.github.com/rest/pulls/comments#create-a-review-comment-for-a-pull-request openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/replies documentation_url: https://docs.github.com/rest/pulls/comments#create-a-reply-for-a-review-comment openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/pulls/{pull_number}/commits documentation_url: https://docs.github.com/rest/pulls/pulls#list-commits-on-a-pull-request openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/pulls/{pull_number}/files documentation_url: https://docs.github.com/rest/pulls/pulls#list-pull-requests-files openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/pulls/{pull_number}/merge documentation_url: https://docs.github.com/rest/pulls/pulls#check-if-a-pull-request-has-been-merged openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge documentation_url: https://docs.github.com/rest/pulls/pulls#merge-a-pull-request openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers documentation_url: https://docs.github.com/rest/pulls/review-requests#remove-requested-reviewers-from-a-pull-request openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers documentation_url: https://docs.github.com/rest/pulls/review-requests#get-all-requested-reviewers-for-a-pull-request openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers documentation_url: https://docs.github.com/rest/pulls/review-requests#request-reviewers-for-a-pull-request openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews documentation_url: https://docs.github.com/rest/pulls/reviews#list-reviews-for-a-pull-request openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews documentation_url: https://docs.github.com/rest/pulls/reviews#create-a-review-for-a-pull-request openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id} documentation_url: https://docs.github.com/rest/pulls/reviews#delete-a-pending-review-for-a-pull-request openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id} documentation_url: https://docs.github.com/rest/pulls/reviews#get-a-review-for-a-pull-request openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id} documentation_url: https://docs.github.com/rest/pulls/reviews#update-a-review-for-a-pull-request openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/comments documentation_url: https://docs.github.com/rest/pulls/reviews#list-comments-for-a-pull-request-review openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/dismissals documentation_url: https://docs.github.com/rest/pulls/reviews#dismiss-a-review-for-a-pull-request openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/events documentation_url: https://docs.github.com/rest/pulls/reviews#submit-a-review-for-a-pull-request openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /repos/{owner}/{repo}/pulls/{pull_number}/update-branch documentation_url: https://docs.github.com/rest/pulls/pulls#update-a-pull-request-branch openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/readme documentation_url: https://docs.github.com/rest/repos/contents#get-a-repository-readme openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/readme/{dir} documentation_url: https://docs.github.com/rest/repos/contents#get-a-repository-readme-for-a-directory openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/releases documentation_url: https://docs.github.com/rest/releases/releases#list-releases openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/releases documentation_url: https://docs.github.com/rest/releases/releases#create-a-release openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/releases/assets/{asset_id} documentation_url: https://docs.github.com/rest/releases/assets#delete-a-release-asset openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/releases/assets/{asset_id} documentation_url: https://docs.github.com/rest/releases/assets#get-a-release-asset openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /repos/{owner}/{repo}/releases/assets/{asset_id} documentation_url: https://docs.github.com/rest/releases/assets#update-a-release-asset openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/releases/generate-notes documentation_url: https://docs.github.com/rest/releases/releases#generate-release-notes-content-for-a-release openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/releases/latest documentation_url: https://docs.github.com/rest/releases/releases#get-the-latest-release openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/releases/tags/{tag} documentation_url: https://docs.github.com/rest/releases/releases#get-a-release-by-tag-name openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/releases/{release_id} documentation_url: https://docs.github.com/rest/releases/releases#delete-a-release openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/releases/{release_id} documentation_url: https://docs.github.com/rest/releases/releases#get-a-release openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /repos/{owner}/{repo}/releases/{release_id} documentation_url: https://docs.github.com/rest/releases/releases#update-a-release openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/releases/{release_id}/assets documentation_url: https://docs.github.com/rest/releases/assets#list-release-assets openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/releases/{release_id}/assets documentation_url: https://docs.github.com/rest/releases/assets#upload-a-release-asset openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/releases/{release_id}/reactions documentation_url: https://docs.github.com/rest/reactions/reactions#list-reactions-for-a-release openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/releases/{release_id}/reactions documentation_url: https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-release openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/releases/{release_id}/reactions/{reaction_id} documentation_url: https://docs.github.com/rest/reactions/reactions#delete-a-release-reaction openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/replicas/caches - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/repos/repos#list-repository-cache-replication-status + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/repos/repos#list-repository-cache-replication-status openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/rules/branches/{branch} documentation_url: https://docs.github.com/rest/repos/rules#get-rules-for-a-branch openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/rulesets documentation_url: https://docs.github.com/rest/repos/rules#get-all-repository-rulesets openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/rulesets documentation_url: https://docs.github.com/rest/repos/rules#create-a-repository-ruleset openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/rulesets/rule-suites documentation_url: https://docs.github.com/rest/repos/rule-suites#list-repository-rule-suites openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/rulesets/rule-suites/{rule_suite_id} documentation_url: https://docs.github.com/rest/repos/rule-suites#get-a-repository-rule-suite openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/rulesets/{ruleset_id} documentation_url: https://docs.github.com/rest/repos/rules#delete-a-repository-ruleset openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/rulesets/{ruleset_id} documentation_url: https://docs.github.com/rest/repos/rules#get-a-repository-ruleset openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /repos/{owner}/{repo}/rulesets/{ruleset_id} documentation_url: https://docs.github.com/rest/repos/rules#update-a-repository-ruleset openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/secret-scanning/alerts documentation_url: https://docs.github.com/rest/secret-scanning/secret-scanning#list-secret-scanning-alerts-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number} documentation_url: https://docs.github.com/rest/secret-scanning/secret-scanning#get-a-secret-scanning-alert openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number} documentation_url: https://docs.github.com/rest/secret-scanning/secret-scanning#update-a-secret-scanning-alert openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}/locations documentation_url: https://docs.github.com/rest/secret-scanning/secret-scanning#list-locations-for-a-secret-scanning-alert openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/security-advisories documentation_url: https://docs.github.com/rest/security-advisories/repository-advisories#list-repository-security-advisories openapi_files: @@ -5013,115 +5147,115 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/stats/code_frequency documentation_url: https://docs.github.com/rest/metrics/statistics#get-the-weekly-commit-activity openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/stats/commit_activity documentation_url: https://docs.github.com/rest/metrics/statistics#get-the-last-year-of-commit-activity openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/stats/contributors documentation_url: https://docs.github.com/rest/metrics/statistics#get-all-contributor-commit-activity openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/stats/participation documentation_url: https://docs.github.com/rest/metrics/statistics#get-the-weekly-commit-count openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/stats/punch_card documentation_url: https://docs.github.com/rest/metrics/statistics#get-the-hourly-commit-count-for-each-day openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/statuses/{sha} documentation_url: https://docs.github.com/rest/commits/statuses#create-a-commit-status openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/subscribers documentation_url: https://docs.github.com/rest/activity/watching#list-watchers openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/subscription documentation_url: https://docs.github.com/rest/activity/watching#delete-a-repository-subscription openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/subscription documentation_url: https://docs.github.com/rest/activity/watching#get-a-repository-subscription openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /repos/{owner}/{repo}/subscription documentation_url: https://docs.github.com/rest/activity/watching#set-a-repository-subscription openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/tags documentation_url: https://docs.github.com/rest/repos/repos#list-repository-tags openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/tags/protection documentation_url: https://docs.github.com/rest/repos/tags#list-tag-protection-states-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{owner}/{repo}/tags/protection documentation_url: https://docs.github.com/rest/repos/tags#create-a-tag-protection-state-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/tags/protection/{tag_protection_id} documentation_url: https://docs.github.com/rest/repos/tags#delete-a-tag-protection-state-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/tarball/{ref} documentation_url: https://docs.github.com/rest/repos/contents#download-a-repository-archive-tar openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/teams documentation_url: https://docs.github.com/rest/repos/repos#list-repository-teams openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/topics documentation_url: https://docs.github.com/rest/repos/repos#get-all-repository-topics openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /repos/{owner}/{repo}/topics documentation_url: https://docs.github.com/rest/repos/repos#replace-all-repository-topics openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/traffic/clones documentation_url: https://docs.github.com/rest/metrics/traffic#get-repository-clones openapi_files: @@ -5147,163 +5281,171 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /repos/{owner}/{repo}/vulnerability-alerts documentation_url: https://docs.github.com/rest/repos/repos#disable-vulnerability-alerts openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/vulnerability-alerts documentation_url: https://docs.github.com/rest/repos/repos#check-if-vulnerability-alerts-are-enabled-for-a-repository openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /repos/{owner}/{repo}/vulnerability-alerts documentation_url: https://docs.github.com/rest/repos/repos#enable-vulnerability-alerts openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repos/{owner}/{repo}/zipball/{ref} documentation_url: https://docs.github.com/rest/repos/contents#download-a-repository-archive-zip openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /repos/{template_owner}/{template_repo}/generate documentation_url: https://docs.github.com/rest/repos/repos#create-a-repository-using-a-template openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repositories documentation_url: https://docs.github.com/rest/repos/repos#list-public-repositories openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /repositories/{repository_id}/environments/{environment_name}/secrets - documentation_url: https://docs.github.com/rest/actions/secrets#list-environment-secrets + documentation_url: https://docs.github.com/enterprise-server@3.7/rest/actions/secrets#list-environment-secrets openapi_files: - - descriptions/api.github.com/api.github.com.json - - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.7/ghes-3.7.json - name: GET /repositories/{repository_id}/environments/{environment_name}/secrets/public-key - documentation_url: https://docs.github.com/rest/actions/secrets#get-an-environment-public-key + documentation_url: https://docs.github.com/enterprise-server@3.7/rest/actions/secrets#get-an-environment-public-key openapi_files: - - descriptions/api.github.com/api.github.com.json - - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.7/ghes-3.7.json - name: DELETE /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name} - documentation_url: https://docs.github.com/rest/actions/secrets#delete-an-environment-secret + documentation_url: https://docs.github.com/enterprise-server@3.7/rest/actions/secrets#delete-an-environment-secret openapi_files: - - descriptions/api.github.com/api.github.com.json - - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.7/ghes-3.7.json - name: GET /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name} - documentation_url: https://docs.github.com/rest/actions/secrets#get-an-environment-secret + documentation_url: https://docs.github.com/enterprise-server@3.7/rest/actions/secrets#get-an-environment-secret openapi_files: - - descriptions/api.github.com/api.github.com.json - - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.7/ghes-3.7.json - name: PUT /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name} - documentation_url: https://docs.github.com/rest/actions/secrets#create-or-update-an-environment-secret + documentation_url: https://docs.github.com/enterprise-server@3.7/rest/actions/secrets#create-or-update-an-environment-secret openapi_files: - - descriptions/api.github.com/api.github.com.json - - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json - - name: GET /repositories/{repository_id}/environments/{environment_name}/variables - documentation_url: https://docs.github.com/rest/actions/variables#list-environment-variables + - descriptions/ghes-3.7/ghes-3.7.json + - name: GET /scim/v2/Groups + documentation_url: https://docs.github.com/enterprise-server@3.7/rest/enterprise-admin/scim#list-provisioned-scim-groups-for-an-enterprise openapi_files: - - descriptions/api.github.com/api.github.com.json - - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json - - name: POST /repositories/{repository_id}/environments/{environment_name}/variables - documentation_url: https://docs.github.com/rest/actions/variables#create-an-environment-variable + - descriptions/ghes-3.7/ghes-3.7.json + - name: POST /scim/v2/Groups + documentation_url: https://docs.github.com/enterprise-server@3.7/rest/enterprise-admin/scim#provision-a-scim-enterprise-group openapi_files: - - descriptions/api.github.com/api.github.com.json - - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json - - name: DELETE /repositories/{repository_id}/environments/{environment_name}/variables/{name} - documentation_url: https://docs.github.com/rest/actions/variables#delete-an-environment-variable + - descriptions/ghes-3.7/ghes-3.7.json + - name: DELETE /scim/v2/Groups/{scim_group_id} + documentation_url: https://docs.github.com/enterprise-server@3.7/rest/enterprise-admin/scim#delete-a-scim-group-from-an-enterprise openapi_files: - - descriptions/api.github.com/api.github.com.json - - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json - - name: GET /repositories/{repository_id}/environments/{environment_name}/variables/{name} - documentation_url: https://docs.github.com/rest/actions/variables#get-an-environment-variable + - descriptions/ghes-3.7/ghes-3.7.json + - name: GET /scim/v2/Groups/{scim_group_id} + documentation_url: https://docs.github.com/enterprise-server@3.7/rest/enterprise-admin/scim#get-scim-provisioning-information-for-an-enterprise-group openapi_files: - - descriptions/api.github.com/api.github.com.json - - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json - - name: PATCH /repositories/{repository_id}/environments/{environment_name}/variables/{name} - documentation_url: https://docs.github.com/rest/actions/variables#update-an-environment-variable + - descriptions/ghes-3.7/ghes-3.7.json + - name: PATCH /scim/v2/Groups/{scim_group_id} + documentation_url: https://docs.github.com/enterprise-server@3.7/rest/enterprise-admin/scim#update-an-attribute-for-a-scim-enterprise-group openapi_files: - - descriptions/api.github.com/api.github.com.json - - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json - - name: GET /scim/v2/Groups + - descriptions/ghes-3.7/ghes-3.7.json + - name: PUT /scim/v2/Groups/{scim_group_id} + documentation_url: https://docs.github.com/enterprise-server@3.7/rest/enterprise-admin/scim#set-scim-information-for-a-provisioned-enterprise-group + openapi_files: + - descriptions/ghes-3.7/ghes-3.7.json + - name: GET /scim/v2/Users + documentation_url: https://docs.github.com/enterprise-server@3.7/rest/enterprise-admin/scim#list-scim-provisioned-identities-for-an-enterprise + openapi_files: + - descriptions/ghes-3.7/ghes-3.7.json + - name: POST /scim/v2/Users + documentation_url: https://docs.github.com/enterprise-server@3.7/rest/enterprise-admin/scim#provision-a-scim-enterprise-user + openapi_files: + - descriptions/ghes-3.7/ghes-3.7.json + - name: DELETE /scim/v2/Users/{scim_user_id} + documentation_url: https://docs.github.com/enterprise-server@3.7/rest/enterprise-admin/scim#delete-a-scim-user-from-an-enterprise + openapi_files: + - descriptions/ghes-3.7/ghes-3.7.json + - name: GET /scim/v2/Users/{scim_user_id} + documentation_url: https://docs.github.com/enterprise-server@3.7/rest/enterprise-admin/scim#get-scim-provisioning-information-for-an-enterprise-user + openapi_files: + - descriptions/ghes-3.7/ghes-3.7.json + - name: PATCH /scim/v2/Users/{scim_user_id} + documentation_url: https://docs.github.com/enterprise-server@3.7/rest/enterprise-admin/scim#update-an-attribute-for-a-scim-enterprise-user + openapi_files: + - descriptions/ghes-3.7/ghes-3.7.json + - name: PUT /scim/v2/Users/{scim_user_id} + documentation_url: https://docs.github.com/enterprise-server@3.7/rest/enterprise-admin/scim#set-scim-information-for-a-provisioned-enterprise-user + openapi_files: + - descriptions/ghes-3.7/ghes-3.7.json + - name: GET /scim/v2/enterprises/{enterprise}/Groups documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/scim#list-provisioned-scim-groups-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json - - name: POST /scim/v2/Groups + - descriptions/ghes-3.12/ghes-3.12.json + - name: POST /scim/v2/enterprises/{enterprise}/Groups documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/scim#provision-a-scim-enterprise-group openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json - - name: DELETE /scim/v2/Groups/{scim_group_id} + - descriptions/ghes-3.12/ghes-3.12.json + - name: DELETE /scim/v2/enterprises/{enterprise}/Groups/{scim_group_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/scim#delete-a-scim-group-from-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json - - name: GET /scim/v2/Groups/{scim_group_id} + - descriptions/ghes-3.12/ghes-3.12.json + - name: GET /scim/v2/enterprises/{enterprise}/Groups/{scim_group_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/scim#get-scim-provisioning-information-for-an-enterprise-group openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json - - name: PATCH /scim/v2/Groups/{scim_group_id} + - descriptions/ghes-3.12/ghes-3.12.json + - name: PATCH /scim/v2/enterprises/{enterprise}/Groups/{scim_group_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/scim#update-an-attribute-for-a-scim-enterprise-group openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json - - name: PUT /scim/v2/Groups/{scim_group_id} + - descriptions/ghes-3.12/ghes-3.12.json + - name: PUT /scim/v2/enterprises/{enterprise}/Groups/{scim_group_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/scim#set-scim-information-for-a-provisioned-enterprise-group openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json - - name: GET /scim/v2/Users + - descriptions/ghes-3.12/ghes-3.12.json + - name: GET /scim/v2/enterprises/{enterprise}/Users documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/scim#list-scim-provisioned-identities-for-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json - - name: POST /scim/v2/Users + - descriptions/ghes-3.12/ghes-3.12.json + - name: POST /scim/v2/enterprises/{enterprise}/Users documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/scim#provision-a-scim-enterprise-user openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json - - name: DELETE /scim/v2/Users/{scim_user_id} + - descriptions/ghes-3.12/ghes-3.12.json + - name: DELETE /scim/v2/enterprises/{enterprise}/Users/{scim_user_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/scim#delete-a-scim-user-from-an-enterprise openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json - - name: GET /scim/v2/Users/{scim_user_id} + - descriptions/ghes-3.12/ghes-3.12.json + - name: GET /scim/v2/enterprises/{enterprise}/Users/{scim_user_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/scim#get-scim-provisioning-information-for-an-enterprise-user openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json - - name: PATCH /scim/v2/Users/{scim_user_id} + - descriptions/ghes-3.12/ghes-3.12.json + - name: PATCH /scim/v2/enterprises/{enterprise}/Users/{scim_user_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/scim#update-an-attribute-for-a-scim-enterprise-user openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json - - name: PUT /scim/v2/Users/{scim_user_id} + - descriptions/ghes-3.12/ghes-3.12.json + - name: PUT /scim/v2/enterprises/{enterprise}/Users/{scim_user_id} documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/scim#set-scim-information-for-a-provisioned-enterprise-user openapi_files: - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /scim/v2/organizations/{org}/Users documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/scim/scim#list-scim-provisioned-identities openapi_files: @@ -5333,189 +5475,189 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /search/commits documentation_url: https://docs.github.com/rest/search/search#search-commits openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /search/issues documentation_url: https://docs.github.com/rest/search/search#search-issues-and-pull-requests openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /search/labels documentation_url: https://docs.github.com/rest/search/search#search-labels openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /search/repositories documentation_url: https://docs.github.com/rest/search/search#search-repositories openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /search/topics documentation_url: https://docs.github.com/rest/search/search#search-topics openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /search/users documentation_url: https://docs.github.com/rest/search/search#search-users openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /setup/api/configcheck - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/management-console#get-the-configuration-status + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/management-console#get-the-configuration-status openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /setup/api/configure - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/management-console#start-a-configuration-process + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/management-console#start-a-configuration-process openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /setup/api/maintenance - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/management-console#get-the-maintenance-status + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/management-console#get-the-maintenance-status openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /setup/api/maintenance - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/management-console#enable-or-disable-maintenance-mode + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/management-console#enable-or-disable-maintenance-mode openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /setup/api/settings - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/management-console#get-settings + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/management-console#get-settings openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /setup/api/settings - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/management-console#set-settings + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/management-console#set-settings openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /setup/api/settings/authorized-keys - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/management-console#remove-an-authorized-ssh-key + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/management-console#remove-an-authorized-ssh-key openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /setup/api/settings/authorized-keys - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/management-console#get-all-authorized-ssh-keys + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/management-console#get-all-authorized-ssh-keys openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /setup/api/settings/authorized-keys - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/management-console#add-an-authorized-ssh-key + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/management-console#add-an-authorized-ssh-key openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /setup/api/start - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/management-console#create-a-github-license + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/management-console#create-a-github-license openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /setup/api/upgrade - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/management-console#upgrade-a-license + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/management-console#upgrade-a-license openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /teams/{team_id} documentation_url: https://docs.github.com/rest/teams/teams#delete-a-team-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /teams/{team_id} documentation_url: https://docs.github.com/rest/teams/teams#get-a-team-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /teams/{team_id} documentation_url: https://docs.github.com/rest/teams/teams#update-a-team-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /teams/{team_id}/discussions documentation_url: https://docs.github.com/rest/teams/discussions#list-discussions-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /teams/{team_id}/discussions documentation_url: https://docs.github.com/rest/teams/discussions#create-a-discussion-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /teams/{team_id}/discussions/{discussion_number} documentation_url: https://docs.github.com/rest/teams/discussions#delete-a-discussion-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /teams/{team_id}/discussions/{discussion_number} documentation_url: https://docs.github.com/rest/teams/discussions#get-a-discussion-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /teams/{team_id}/discussions/{discussion_number} documentation_url: https://docs.github.com/rest/teams/discussions#update-a-discussion-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /teams/{team_id}/discussions/{discussion_number}/comments documentation_url: https://docs.github.com/rest/teams/discussion-comments#list-discussion-comments-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /teams/{team_id}/discussions/{discussion_number}/comments documentation_url: https://docs.github.com/rest/teams/discussion-comments#create-a-discussion-comment-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number} documentation_url: https://docs.github.com/rest/teams/discussion-comments#delete-a-discussion-comment-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number} documentation_url: https://docs.github.com/rest/teams/discussion-comments#get-a-discussion-comment-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number} documentation_url: https://docs.github.com/rest/teams/discussion-comments#update-a-discussion-comment-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions documentation_url: https://docs.github.com/rest/reactions/reactions#list-reactions-for-a-team-discussion-comment-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions documentation_url: https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-team-discussion-comment-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /teams/{team_id}/discussions/{discussion_number}/reactions documentation_url: https://docs.github.com/rest/reactions/reactions#list-reactions-for-a-team-discussion-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /teams/{team_id}/discussions/{discussion_number}/reactions documentation_url: https://docs.github.com/rest/reactions/reactions#create-reaction-for-a-team-discussion-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /teams/{team_id}/invitations documentation_url: https://docs.github.com/rest/teams/members#list-pending-team-invitations-legacy openapi_files: @@ -5526,91 +5668,91 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /teams/{team_id}/members/{username} documentation_url: https://docs.github.com/rest/teams/members#remove-team-member-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /teams/{team_id}/members/{username} documentation_url: https://docs.github.com/rest/teams/members#get-team-member-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /teams/{team_id}/members/{username} documentation_url: https://docs.github.com/rest/teams/members#add-team-member-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /teams/{team_id}/memberships/{username} documentation_url: https://docs.github.com/rest/teams/members#remove-team-membership-for-a-user-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /teams/{team_id}/memberships/{username} documentation_url: https://docs.github.com/rest/teams/members#get-team-membership-for-a-user-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /teams/{team_id}/memberships/{username} documentation_url: https://docs.github.com/rest/teams/members#add-or-update-team-membership-for-a-user-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /teams/{team_id}/projects documentation_url: https://docs.github.com/rest/teams/teams#list-team-projects-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /teams/{team_id}/projects/{project_id} documentation_url: https://docs.github.com/rest/teams/teams#remove-a-project-from-a-team-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /teams/{team_id}/projects/{project_id} documentation_url: https://docs.github.com/rest/teams/teams#check-team-permissions-for-a-project-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /teams/{team_id}/projects/{project_id} documentation_url: https://docs.github.com/rest/teams/teams#add-or-update-team-project-permissions-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /teams/{team_id}/repos documentation_url: https://docs.github.com/rest/teams/teams#list-team-repositories-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /teams/{team_id}/repos/{owner}/{repo} documentation_url: https://docs.github.com/rest/teams/teams#remove-a-repository-from-a-team-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /teams/{team_id}/repos/{owner}/{repo} documentation_url: https://docs.github.com/rest/teams/teams#check-team-permissions-for-a-repository-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /teams/{team_id}/repos/{owner}/{repo} documentation_url: https://docs.github.com/rest/teams/teams#add-or-update-team-repository-permissions-legacy openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /teams/{team_id}/team-sync/group-mappings documentation_url: https://docs.github.com/enterprise-cloud@latest//rest/teams/team-sync#list-idp-groups-for-a-team-legacy openapi_files: @@ -5624,19 +5766,19 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /user documentation_url: https://docs.github.com/rest/users/users#get-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /user documentation_url: https://docs.github.com/rest/users/users#update-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /user/blocks documentation_url: https://docs.github.com/rest/users/blocking#list-users-blocked-by-the-authenticated-user openapi_files: @@ -5762,7 +5904,7 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /user/email/visibility documentation_url: https://docs.github.com/rest/users/emails#set-primary-email-visibility-for-the-authenticated-user openapi_files: @@ -5773,97 +5915,97 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /user/emails documentation_url: https://docs.github.com/rest/users/emails#list-email-addresses-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /user/emails documentation_url: https://docs.github.com/rest/users/emails#add-an-email-address-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /user/followers documentation_url: https://docs.github.com/rest/users/followers#list-followers-of-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /user/following documentation_url: https://docs.github.com/rest/users/followers#list-the-people-the-authenticated-user-follows openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /user/following/{username} documentation_url: https://docs.github.com/rest/users/followers#unfollow-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /user/following/{username} documentation_url: https://docs.github.com/rest/users/followers#check-if-a-person-is-followed-by-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /user/following/{username} documentation_url: https://docs.github.com/rest/users/followers#follow-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /user/gpg_keys documentation_url: https://docs.github.com/rest/users/gpg-keys#list-gpg-keys-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /user/gpg_keys documentation_url: https://docs.github.com/rest/users/gpg-keys#create-a-gpg-key-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /user/gpg_keys/{gpg_key_id} documentation_url: https://docs.github.com/rest/users/gpg-keys#delete-a-gpg-key-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /user/gpg_keys/{gpg_key_id} documentation_url: https://docs.github.com/rest/users/gpg-keys#get-a-gpg-key-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /user/installations documentation_url: https://docs.github.com/rest/apps/installations#list-app-installations-accessible-to-the-user-access-token openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /user/installations/{installation_id}/repositories documentation_url: https://docs.github.com/rest/apps/installations#list-repositories-accessible-to-the-user-access-token openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /user/installations/{installation_id}/repositories/{repository_id} documentation_url: https://docs.github.com/rest/apps/installations#remove-a-repository-from-an-app-installation openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /user/installations/{installation_id}/repositories/{repository_id} documentation_url: https://docs.github.com/rest/apps/installations#add-a-repository-to-an-app-installation openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /user/interaction-limits documentation_url: https://docs.github.com/rest/interactions/user#remove-interaction-restrictions-from-your-public-repositories openapi_files: @@ -5884,31 +6026,31 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /user/keys documentation_url: https://docs.github.com/rest/users/keys#list-public-ssh-keys-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /user/keys documentation_url: https://docs.github.com/rest/users/keys#create-a-public-ssh-key-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /user/keys/{key_id} documentation_url: https://docs.github.com/rest/users/keys#delete-a-public-ssh-key-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /user/keys/{key_id} documentation_url: https://docs.github.com/rest/users/keys#get-a-public-ssh-key-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /user/marketplace_purchases documentation_url: https://docs.github.com/rest/apps/marketplace#list-subscriptions-for-the-authenticated-user openapi_files: @@ -5924,31 +6066,31 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /user/memberships/orgs/{org} documentation_url: https://docs.github.com/rest/orgs/members#get-an-organization-membership-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /user/memberships/orgs/{org} documentation_url: https://docs.github.com/rest/orgs/members#update-an-organization-membership-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /user/migrations documentation_url: https://docs.github.com/rest/migrations/users#list-user-migrations openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /user/migrations documentation_url: https://docs.github.com/rest/migrations/users#start-a-user-migration openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /user/migrations/{migration_id} documentation_url: https://docs.github.com/rest/migrations/users#get-a-user-migration-status openapi_files: @@ -5964,7 +6106,7 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /user/migrations/{migration_id}/repos/{repo_name}/lock documentation_url: https://docs.github.com/rest/migrations/users#unlock-a-user-repository openapi_files: @@ -5975,343 +6117,343 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /user/orgs documentation_url: https://docs.github.com/rest/orgs/orgs#list-organizations-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /user/packages documentation_url: https://docs.github.com/rest/packages/packages#list-packages-for-the-authenticated-users-namespace openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /user/packages/{package_type}/{package_name} documentation_url: https://docs.github.com/rest/packages/packages#delete-a-package-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /user/packages/{package_type}/{package_name} documentation_url: https://docs.github.com/rest/packages/packages#get-a-package-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /user/packages/{package_type}/{package_name}/restore documentation_url: https://docs.github.com/rest/packages/packages#restore-a-package-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /user/packages/{package_type}/{package_name}/versions documentation_url: https://docs.github.com/rest/packages/packages#list-package-versions-for-a-package-owned-by-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /user/packages/{package_type}/{package_name}/versions/{package_version_id} documentation_url: https://docs.github.com/rest/packages/packages#delete-a-package-version-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /user/packages/{package_type}/{package_name}/versions/{package_version_id} documentation_url: https://docs.github.com/rest/packages/packages#get-a-package-version-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /user/packages/{package_type}/{package_name}/versions/{package_version_id}/restore documentation_url: https://docs.github.com/rest/packages/packages#restore-a-package-version-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /user/projects documentation_url: https://docs.github.com/rest/projects/projects#create-a-user-project openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /user/public_emails documentation_url: https://docs.github.com/rest/users/emails#list-public-email-addresses-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /user/repos documentation_url: https://docs.github.com/rest/repos/repos#list-repositories-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /user/repos documentation_url: https://docs.github.com/rest/repos/repos#create-a-repository-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /user/repository_invitations documentation_url: https://docs.github.com/rest/collaborators/invitations#list-repository-invitations-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /user/repository_invitations/{invitation_id} documentation_url: https://docs.github.com/rest/collaborators/invitations#decline-a-repository-invitation openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PATCH /user/repository_invitations/{invitation_id} documentation_url: https://docs.github.com/rest/collaborators/invitations#accept-a-repository-invitation openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /user/social_accounts documentation_url: https://docs.github.com/rest/users/social-accounts#delete-social-accounts-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /user/social_accounts documentation_url: https://docs.github.com/rest/users/social-accounts#list-social-accounts-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /user/social_accounts documentation_url: https://docs.github.com/rest/users/social-accounts#add-social-accounts-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /user/ssh_signing_keys documentation_url: https://docs.github.com/rest/users/ssh-signing-keys#list-ssh-signing-keys-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /user/ssh_signing_keys documentation_url: https://docs.github.com/rest/users/ssh-signing-keys#create-a-ssh-signing-key-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /user/ssh_signing_keys/{ssh_signing_key_id} documentation_url: https://docs.github.com/rest/users/ssh-signing-keys#delete-an-ssh-signing-key-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /user/ssh_signing_keys/{ssh_signing_key_id} documentation_url: https://docs.github.com/rest/users/ssh-signing-keys#get-an-ssh-signing-key-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /user/starred documentation_url: https://docs.github.com/rest/activity/starring#list-repositories-starred-by-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /user/starred/{owner}/{repo} documentation_url: https://docs.github.com/rest/activity/starring#unstar-a-repository-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /user/starred/{owner}/{repo} documentation_url: https://docs.github.com/rest/activity/starring#check-if-a-repository-is-starred-by-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /user/starred/{owner}/{repo} documentation_url: https://docs.github.com/rest/activity/starring#star-a-repository-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /user/subscriptions documentation_url: https://docs.github.com/rest/activity/watching#list-repositories-watched-by-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /user/teams documentation_url: https://docs.github.com/rest/teams/teams#list-teams-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /users documentation_url: https://docs.github.com/rest/users/users#list-users openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /users/{username} documentation_url: https://docs.github.com/rest/users/users#get-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /users/{username}/docker/conflicts documentation_url: https://docs.github.com/rest/packages/packages#get-list-of-conflicting-packages-during-docker-migration-for-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /users/{username}/events documentation_url: https://docs.github.com/rest/activity/events#list-events-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /users/{username}/events/orgs/{org} documentation_url: https://docs.github.com/rest/activity/events#list-organization-events-for-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /users/{username}/events/public documentation_url: https://docs.github.com/rest/activity/events#list-public-events-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /users/{username}/followers documentation_url: https://docs.github.com/rest/users/followers#list-followers-of-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /users/{username}/following documentation_url: https://docs.github.com/rest/users/followers#list-the-people-a-user-follows openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /users/{username}/following/{target_user} documentation_url: https://docs.github.com/rest/users/followers#check-if-a-user-follows-another-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /users/{username}/gists documentation_url: https://docs.github.com/rest/gists/gists#list-gists-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /users/{username}/gpg_keys documentation_url: https://docs.github.com/rest/users/gpg-keys#list-gpg-keys-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /users/{username}/hovercard documentation_url: https://docs.github.com/rest/users/users#get-contextual-information-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /users/{username}/installation documentation_url: https://docs.github.com/rest/apps/apps#get-a-user-installation-for-the-authenticated-app openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /users/{username}/keys documentation_url: https://docs.github.com/rest/users/keys#list-public-keys-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /users/{username}/orgs documentation_url: https://docs.github.com/rest/orgs/orgs#list-organizations-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /users/{username}/packages documentation_url: https://docs.github.com/rest/packages/packages#list-packages-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /users/{username}/packages/{package_type}/{package_name} documentation_url: https://docs.github.com/rest/packages/packages#delete-a-package-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /users/{username}/packages/{package_type}/{package_name} documentation_url: https://docs.github.com/rest/packages/packages#get-a-package-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /users/{username}/packages/{package_type}/{package_name}/restore documentation_url: https://docs.github.com/rest/packages/packages#restore-a-package-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /users/{username}/packages/{package_type}/{package_name}/versions documentation_url: https://docs.github.com/rest/packages/packages#list-package-versions-for-a-package-owned-by-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id} documentation_url: https://docs.github.com/rest/packages/packages#delete-package-version-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id} documentation_url: https://docs.github.com/rest/packages/packages#get-a-package-version-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: POST /users/{username}/packages/{package_type}/{package_name}/versions/{package_version_id}/restore documentation_url: https://docs.github.com/rest/packages/packages#restore-package-version-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /users/{username}/projects documentation_url: https://docs.github.com/rest/projects/projects#list-user-projects openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /users/{username}/received_events documentation_url: https://docs.github.com/rest/activity/events#list-events-received-by-the-authenticated-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /users/{username}/received_events/public documentation_url: https://docs.github.com/rest/activity/events#list-public-events-received-by-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /users/{username}/repos documentation_url: https://docs.github.com/rest/repos/repos#list-repositories-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /users/{username}/settings/billing/actions documentation_url: https://docs.github.com/rest/billing/billing#get-github-actions-billing-for-a-user openapi_files: @@ -6328,45 +6470,45 @@ openapi_operations: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - name: DELETE /users/{username}/site_admin - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#demote-a-site-administrator + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/users#demote-a-site-administrator openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /users/{username}/site_admin - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#promote-a-user-to-be-a-site-administrator + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/users#promote-a-user-to-be-a-site-administrator openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /users/{username}/social_accounts documentation_url: https://docs.github.com/rest/users/social-accounts#list-social-accounts-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /users/{username}/ssh_signing_keys documentation_url: https://docs.github.com/rest/users/ssh-signing-keys#list-ssh-signing-keys-for-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /users/{username}/starred documentation_url: https://docs.github.com/rest/activity/starring#list-repositories-starred-by-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /users/{username}/subscriptions documentation_url: https://docs.github.com/rest/activity/watching#list-repositories-watched-by-a-user openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: DELETE /users/{username}/suspended - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#unsuspend-a-user + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/users#unsuspend-a-user openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: PUT /users/{username}/suspended - documentation_url: https://docs.github.com/enterprise-server@3.11/rest/enterprise-admin/users#suspend-a-user + documentation_url: https://docs.github.com/enterprise-server@3.12/rest/enterprise-admin/users#suspend-a-user openapi_files: - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json - name: GET /versions documentation_url: https://docs.github.com/rest/meta/meta#get-all-api-versions openapi_files: @@ -6377,4 +6519,4 @@ openapi_operations: openapi_files: - descriptions/api.github.com/api.github.com.json - descriptions/ghec/ghec.json - - descriptions/ghes-3.11/ghes-3.11.json + - descriptions/ghes-3.12/ghes-3.12.json From e75e456218d5d940cebb839eebc28839eeb9ad5f Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Thu, 28 Mar 2024 14:45:21 -0400 Subject: [PATCH 131/145] Add .*.local to .gitignore (#3115) --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 0c803b53aa6..8e24389445d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ *.sh !/script/*.sh *.test +.*.local coverage.out /bin # intellij files From e85a74dd6a47fc03e5de9b0cb0ee462be1ac5ad3 Mon Sep 17 00:00:00 2001 From: ganeshkumarsv <53483484+ganeshkumarsv@users.noreply.github.com> Date: Fri, 29 Mar 2024 11:38:06 -0400 Subject: [PATCH 132/145] Add CreateOrUpdateRepoCustomPropertyValues (#3109) --- github/repos_properties.go | 27 +++++++++++++++++++++++++++ github/repos_properties_test.go | 28 ++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/github/repos_properties.go b/github/repos_properties.go index 5a8626c4530..5b12bc8b30e 100644 --- a/github/repos_properties.go +++ b/github/repos_properties.go @@ -31,3 +31,30 @@ func (s *RepositoriesService) GetAllCustomPropertyValues(ctx context.Context, or return customPropertyValues, resp, nil } + +// CreateOrUpdateCustomProperties creates new or updates existing custom property values for a repository. +// +// GitHub API docs: https://docs.github.com/rest/repos/custom-properties#create-or-update-custom-property-values-for-a-repository +// +//meta:operation PATCH /repos/{owner}/{repo}/properties/values +func (s *RepositoriesService) CreateOrUpdateCustomProperties(ctx context.Context, org, repo string, customPropertyValues []*CustomPropertyValue) (*Response, error) { + u := fmt.Sprintf("repos/%v/%v/properties/values", org, repo) + + params := struct { + Properties []*CustomPropertyValue `json:"properties"` + }{ + Properties: customPropertyValues, + } + + req, err := s.client.NewRequest("PATCH", u, params) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + + return resp, nil +} diff --git a/github/repos_properties_test.go b/github/repos_properties_test.go index ee231a138c6..5ce05c26d7b 100644 --- a/github/repos_properties_test.go +++ b/github/repos_properties_test.go @@ -63,3 +63,31 @@ func TestRepositoriesService_GetAllCustomPropertyValues(t *testing.T) { return resp, err }) } + +func TestRepositoriesService_CreateOrUpdateCustomProperties(t *testing.T) { + client, mux, _, teardown := setup() + defer teardown() + + mux.HandleFunc("/repos/usr/r/properties/values", func(w http.ResponseWriter, r *http.Request) { + testMethod(t, r, "PATCH") + w.WriteHeader(http.StatusNoContent) + }) + + ctx := context.Background() + RepoCustomProperty := []*CustomPropertyValue{ + { + PropertyName: "environment", + Value: String("production"), + }, + } + _, err := client.Repositories.CreateOrUpdateCustomProperties(ctx, "usr", "r", RepoCustomProperty) + if err != nil { + t.Errorf("Repositories.CreateOrUpdateCustomProperties returned error: %v", err) + } + + const methodName = "CreateOrUpdateCustomProperties" + + testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { + return client.Repositories.CreateOrUpdateCustomProperties(ctx, "usr", "r", RepoCustomProperty) + }) +} From a4b145ac2406e3f63343e403605435ac98ea2ba6 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Mon, 1 Apr 2024 15:01:23 -0400 Subject: [PATCH 133/145] Bump version of go-github to v61.0.0 (#3118) --- README.md | 15 ++++++++------- example/actionpermissions/main.go | 2 +- example/appengine/app.go | 2 +- example/basicauth/main.go | 2 +- .../codespaces/newreposecretwithxcrypto/main.go | 2 +- .../codespaces/newusersecretwithxcrypto/main.go | 2 +- example/commitpr/main.go | 2 +- example/go.mod | 6 +++--- example/listenvironments/main.go | 2 +- example/migrations/main.go | 2 +- example/newfilewithappauth/main.go | 2 +- example/newrepo/main.go | 2 +- example/newreposecretwithlibsodium/go.mod | 4 ++-- example/newreposecretwithlibsodium/main.go | 2 +- example/newreposecretwithxcrypto/main.go | 2 +- example/ratelimit/main.go | 2 +- example/simple/main.go | 2 +- example/tagprotection/main.go | 2 +- example/tokenauth/main.go | 2 +- example/topics/main.go | 2 +- github/doc.go | 2 +- github/examples_test.go | 2 +- github/github.go | 2 +- go.mod | 2 +- test/fields/fields.go | 2 +- test/integration/activity_test.go | 2 +- test/integration/authorizations_test.go | 2 +- test/integration/github_test.go | 2 +- test/integration/repos_test.go | 2 +- test/integration/users_test.go | 2 +- tools/go.mod | 4 ++-- tools/metadata/main.go | 2 +- tools/metadata/main_test.go | 2 +- tools/metadata/metadata.go | 2 +- tools/metadata/openapi.go | 2 +- 35 files changed, 46 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index 7e429525936..94e1cc544ee 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # go-github # [![go-github release (latest SemVer)](https://img.shields.io/github/v/release/google/go-github?sort=semver)](https://github.com/google/go-github/releases) -[![GoDoc](https://img.shields.io/static/v1?label=godoc&message=reference&color=blue)](https://pkg.go.dev/github.com/google/go-github/v60/github) +[![GoDoc](https://img.shields.io/static/v1?label=godoc&message=reference&color=blue)](https://pkg.go.dev/github.com/google/go-github/v61/github) [![Test Status](https://github.com/google/go-github/workflows/tests/badge.svg)](https://github.com/google/go-github/actions?query=workflow%3Atests) [![Test Coverage](https://codecov.io/gh/google/go-github/branch/master/graph/badge.svg)](https://codecov.io/gh/google/go-github) [![Discuss at go-github@googlegroups.com](https://img.shields.io/badge/discuss-go--github%40googlegroups.com-blue.svg)](https://groups.google.com/group/go-github) @@ -24,7 +24,7 @@ If you're interested in using the [GraphQL API v4][], the recommended library is go-github is compatible with modern Go releases in module mode, with Go installed: ```bash -go get github.com/google/go-github/v60 +go get github.com/google/go-github/v61 ``` will resolve and add the package to the current development module, along with its dependencies. @@ -32,7 +32,7 @@ will resolve and add the package to the current development module, along with i Alternatively the same can be achieved if you use import in a package: ```go -import "github.com/google/go-github/v60/github" +import "github.com/google/go-github/v61/github" ``` and run `go get` without parameters. @@ -40,13 +40,13 @@ and run `go get` without parameters. Finally, to use the top-of-trunk version of this repo, use the following command: ```bash -go get github.com/google/go-github/v60@master +go get github.com/google/go-github/v61@master ``` ## Usage ## ```go -import "github.com/google/go-github/v60/github" // with go modules enabled (GO111MODULE=on or outside GOPATH) +import "github.com/google/go-github/v61/github" // with go modules enabled (GO111MODULE=on or outside GOPATH) import "github.com/google/go-github/github" // with go modules disabled ``` @@ -117,7 +117,7 @@ import ( "net/http" "github.com/bradleyfalzon/ghinstallation/v2" - "github.com/google/go-github/v60/github" + "github.com/google/go-github/v61/github" ) func main() { @@ -296,7 +296,7 @@ For complete usage of go-github, see the full [package docs][]. [GitHub API v3]: https://docs.github.com/en/rest [personal access token]: https://github.com/blog/1509-personal-api-tokens -[package docs]: https://pkg.go.dev/github.com/google/go-github/v60/github +[package docs]: https://pkg.go.dev/github.com/google/go-github/v61/github [GraphQL API v4]: https://developer.github.com/v4/ [shurcooL/githubv4]: https://github.com/shurcooL/githubv4 [GitHub webhook events]: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads @@ -369,6 +369,7 @@ Versions prior to 48.2.0 are not listed. | go-github Version | GitHub v3 API Version | | ----------------- | --------------------- | +| 61.0.0 | 2022-11-28 | | 60.0.0 | 2022-11-28 | | 59.0.0 | 2022-11-28 | | 58.0.0 | 2022-11-28 | diff --git a/example/actionpermissions/main.go b/example/actionpermissions/main.go index 46a541ffa35..8453cf14827 100644 --- a/example/actionpermissions/main.go +++ b/example/actionpermissions/main.go @@ -14,7 +14,7 @@ import ( "log" "os" - "github.com/google/go-github/v60/github" + "github.com/google/go-github/v61/github" ) var ( diff --git a/example/appengine/app.go b/example/appengine/app.go index e8a578d5fea..1aa425d02f9 100644 --- a/example/appengine/app.go +++ b/example/appengine/app.go @@ -12,7 +12,7 @@ import ( "net/http" "os" - "github.com/google/go-github/v60/github" + "github.com/google/go-github/v61/github" "google.golang.org/appengine" "google.golang.org/appengine/log" ) diff --git a/example/basicauth/main.go b/example/basicauth/main.go index c5453573a9e..d7a74701e23 100644 --- a/example/basicauth/main.go +++ b/example/basicauth/main.go @@ -21,7 +21,7 @@ import ( "os" "strings" - "github.com/google/go-github/v60/github" + "github.com/google/go-github/v61/github" "golang.org/x/term" ) diff --git a/example/codespaces/newreposecretwithxcrypto/main.go b/example/codespaces/newreposecretwithxcrypto/main.go index 9fffd8fbcb7..a2ac7e45106 100644 --- a/example/codespaces/newreposecretwithxcrypto/main.go +++ b/example/codespaces/newreposecretwithxcrypto/main.go @@ -36,7 +36,7 @@ import ( "log" "os" - "github.com/google/go-github/v60/github" + "github.com/google/go-github/v61/github" "golang.org/x/crypto/nacl/box" ) diff --git a/example/codespaces/newusersecretwithxcrypto/main.go b/example/codespaces/newusersecretwithxcrypto/main.go index 72256136c40..ca6ac396459 100644 --- a/example/codespaces/newusersecretwithxcrypto/main.go +++ b/example/codespaces/newusersecretwithxcrypto/main.go @@ -37,7 +37,7 @@ import ( "log" "os" - "github.com/google/go-github/v60/github" + "github.com/google/go-github/v61/github" "golang.org/x/crypto/nacl/box" ) diff --git a/example/commitpr/main.go b/example/commitpr/main.go index ffe7aa4529f..021024b10d1 100644 --- a/example/commitpr/main.go +++ b/example/commitpr/main.go @@ -33,7 +33,7 @@ import ( "time" "github.com/ProtonMail/go-crypto/openpgp" - "github.com/google/go-github/v60/github" + "github.com/google/go-github/v61/github" ) var ( diff --git a/example/go.mod b/example/go.mod index 7a2473934ed..5b11139f25e 100644 --- a/example/go.mod +++ b/example/go.mod @@ -1,4 +1,4 @@ -module github.com/google/go-github/v60/example +module github.com/google/go-github/v61/example go 1.21 @@ -6,7 +6,7 @@ require ( github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 github.com/bradleyfalzon/ghinstallation/v2 v2.0.4 github.com/gofri/go-github-ratelimit v1.0.3 - github.com/google/go-github/v60 v60.0.0 + github.com/google/go-github/v61 v61.0.0 golang.org/x/crypto v0.17.0 golang.org/x/term v0.15.0 google.golang.org/appengine v1.6.7 @@ -24,4 +24,4 @@ require ( ) // Use version at HEAD, not the latest published. -replace github.com/google/go-github/v60 => ../ +replace github.com/google/go-github/v61 => ../ diff --git a/example/listenvironments/main.go b/example/listenvironments/main.go index 83cff102825..14d10949704 100644 --- a/example/listenvironments/main.go +++ b/example/listenvironments/main.go @@ -18,7 +18,7 @@ import ( "log" "os" - "github.com/google/go-github/v60/github" + "github.com/google/go-github/v61/github" ) func main() { diff --git a/example/migrations/main.go b/example/migrations/main.go index 8f3d80943c2..7771cbe9527 100644 --- a/example/migrations/main.go +++ b/example/migrations/main.go @@ -12,7 +12,7 @@ import ( "context" "fmt" - "github.com/google/go-github/v60/github" + "github.com/google/go-github/v61/github" ) func fetchAllUserMigrations() ([]*github.UserMigration, error) { diff --git a/example/newfilewithappauth/main.go b/example/newfilewithappauth/main.go index 9754af7b71e..18ecd7eb485 100644 --- a/example/newfilewithappauth/main.go +++ b/example/newfilewithappauth/main.go @@ -16,7 +16,7 @@ import ( "time" "github.com/bradleyfalzon/ghinstallation/v2" - "github.com/google/go-github/v60/github" + "github.com/google/go-github/v61/github" ) func main() { diff --git a/example/newrepo/main.go b/example/newrepo/main.go index 64f09a8f947..1326a2d9ce9 100644 --- a/example/newrepo/main.go +++ b/example/newrepo/main.go @@ -16,7 +16,7 @@ import ( "log" "os" - "github.com/google/go-github/v60/github" + "github.com/google/go-github/v61/github" ) var ( diff --git a/example/newreposecretwithlibsodium/go.mod b/example/newreposecretwithlibsodium/go.mod index 138068bca8f..84930ca7a94 100644 --- a/example/newreposecretwithlibsodium/go.mod +++ b/example/newreposecretwithlibsodium/go.mod @@ -6,10 +6,10 @@ toolchain go1.22.0 require ( github.com/GoKillers/libsodium-go v0.0.0-20171022220152-dd733721c3cb - github.com/google/go-github/v60 v60.0.0 + github.com/google/go-github/v61 v61.0.0 ) require github.com/google/go-querystring v1.1.0 // indirect // Use version at HEAD, not the latest published. -replace github.com/google/go-github/v60 => ../.. +replace github.com/google/go-github/v61 => ../.. diff --git a/example/newreposecretwithlibsodium/main.go b/example/newreposecretwithlibsodium/main.go index 9eb40ac875c..a61ff06ed7d 100644 --- a/example/newreposecretwithlibsodium/main.go +++ b/example/newreposecretwithlibsodium/main.go @@ -36,7 +36,7 @@ import ( "os" sodium "github.com/GoKillers/libsodium-go/cryptobox" - "github.com/google/go-github/v60/github" + "github.com/google/go-github/v61/github" ) var ( diff --git a/example/newreposecretwithxcrypto/main.go b/example/newreposecretwithxcrypto/main.go index 660e3004e1e..9bf8845e531 100644 --- a/example/newreposecretwithxcrypto/main.go +++ b/example/newreposecretwithxcrypto/main.go @@ -36,7 +36,7 @@ import ( "log" "os" - "github.com/google/go-github/v60/github" + "github.com/google/go-github/v61/github" "golang.org/x/crypto/nacl/box" ) diff --git a/example/ratelimit/main.go b/example/ratelimit/main.go index f7f8d1a52fc..276301c1c2c 100644 --- a/example/ratelimit/main.go +++ b/example/ratelimit/main.go @@ -13,7 +13,7 @@ import ( "fmt" "github.com/gofri/go-github-ratelimit/github_ratelimit" - "github.com/google/go-github/v60/github" + "github.com/google/go-github/v61/github" ) func main() { diff --git a/example/simple/main.go b/example/simple/main.go index af8c6ae8f78..5512c6cb5df 100644 --- a/example/simple/main.go +++ b/example/simple/main.go @@ -12,7 +12,7 @@ import ( "context" "fmt" - "github.com/google/go-github/v60/github" + "github.com/google/go-github/v61/github" ) // Fetch all the public organizations' membership of a user. diff --git a/example/tagprotection/main.go b/example/tagprotection/main.go index 2dad5a27369..f9bedf1f335 100644 --- a/example/tagprotection/main.go +++ b/example/tagprotection/main.go @@ -18,7 +18,7 @@ import ( "os" "strings" - "github.com/google/go-github/v60/github" + "github.com/google/go-github/v61/github" "golang.org/x/term" ) diff --git a/example/tokenauth/main.go b/example/tokenauth/main.go index 04c6e5a4ef7..0cf12a8b01d 100644 --- a/example/tokenauth/main.go +++ b/example/tokenauth/main.go @@ -15,7 +15,7 @@ import ( "log" "os" - "github.com/google/go-github/v60/github" + "github.com/google/go-github/v61/github" "golang.org/x/term" ) diff --git a/example/topics/main.go b/example/topics/main.go index 09ae6c203b5..b6e76bfd7e9 100644 --- a/example/topics/main.go +++ b/example/topics/main.go @@ -12,7 +12,7 @@ import ( "context" "fmt" - "github.com/google/go-github/v60/github" + "github.com/google/go-github/v61/github" ) // Fetch and lists all the public topics associated with the specified GitHub topic diff --git a/github/doc.go b/github/doc.go index 1896244d7f0..6c4b3a81a91 100644 --- a/github/doc.go +++ b/github/doc.go @@ -8,7 +8,7 @@ Package github provides a client for using the GitHub API. Usage: - import "github.com/google/go-github/v60/github" // with go modules enabled (GO111MODULE=on or outside GOPATH) + import "github.com/google/go-github/v61/github" // with go modules enabled (GO111MODULE=on or outside GOPATH) import "github.com/google/go-github/github" // with go modules disabled Construct a new GitHub client, then use the various services on the client to diff --git a/github/examples_test.go b/github/examples_test.go index cb22fecd95b..4dbd17e1ba8 100644 --- a/github/examples_test.go +++ b/github/examples_test.go @@ -12,7 +12,7 @@ import ( "fmt" "log" - "github.com/google/go-github/v60/github" + "github.com/google/go-github/v61/github" ) func ExampleMarkdownService_Render() { diff --git a/github/github.go b/github/github.go index bf0b5715a89..03e2e6273cf 100644 --- a/github/github.go +++ b/github/github.go @@ -28,7 +28,7 @@ import ( ) const ( - Version = "v60.0.0" + Version = "v61.0.0" defaultAPIVersion = "2022-11-28" defaultBaseURL = "https://api.github.com/" diff --git a/go.mod b/go.mod index b00b053ad8c..a2a7aeed191 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/google/go-github/v60 +module github.com/google/go-github/v61 require ( github.com/google/go-cmp v0.6.0 diff --git a/test/fields/fields.go b/test/fields/fields.go index 5dea9bcfd43..0629dd33e6a 100644 --- a/test/fields/fields.go +++ b/test/fields/fields.go @@ -25,7 +25,7 @@ import ( "reflect" "strings" - "github.com/google/go-github/v60/github" + "github.com/google/go-github/v61/github" ) var ( diff --git a/test/integration/activity_test.go b/test/integration/activity_test.go index 0a9744df1a3..6a70c42b05a 100644 --- a/test/integration/activity_test.go +++ b/test/integration/activity_test.go @@ -12,7 +12,7 @@ import ( "context" "testing" - "github.com/google/go-github/v60/github" + "github.com/google/go-github/v61/github" ) const ( diff --git a/test/integration/authorizations_test.go b/test/integration/authorizations_test.go index f6edbd8aada..d5cfb6f51e0 100644 --- a/test/integration/authorizations_test.go +++ b/test/integration/authorizations_test.go @@ -15,7 +15,7 @@ import ( "testing" "time" - "github.com/google/go-github/v60/github" + "github.com/google/go-github/v61/github" ) const msgEnvMissing = "Skipping test because the required environment variable (%v) is not present." diff --git a/test/integration/github_test.go b/test/integration/github_test.go index 642cb406ff0..fb581679e2c 100644 --- a/test/integration/github_test.go +++ b/test/integration/github_test.go @@ -15,7 +15,7 @@ import ( "net/http" "os" - "github.com/google/go-github/v60/github" + "github.com/google/go-github/v61/github" ) var ( diff --git a/test/integration/repos_test.go b/test/integration/repos_test.go index 9451bf81e52..5737950c664 100644 --- a/test/integration/repos_test.go +++ b/test/integration/repos_test.go @@ -15,7 +15,7 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/google/go-github/v60/github" + "github.com/google/go-github/v61/github" ) func TestRepositories_CRUD(t *testing.T) { diff --git a/test/integration/users_test.go b/test/integration/users_test.go index 0a2d9c8aebe..5f40622b22b 100644 --- a/test/integration/users_test.go +++ b/test/integration/users_test.go @@ -14,7 +14,7 @@ import ( "math/rand" "testing" - "github.com/google/go-github/v60/github" + "github.com/google/go-github/v61/github" ) func TestUsers_Get(t *testing.T) { diff --git a/tools/go.mod b/tools/go.mod index 874aa769d2c..e6e95c644de 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -8,7 +8,7 @@ require ( github.com/alecthomas/kong v0.9.0 github.com/getkin/kin-openapi v0.123.0 github.com/google/go-cmp v0.6.0 - github.com/google/go-github/v60 v60.0.0 + github.com/google/go-github/v61 v61.0.0 golang.org/x/sync v0.6.0 gopkg.in/yaml.v3 v3.0.1 ) @@ -25,4 +25,4 @@ require ( ) // Use version at HEAD, not the latest published. -replace github.com/google/go-github/v60 => ../ +replace github.com/google/go-github/v61 => ../ diff --git a/tools/metadata/main.go b/tools/metadata/main.go index 9b279fff182..f846d1cad8c 100644 --- a/tools/metadata/main.go +++ b/tools/metadata/main.go @@ -15,7 +15,7 @@ import ( "path/filepath" "github.com/alecthomas/kong" - "github.com/google/go-github/v60/github" + "github.com/google/go-github/v61/github" ) var helpVars = kong.Vars{ diff --git a/tools/metadata/main_test.go b/tools/metadata/main_test.go index 1118414d12f..059c2b72b54 100644 --- a/tools/metadata/main_test.go +++ b/tools/metadata/main_test.go @@ -23,7 +23,7 @@ import ( "github.com/alecthomas/kong" "github.com/getkin/kin-openapi/openapi3" "github.com/google/go-cmp/cmp" - "github.com/google/go-github/v60/github" + "github.com/google/go-github/v61/github" ) func TestUpdateGo(t *testing.T) { diff --git a/tools/metadata/metadata.go b/tools/metadata/metadata.go index 4a87603e8d1..2becaaabe73 100644 --- a/tools/metadata/metadata.go +++ b/tools/metadata/metadata.go @@ -24,7 +24,7 @@ import ( "strings" "sync" - "github.com/google/go-github/v60/github" + "github.com/google/go-github/v61/github" "gopkg.in/yaml.v3" ) diff --git a/tools/metadata/openapi.go b/tools/metadata/openapi.go index ae18b66b258..07ac9fd033b 100644 --- a/tools/metadata/openapi.go +++ b/tools/metadata/openapi.go @@ -14,7 +14,7 @@ import ( "strconv" "github.com/getkin/kin-openapi/openapi3" - "github.com/google/go-github/v60/github" + "github.com/google/go-github/v61/github" "golang.org/x/sync/errgroup" ) From 7d2e4b2ce0d360d62f37dfc9edcf23a8bed8b3e7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Apr 2024 15:51:12 -0400 Subject: [PATCH 134/145] Bump codecov/codecov-action from 4.1.0 to 4.1.1 (#3120) --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index fdde6151063..760fb6c9191 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -73,4 +73,4 @@ jobs: - name: Upload coverage to Codecov if: ${{ matrix.update-coverage }} - uses: codecov/codecov-action@54bcd8715eee62d40e33596ef5e8f0f48dbbccab #v4.1.0 + uses: codecov/codecov-action@c16abc29c95fcf9174b58eb7e1abf4c866893bc8 #v4.1.1 From 2e3b8e928a35d7d1117aee7d5115664d65fb8777 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Mon, 1 Apr 2024 16:39:00 -0400 Subject: [PATCH 135/145] Bump go-github from v60 to v61 in /scrape (#3119) --- scrape/apps.go | 2 +- scrape/apps_test.go | 2 +- scrape/go.mod | 2 +- scrape/go.sum | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scrape/apps.go b/scrape/apps.go index fcf61588730..7bb2d6f30d6 100644 --- a/scrape/apps.go +++ b/scrape/apps.go @@ -17,7 +17,7 @@ import ( "strings" "github.com/PuerkitoBio/goquery" - "github.com/google/go-github/v60/github" + "github.com/google/go-github/v61/github" ) // AppRestrictionsEnabled returns whether the specified organization has diff --git a/scrape/apps_test.go b/scrape/apps_test.go index c0a6a751de3..65c88a787c1 100644 --- a/scrape/apps_test.go +++ b/scrape/apps_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/google/go-github/v60/github" + "github.com/google/go-github/v61/github" ) func Test_AppRestrictionsEnabled(t *testing.T) { diff --git a/scrape/go.mod b/scrape/go.mod index f48713d021c..445cf7023a4 100644 --- a/scrape/go.mod +++ b/scrape/go.mod @@ -7,7 +7,7 @@ toolchain go1.22.0 require ( github.com/PuerkitoBio/goquery v1.9.1 github.com/google/go-cmp v0.6.0 - github.com/google/go-github/v60 v60.0.0 + github.com/google/go-github/v61 v61.0.0 github.com/xlzd/gotp v0.1.0 golang.org/x/net v0.22.0 ) diff --git a/scrape/go.sum b/scrape/go.sum index 3c8442f6aec..b17e88c87d4 100644 --- a/scrape/go.sum +++ b/scrape/go.sum @@ -5,8 +5,8 @@ github.com/andybalholm/cascadia v1.3.2/go.mod h1:7gtRlve5FxPPgIgX36uWBX58OdBsSS6 github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-github/v60 v60.0.0 h1:oLG98PsLauFvvu4D/YPxq374jhSxFYdzQGNCyONLfn8= -github.com/google/go-github/v60 v60.0.0/go.mod h1:ByhX2dP9XT9o/ll2yXAu2VD8l5eNVg8hD4Cr0S/LmQk= +github.com/google/go-github/v61 v61.0.0 h1:VwQCBwhyE9JclCI+22/7mLB1PuU9eowCXKY5pNlu1go= +github.com/google/go-github/v61 v61.0.0/go.mod h1:0WR+KmsWX75G2EbpyGsGmradjo3IiciuI4BmdVCobQY= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/xlzd/gotp v0.1.0 h1:37blvlKCh38s+fkem+fFh7sMnceltoIEBYTVXyoa5Po= From 9b87ff3d9657f1d6a90f02b98e4bd14dc6df9634 Mon Sep 17 00:00:00 2001 From: tomfeigin Date: Tue, 2 Apr 2024 02:07:12 +0300 Subject: [PATCH 136/145] Print the unrecognized repository rule type (#3113) --- github/repos_rules.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/repos_rules.go b/github/repos_rules.go index 9f4e0245f08..34711dda979 100644 --- a/github/repos_rules.go +++ b/github/repos_rules.go @@ -204,7 +204,7 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error { default: r.Type = "" r.Parameters = nil - return fmt.Errorf("RepositoryRule.Type %T is not yet implemented, unable to unmarshal", RepositoryRule.Type) + return fmt.Errorf("RepositoryRule.Type %q is not yet implemented, unable to unmarshal (%#v)", RepositoryRule.Type, RepositoryRule) } return nil From 24209f034709de1744be65544f45962d925b4614 Mon Sep 17 00:00:00 2001 From: Liam Stanley Date: Wed, 3 Apr 2024 15:51:18 -0400 Subject: [PATCH 137/145] feat: Add missing github enterprise importer and domains meta fields (#3121) --- github/meta.go | 14 +++++++++++--- github/meta_test.go | 30 ++++++++++++++++++++---------- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/github/meta.go b/github/meta.go index 1da8fcf1326..e0e355e8cd0 100644 --- a/github/meta.go +++ b/github/meta.go @@ -17,11 +17,11 @@ type MetaService service // APIMeta represents metadata about the GitHub API. type APIMeta struct { - // An Array of IP addresses in CIDR format specifying the addresses + // An array of IP addresses in CIDR format specifying the addresses // that incoming service hooks will originate from on GitHub.com. Hooks []string `json:"hooks,omitempty"` - // An Array of IP addresses in CIDR format specifying the Git servers + // An array of IP addresses in CIDR format specifying the Git servers // for GitHub.com. Git []string `json:"git,omitempty"` @@ -40,10 +40,14 @@ type APIMeta struct { // which serve GitHub Pages websites. Pages []string `json:"pages,omitempty"` - // An Array of IP addresses specifying the addresses that source imports + // An array of IP addresses specifying the addresses that source imports // will originate from on GitHub.com. Importer []string `json:"importer,omitempty"` + // An array of IP addresses specifying the addresses that source imports + // will originate from on GitHub Enterprise Cloud. + GithubEnterpriseImporter []string `json:"github_enterprise_importer,omitempty"` + // An array of IP addresses in CIDR format specifying the IP addresses // GitHub Actions will originate from. Actions []string `json:"actions,omitempty"` @@ -65,6 +69,10 @@ type APIMeta struct { // An array of IP addresses in CIDR format specifying the addresses // which serve GitHub APIs. API []string `json:"api,omitempty"` + + // A map of GitHub services and their associated domains. Note that many + // of these domains are represented as wildcards (e.g. "*.github.com"). + Domains map[string][]string `json:"domains,omitempty"` } // Get returns information about GitHub.com, the service. Or, if you access diff --git a/github/meta_test.go b/github/meta_test.go index c7b01e298ed..99cb0b02ceb 100644 --- a/github/meta_test.go +++ b/github/meta_test.go @@ -23,12 +23,16 @@ func TestAPIMeta_Marshal(t *testing.T) { VerifiablePasswordAuthentication: Bool(true), Pages: []string{"p"}, Importer: []string{"i"}, + GithubEnterpriseImporter: []string{"gei"}, Actions: []string{"a"}, Dependabot: []string{"d"}, SSHKeyFingerprints: map[string]string{"a": "f"}, SSHKeys: []string{"k"}, API: []string{"a"}, Web: []string{"w"}, + Domains: map[string][]string{ + "example": {"example.com", "*.example.com"}, + }, } want := `{ "hooks":["h"], @@ -36,12 +40,14 @@ func TestAPIMeta_Marshal(t *testing.T) { "verifiable_password_authentication":true, "pages":["p"], "importer":["i"], + "github_enterprise_importer":["gei"], "actions":["a"], "dependabot":["d"], "ssh_key_fingerprints":{"a":"f"}, "ssh_keys":["k"], "api":["a"], - "web":["w"] + "web":["w"], + "domains":{"example":["example.com","*.example.com"]} }` testJSONMarshal(t, a, want) @@ -53,7 +59,7 @@ func TestMetaService_Get(t *testing.T) { mux.HandleFunc("/meta", func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, "GET") - fmt.Fprint(w, `{"web":["w"],"api":["a"],"hooks":["h"], "git":["g"], "pages":["p"], "importer":["i"], "actions":["a"], "dependabot":["d"], "verifiable_password_authentication": true}`) + fmt.Fprint(w, `{"web":["w"],"api":["a"],"hooks":["h"], "git":["g"], "pages":["p"], "importer":["i"], "github_enterprise_importer": ["gei"], "actions":["a"], "dependabot":["d"], "verifiable_password_authentication": true, "domains":{"example":["example.com","*.example.com"]}}`) }) ctx := context.Background() @@ -63,14 +69,18 @@ func TestMetaService_Get(t *testing.T) { } want := &APIMeta{ - Hooks: []string{"h"}, - Git: []string{"g"}, - Pages: []string{"p"}, - Importer: []string{"i"}, - Actions: []string{"a"}, - Dependabot: []string{"d"}, - API: []string{"a"}, - Web: []string{"w"}, + Hooks: []string{"h"}, + Git: []string{"g"}, + Pages: []string{"p"}, + Importer: []string{"i"}, + GithubEnterpriseImporter: []string{"gei"}, + Actions: []string{"a"}, + Dependabot: []string{"d"}, + API: []string{"a"}, + Web: []string{"w"}, + Domains: map[string][]string{ + "example": {"example.com", "*.example.com"}, + }, VerifiablePasswordAuthentication: Bool(true), } From 224c0aec4302309d811cf492703b2ac487732540 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Apr 2024 15:27:02 -0400 Subject: [PATCH 138/145] Bump github.com/getkin/kin-openapi from 0.123.0 to 0.124.0 in /tools (#3122) --- tools/go.mod | 2 +- tools/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/go.mod b/tools/go.mod index e6e95c644de..b4a206960c4 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -6,7 +6,7 @@ toolchain go1.22.0 require ( github.com/alecthomas/kong v0.9.0 - github.com/getkin/kin-openapi v0.123.0 + github.com/getkin/kin-openapi v0.124.0 github.com/google/go-cmp v0.6.0 github.com/google/go-github/v61 v61.0.0 golang.org/x/sync v0.6.0 diff --git a/tools/go.sum b/tools/go.sum index ce5b0414f82..d6349d01278 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -6,8 +6,8 @@ github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc github.com/alecthomas/repr v0.4.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/getkin/kin-openapi v0.123.0 h1:zIik0mRwFNLyvtXK274Q6ut+dPh6nlxBp0x7mNrPhs8= -github.com/getkin/kin-openapi v0.123.0/go.mod h1:wb1aSZA/iWmorQP9KTAS/phLj/t17B5jT7+fS8ed9NM= +github.com/getkin/kin-openapi v0.124.0 h1:VSFNMB9C9rTKBnQ/fpyDU8ytMTr4dWI9QovSKj9kz/M= +github.com/getkin/kin-openapi v0.124.0/go.mod h1:wb1aSZA/iWmorQP9KTAS/phLj/t17B5jT7+fS8ed9NM= github.com/go-openapi/jsonpointer v0.20.2 h1:mQc3nmndL8ZBzStEo3JYF8wzmeWffDH4VbXz58sAx6Q= github.com/go-openapi/jsonpointer v0.20.2/go.mod h1:bHen+N0u1KEO3YlmqOjTT9Adn1RfD91Ar825/PuiRVs= github.com/go-openapi/swag v0.22.8 h1:/9RjDSQ0vbFR+NyjGMkFTsA1IA0fmhKSThmfGZjicbw= From 33609b63bd1b2a6b4c276d8f27f4c12eea55786c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Apr 2024 15:42:19 -0400 Subject: [PATCH 139/145] Bump golang.org/x/sync from 0.6.0 to 0.7.0 in /tools (#3123) --- tools/go.mod | 2 +- tools/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/go.mod b/tools/go.mod index b4a206960c4..07515cb5ff0 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -9,7 +9,7 @@ require ( github.com/getkin/kin-openapi v0.124.0 github.com/google/go-cmp v0.6.0 github.com/google/go-github/v61 v61.0.0 - golang.org/x/sync v0.6.0 + golang.org/x/sync v0.7.0 gopkg.in/yaml.v3 v3.0.1 ) diff --git a/tools/go.sum b/tools/go.sum index d6349d01278..a9e50530749 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -43,8 +43,8 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= -golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= -golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= From 0a7c7fd5aabf2a53fc9c77e7e4222a9f391c16ce Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Apr 2024 15:44:51 -0400 Subject: [PATCH 140/145] Bump codecov/codecov-action from 4.1.1 to 4.2.0 (#3124) --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 760fb6c9191..da8143a7aeb 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -73,4 +73,4 @@ jobs: - name: Upload coverage to Codecov if: ${{ matrix.update-coverage }} - uses: codecov/codecov-action@c16abc29c95fcf9174b58eb7e1abf4c866893bc8 #v4.1.1 + uses: codecov/codecov-action@7afa10ed9b269c561c2336fd862446844e0cbf71 #v4.2.0 From b603120bf932e99e8cc0a9fab0693fa6b5f92c4d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Apr 2024 15:49:51 -0400 Subject: [PATCH 141/145] Bump golang.org/x/net from 0.22.0 to 0.24.0 in /scrape (#3125) --- scrape/go.mod | 2 +- scrape/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scrape/go.mod b/scrape/go.mod index 445cf7023a4..d3e23404724 100644 --- a/scrape/go.mod +++ b/scrape/go.mod @@ -9,7 +9,7 @@ require ( github.com/google/go-cmp v0.6.0 github.com/google/go-github/v61 v61.0.0 github.com/xlzd/gotp v0.1.0 - golang.org/x/net v0.22.0 + golang.org/x/net v0.24.0 ) require ( diff --git a/scrape/go.sum b/scrape/go.sum index b17e88c87d4..8c603f69ac6 100644 --- a/scrape/go.sum +++ b/scrape/go.sum @@ -21,8 +21,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= -golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= -golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= +golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= +golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= From a6806bc71d514c2104a596dd44ebe74830adf330 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Apr 2024 17:05:28 -0400 Subject: [PATCH 142/145] Bump codecov/codecov-action from 4.2.0 to 4.3.0 (#3128) --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index da8143a7aeb..efac3df3d90 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -73,4 +73,4 @@ jobs: - name: Upload coverage to Codecov if: ${{ matrix.update-coverage }} - uses: codecov/codecov-action@7afa10ed9b269c561c2336fd862446844e0cbf71 #v4.2.0 + uses: codecov/codecov-action@84508663e988701840491b86de86b666e8a86bed #v4.3.0 From b02f283714b9150fd31eaa60bc805814f50a1447 Mon Sep 17 00:00:00 2001 From: Matthew William Reidy <48036844+Matthew-Reidy@users.noreply.github.com> Date: Thu, 18 Apr 2024 18:25:10 -0700 Subject: [PATCH 143/145] Add support for merge queue ruleset JSON unmarshaling (#3131) Fixes: #3098. --- AUTHORS | 3 ++- github/orgs_rules_test.go | 10 ++++++++++ github/repos_rules.go | 9 ++++++++- github/repos_rules_test.go | 7 +++++++ 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/AUTHORS b/AUTHORS index 74a21dc604e..0197b94a23a 100644 --- a/AUTHORS +++ b/AUTHORS @@ -303,6 +303,7 @@ Matt Gaunt Matt Landis Matt Moore Matt Simons +Matthew Reidy Maxime Bury Michael Meng Michael Spiegel @@ -484,4 +485,4 @@ Zach Latta zhouhaibing089 六开箱 缘生 -蒋航 +蒋航 \ No newline at end of file diff --git a/github/orgs_rules_test.go b/github/orgs_rules_test.go index 50ba4e20c01..0ed54ca8d27 100644 --- a/github/orgs_rules_test.go +++ b/github/orgs_rules_test.go @@ -123,6 +123,9 @@ func TestOrganizationsService_CreateOrganizationRuleset_RepoNames(t *testing.T) { "type": "deletion" }, + { + "type": "merge_queue" + }, { "type": "required_linear_history" }, @@ -238,6 +241,7 @@ func TestOrganizationsService_CreateOrganizationRuleset_RepoNames(t *testing.T) UpdateAllowsFetchAndMerge: true, }), NewDeletionRule(), + NewMergeQueueRule(), NewRequiredLinearHistoryRule(), NewRequiredDeploymentsRule(&RequiredDeploymentEnvironmentsRuleParameters{ RequiredDeploymentEnvironments: []string{"test"}, @@ -324,6 +328,7 @@ func TestOrganizationsService_CreateOrganizationRuleset_RepoNames(t *testing.T) UpdateAllowsFetchAndMerge: true, }), NewDeletionRule(), + NewMergeQueueRule(), NewRequiredLinearHistoryRule(), NewRequiredDeploymentsRule(&RequiredDeploymentEnvironmentsRuleParameters{ RequiredDeploymentEnvironments: []string{"test"}, @@ -437,6 +442,9 @@ func TestOrganizationsService_CreateOrganizationRuleset_RepoIDs(t *testing.T) { { "type": "deletion" }, + { + "type": "merge_queue" + }, { "type": "required_linear_history" }, @@ -550,6 +558,7 @@ func TestOrganizationsService_CreateOrganizationRuleset_RepoIDs(t *testing.T) { UpdateAllowsFetchAndMerge: true, }), NewDeletionRule(), + NewMergeQueueRule(), NewRequiredLinearHistoryRule(), NewRequiredDeploymentsRule(&RequiredDeploymentEnvironmentsRuleParameters{ RequiredDeploymentEnvironments: []string{"test"}, @@ -634,6 +643,7 @@ func TestOrganizationsService_CreateOrganizationRuleset_RepoIDs(t *testing.T) { UpdateAllowsFetchAndMerge: true, }), NewDeletionRule(), + NewMergeQueueRule(), NewRequiredLinearHistoryRule(), NewRequiredDeploymentsRule(&RequiredDeploymentEnvironmentsRuleParameters{ RequiredDeploymentEnvironments: []string{"test"}, diff --git a/github/repos_rules.go b/github/repos_rules.go index 34711dda979..6f046a356a6 100644 --- a/github/repos_rules.go +++ b/github/repos_rules.go @@ -134,7 +134,7 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error { r.Type = RepositoryRule.Type switch RepositoryRule.Type { - case "creation", "deletion", "required_linear_history", "required_signatures", "non_fast_forward": + case "creation", "deletion", "merge_queue", "non_fast_forward", "required_linear_history", "required_signatures": r.Parameters = nil case "update": if RepositoryRule.Parameters == nil { @@ -210,6 +210,13 @@ func (r *RepositoryRule) UnmarshalJSON(data []byte) error { return nil } +// NewMergeQueueRule creates a rule to only allow merges via a merge queue. +func NewMergeQueueRule() (rule *RepositoryRule) { + return &RepositoryRule{ + Type: "merge_queue", + } +} + // NewCreationRule creates a rule to only allow users with bypass permission to create matching refs. func NewCreationRule() (rule *RepositoryRule) { return &RepositoryRule{ diff --git a/github/repos_rules_test.go b/github/repos_rules_test.go index cbc3e5ce617..23ffd3ed5c1 100644 --- a/github/repos_rules_test.go +++ b/github/repos_rules_test.go @@ -67,6 +67,13 @@ func TestRepositoryRule_UnmarshalJSON(t *testing.T) { Parameters: nil, }, }, + "Valid merge_queue": { + data: `{"type":"merge_queue"}`, + want: &RepositoryRule{ + Type: "merge_queue", + Parameters: nil, + }, + }, "Valid non_fast_forward": { data: `{"type":"non_fast_forward"}`, want: &RepositoryRule{ From 8d4be0b2cf2b8242a0b7e3777232cd0058ae535f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 19 Apr 2024 09:16:31 -0400 Subject: [PATCH 144/145] Bump golang.org/x/net from 0.17.0 to 0.23.0 in /example (#3134) --- example/go.mod | 8 ++++---- example/go.sum | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/example/go.mod b/example/go.mod index 5b11139f25e..0213a527e0c 100644 --- a/example/go.mod +++ b/example/go.mod @@ -7,8 +7,8 @@ require ( github.com/bradleyfalzon/ghinstallation/v2 v2.0.4 github.com/gofri/go-github-ratelimit v1.0.3 github.com/google/go-github/v61 v61.0.0 - golang.org/x/crypto v0.17.0 - golang.org/x/term v0.15.0 + golang.org/x/crypto v0.21.0 + golang.org/x/term v0.18.0 google.golang.org/appengine v1.6.7 ) @@ -18,8 +18,8 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/google/go-github/v41 v41.0.0 // indirect github.com/google/go-querystring v1.1.0 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/net v0.23.0 // indirect + golang.org/x/sys v0.18.0 // indirect google.golang.org/protobuf v1.33.0 // indirect ) diff --git a/example/go.sum b/example/go.sum index d8e05e56537..7e3d1749689 100644 --- a/example/go.sum +++ b/example/go.sum @@ -30,8 +30,8 @@ golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= -golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= @@ -41,8 +41,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= +golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -56,15 +56,15 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= -golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= +golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8= +golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= From d0678244549b22cbe0c45b3b6cb4a04f27b09f47 Mon Sep 17 00:00:00 2001 From: Tayo Oloyede <106995402+tayosec@users.noreply.github.com> Date: Thu, 25 Apr 2024 15:47:09 -0500 Subject: [PATCH 145/145] Add Missing Changes Field to Member Event Type. (#3153) Fixes: #3154. --- github/event_types.go | 28 ++++++++++++--- github/event_types_test.go | 20 +++++++++++ github/github-accessors.go | 56 ++++++++++++++++++++++++++++++ github/github-accessors_test.go | 61 +++++++++++++++++++++++++++++++++ 4 files changed, 161 insertions(+), 4 deletions(-) diff --git a/github/event_types.go b/github/event_types.go index b820dddf4a7..703af1f2f2b 100644 --- a/github/event_types.go +++ b/github/event_types.go @@ -689,14 +689,34 @@ type MarketplacePurchaseEvent struct { Org *Organization `json:"organization,omitempty"` } -// MemberEvent is triggered when a user is added as a collaborator to a repository. +// MemberChangesPermission represents changes to a repository collaborator's permissions. +type MemberChangesPermission struct { + From *string `json:"from,omitempty"` + To *string `json:"to,omitempty"` +} + +// MemberChangesRoleName represents changes to a repository collaborator's role. +type MemberChangesRoleName struct { + From *string `json:"from,omitempty"` + To *string `json:"to,omitempty"` +} + +// MemberChanges represents changes to a repository collaborator's role or permission. +type MemberChanges struct { + Permission *MemberChangesPermission `json:"permission,omitempty"` + RoleName *MemberChangesRoleName `json:"role_name,omitempty"` +} + +// MemberEvent is triggered when a user's membership as a collaborator to a repository changes. // The Webhook event name is "member". // // GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#member type MemberEvent struct { - // Action is the action that was performed. Possible value is: "added". - Action *string `json:"action,omitempty"` - Member *User `json:"member,omitempty"` + // Action is the action that was performed. Possible values are: + //"added", "edited", "removed". + Action *string `json:"action,omitempty"` + Member *User `json:"member,omitempty"` + Changes *MemberChanges `json:"changes,omitempty"` // The following fields are only populated by Webhook events. Repo *Repository `json:"repository,omitempty"` diff --git a/github/event_types_test.go b/github/event_types_test.go index b00e94a34e4..79532d4916a 100644 --- a/github/event_types_test.go +++ b/github/event_types_test.go @@ -9106,6 +9106,16 @@ func TestMemberEvent_Marshal(t *testing.T) { EventsURL: String("e"), AvatarURL: String("a"), }, + Changes: &MemberChanges{ + Permission: &MemberChangesPermission{ + From: String("f"), + To: String("t"), + }, + RoleName: &MemberChangesRoleName{ + From: String("f"), + To: String("t"), + }, + }, Repo: &Repository{ ID: Int64(1), URL: String("s"), @@ -9226,6 +9236,16 @@ func TestMemberEvent_Marshal(t *testing.T) { "events_url": "e", "repos_url": "r" }, + "changes": { + "permission": { + "from": "f", + "to": "t" + }, + "role_name": { + "from": "f", + "to": "t" + } + }, "repository": { "id": 1, "name": "n", diff --git a/github/github-accessors.go b/github/github-accessors.go index 57a7165f7ff..13bf7d6668c 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -11206,6 +11206,54 @@ func (m *Match) GetText() string { return *m.Text } +// GetPermission returns the Permission field. +func (m *MemberChanges) GetPermission() *MemberChangesPermission { + if m == nil { + return nil + } + return m.Permission +} + +// GetRoleName returns the RoleName field. +func (m *MemberChanges) GetRoleName() *MemberChangesRoleName { + if m == nil { + return nil + } + return m.RoleName +} + +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (m *MemberChangesPermission) GetFrom() string { + if m == nil || m.From == nil { + return "" + } + return *m.From +} + +// GetTo returns the To field if it's non-nil, zero value otherwise. +func (m *MemberChangesPermission) GetTo() string { + if m == nil || m.To == nil { + return "" + } + return *m.To +} + +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (m *MemberChangesRoleName) GetFrom() string { + if m == nil || m.From == nil { + return "" + } + return *m.From +} + +// GetTo returns the To field if it's non-nil, zero value otherwise. +func (m *MemberChangesRoleName) GetTo() string { + if m == nil || m.To == nil { + return "" + } + return *m.To +} + // GetAction returns the Action field if it's non-nil, zero value otherwise. func (m *MemberEvent) GetAction() string { if m == nil || m.Action == nil { @@ -11214,6 +11262,14 @@ func (m *MemberEvent) GetAction() string { return *m.Action } +// GetChanges returns the Changes field. +func (m *MemberEvent) GetChanges() *MemberChanges { + if m == nil { + return nil + } + return m.Changes +} + // GetInstallation returns the Installation field. func (m *MemberEvent) GetInstallation() *Installation { if m == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index bbf9fb8422c..313e92c0596 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -13111,6 +13111,60 @@ func TestMatch_GetText(tt *testing.T) { m.GetText() } +func TestMemberChanges_GetPermission(tt *testing.T) { + m := &MemberChanges{} + m.GetPermission() + m = nil + m.GetPermission() +} + +func TestMemberChanges_GetRoleName(tt *testing.T) { + m := &MemberChanges{} + m.GetRoleName() + m = nil + m.GetRoleName() +} + +func TestMemberChangesPermission_GetFrom(tt *testing.T) { + var zeroValue string + m := &MemberChangesPermission{From: &zeroValue} + m.GetFrom() + m = &MemberChangesPermission{} + m.GetFrom() + m = nil + m.GetFrom() +} + +func TestMemberChangesPermission_GetTo(tt *testing.T) { + var zeroValue string + m := &MemberChangesPermission{To: &zeroValue} + m.GetTo() + m = &MemberChangesPermission{} + m.GetTo() + m = nil + m.GetTo() +} + +func TestMemberChangesRoleName_GetFrom(tt *testing.T) { + var zeroValue string + m := &MemberChangesRoleName{From: &zeroValue} + m.GetFrom() + m = &MemberChangesRoleName{} + m.GetFrom() + m = nil + m.GetFrom() +} + +func TestMemberChangesRoleName_GetTo(tt *testing.T) { + var zeroValue string + m := &MemberChangesRoleName{To: &zeroValue} + m.GetTo() + m = &MemberChangesRoleName{} + m.GetTo() + m = nil + m.GetTo() +} + func TestMemberEvent_GetAction(tt *testing.T) { var zeroValue string m := &MemberEvent{Action: &zeroValue} @@ -13121,6 +13175,13 @@ func TestMemberEvent_GetAction(tt *testing.T) { m.GetAction() } +func TestMemberEvent_GetChanges(tt *testing.T) { + m := &MemberEvent{} + m.GetChanges() + m = nil + m.GetChanges() +} + func TestMemberEvent_GetInstallation(tt *testing.T) { m := &MemberEvent{} m.GetInstallation()