Repository: google/go-github
Pull request #2435 (2022-08-17 14:46:25)

feature: adding api and web to meta api endpoint.
The Api and Web lists are returned from the `meta` API but still aren't supported in the Go library. This change exposes them in the same way as the other blocks which are returned. I'm working on a change in the GitHub Terraform provider to also support exposing these API/Web CIDRs so if this is all ok I can continue on with that change as well.

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/2435/checks?check_run_id=7881317939) 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://codecov.io/gh/google/go-github/pull/2435?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) Report
> Merging [#2435](https://codecov.io/gh/google/go-github/pull/2435?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) (cf6cb3d) into [master](https://codecov.io/gh/google/go-github/commit/acca0b62de36d60755085628907f4f6febdbaba1?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) (acca0b6) will **not change** coverage.
> The diff coverage is `n/a`.

> :exclamation: Current head cf6cb3d differs from pull request most recent head 88e840d. Consider uploading reports for the commit 88e840d to get more accurate results

```diff
@@           Coverage Diff           @@
##           master    #2435   +/-   ##
=======================================
  Coverage   98.08%   98.08%           
=======================================
  Files         122      122           
  Lines       10632    10632           
=======================================
  Hits        10428    10428           
  Misses        140      140           
  Partials       64       64           
```


| [Impacted Files](https://codecov.io/gh/google/go-github/pull/2435?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) | Coverage Δ | |
|---|---|---|
| [github/misc.go](https://codecov.io/gh/google/go-github/pull/2435/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google#diff-Z2l0aHViL21pc2MuZ28=) | `100.00% <ø> (ø)` | |

Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google)

Jamian: @gmlewis Hey, thanks for the feedback. I have made the changes and sorted the CLA out. 👍 
gmlewis: Thanks, @Jamian !  I think the tests might need updating, please.
Jamian: Hey @gmlewis, of course - awkwardly embarrassing! Just pushed the fixes to get tests passing 🤞 

Patch:
diff --git a/github/misc.go b/github/misc.go
index 412d1e2b..89615241 100644
--- a/github/misc.go
+++ b/github/misc.go
@@ -176,6 +176,14 @@ type APIMeta struct {
 
 	// 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


Test patch:
diff --git a/github/misc_test.go b/github/misc_test.go
index fc91d712..4e88ec54 100644
--- a/github/misc_test.go
+++ b/github/misc_test.go
@@ -190,6 +190,8 @@ func TestAPIMeta_Marshal(t *testing.T) {
 		Dependabot:                       []string{"d"},
 		SSHKeyFingerprints:               map[string]string{"a": "f"},
 		SSHKeys:                          []string{"k"},
+		API:                              []string{"a"},
+		Web:                              []string{"w"},
 	}
 	want := `{
 		"hooks":["h"],
@@ -200,7 +202,9 @@ func TestAPIMeta_Marshal(t *testing.T) {
 		"actions":["a"],
 		"dependabot":["d"],
 		"ssh_key_fingerprints":{"a":"f"},
-		"ssh_keys":["k"]
+		"ssh_keys":["k"],
+		"api":["a"],
+		"web":["w"]
 	}`
 
 	testJSONMarshal(t, a, want)
@@ -212,7 +216,7 @@ func TestAPIMeta(t *testing.T) {
 
 	mux.HandleFunc("/meta", func(w http.ResponseWriter, r *http.Request) {
 		testMethod(t, r, "GET")
-		fmt.Fprint(w, `{"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"], "actions":["a"], "dependabot":["d"], "verifiable_password_authentication": true}`)
 	})
 
 	ctx := context.Background()
@@ -228,6 +232,8 @@ func TestAPIMeta(t *testing.T) {
 		Importer:   []string{"i"},
 		Actions:    []string{"a"},
 		Dependabot: []string{"d"},
+		API:        []string{"a"},
+		Web:        []string{"w"},
 
 		VerifiablePasswordAuthentication: Bool(true),
 	}