Repository: google/go-github
Pull request #1860 (2021-04-27 16:05:20)

Apps-Service: Add baptiste-preview to ListRepos and ListUserRepos
The preview `application/vnd.github.baptiste-preview+json` ensures that the field `"is_template": false` is part of the repository response of the Apps Service.

codecov[bot]: # [Codecov](https://codecov.io/gh/google/go-github/pull/1860?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) Report
> Merging [#1860](https://codecov.io/gh/google/go-github/pull/1860?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) (80485d5) into [master](https://codecov.io/gh/google/go-github/commit/cceb4d4573ea092c2396c038ff545cf8334dc498?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) (cceb4d4) will **increase** coverage by `0.00%`.
> The diff coverage is `100.00%`.

[![Impacted file tree graph](https://codecov.io/gh/google/go-github/pull/1860/graphs/tree.svg?width=650&height=150&src=pr&token=EgYjGjZlI0&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google)](https://codecov.io/gh/google/go-github/pull/1860?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google)

```diff
@@           Coverage Diff           @@
##           master    #1860   +/-   ##
=======================================
  Coverage   97.64%   97.65%           
=======================================
  Files         105      105           
  Lines        6764     6770    +6     
=======================================
+ Hits         6605     6611    +6     
  Misses         86       86           
  Partials       73       73           
```


| [Impacted Files](https://codecov.io/gh/google/go-github/pull/1860?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) | Coverage Δ | |
|---|---|---|
| [github/apps\_installation.go](https://codecov.io/gh/google/go-github/pull/1860/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google#diff-Z2l0aHViL2FwcHNfaW5zdGFsbGF0aW9uLmdv) | `92.30% <100.00%> (+1.00%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/google/go-github/pull/1860?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/google/go-github/pull/1860?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google). Last update [cceb4d4...80485d5](https://codecov.io/gh/google/go-github/pull/1860?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google).

gmlewis: Thank you, @wesleimp !
Merging.

Patch:
diff --git a/github/apps_installation.go b/github/apps_installation.go
index 501d8006..521860d6 100644
--- a/github/apps_installation.go
+++ b/github/apps_installation.go
@@ -32,7 +32,11 @@ func (s *AppsService) ListRepos(ctx context.Context, opts *ListOptions) (*ListRe
 	}
 
 	// TODO: remove custom Accept headers when APIs fully launch.
-	acceptHeaders := []string{mediaTypeTopicsPreview, mediaTypeRepositoryVisibilityPreview}
+	acceptHeaders := []string{
+		mediaTypeTopicsPreview,
+		mediaTypeRepositoryVisibilityPreview,
+		mediaTypeRepositoryTemplatePreview,
+	}
 	req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
 
 	var r *ListRepositories
@@ -62,7 +66,11 @@ func (s *AppsService) ListUserRepos(ctx context.Context, id int64, opts *ListOpt
 	}
 
 	// TODO: remove custom Accept headers when APIs fully launch.
-	acceptHeaders := []string{mediaTypeTopicsPreview, mediaTypeRepositoryVisibilityPreview}
+	acceptHeaders := []string{
+		mediaTypeTopicsPreview,
+		mediaTypeRepositoryVisibilityPreview,
+		mediaTypeRepositoryTemplatePreview,
+	}
 	req.Header.Set("Accept", strings.Join(acceptHeaders, ", "))
 
 	var r *ListRepositories


Test patch:
diff --git a/github/apps_installation_test.go b/github/apps_installation_test.go
index 5e8a18de..c3b982a6 100644
--- a/github/apps_installation_test.go
+++ b/github/apps_installation_test.go
@@ -18,7 +18,11 @@ func TestAppsService_ListRepos(t *testing.T) {
 	client, mux, _, teardown := setup()
 	defer teardown()
 
-	wantAcceptHeaders := []string{mediaTypeTopicsPreview, mediaTypeRepositoryVisibilityPreview}
+	wantAcceptHeaders := []string{
+		mediaTypeTopicsPreview,
+		mediaTypeRepositoryVisibilityPreview,
+		mediaTypeRepositoryTemplatePreview,
+	}
 	mux.HandleFunc("/installation/repositories", func(w http.ResponseWriter, r *http.Request) {
 		testMethod(t, r, "GET")
 		testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
@@ -55,7 +59,11 @@ func TestAppsService_ListUserRepos(t *testing.T) {
 	client, mux, _, teardown := setup()
 	defer teardown()
 
-	wantAcceptHeaders := []string{mediaTypeTopicsPreview, mediaTypeRepositoryVisibilityPreview}
+	wantAcceptHeaders := []string{
+		mediaTypeTopicsPreview,
+		mediaTypeRepositoryVisibilityPreview,
+		mediaTypeRepositoryTemplatePreview,
+	}
 	mux.HandleFunc("/user/installations/1/repositories", func(w http.ResponseWriter, r *http.Request) {
 		testMethod(t, r, "GET")
 		testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))