Repository: google/go-github
Pull request #3121 (2024-04-03 18:49:39)

feat: Add missing github enterprise importer and domains meta fields
Adds two of the missing fields, `github_enterprise_importer` and `domains`, which are now included with the public meta endpoint. Also fixed some minor capitalization errors.

google-cla[bot]: Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this [failed invocation](https://github.com/google/go-github/pull/3121/checks?check_run_id=23408978346) of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.
codecov[bot]: ## [Codecov](https://app.codecov.io/gh/google/go-github/pull/3121?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 92.88%. Comparing base [(`2b8c7fa`)](https://app.codecov.io/gh/google/go-github/commit/2b8c7fa86fcd1cb4a89a44c8e7b5a49fe4be8a45?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) to head [(`3250afd`)](https://app.codecov.io/gh/google/go-github/pull/3121?dropdown=coverage&src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google).
> Report is 35 commits behind head on master.


<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff             @@
##           master    #3121      +/-   ##
==========================================
- Coverage   97.72%   92.88%   -4.84%     
==========================================
  Files         153      170      +17     
  Lines       13390    11423    -1967     
==========================================
- Hits        13085    10610    -2475     
- Misses        215      723     +508     
  Partials       90       90              
```



</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/google/go-github/pull/3121?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google).


Patch:
diff --git a/github/meta.go b/github/meta.go
index 1da8fcf1..e0e355e8 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


Test patch:
diff --git a/github/meta_test.go b/github/meta_test.go
index c7b01e29..99cb0b02 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),
 	}