Repository: google/go-github
Pull request #2029 (2021-08-04 14:13:54)

Add Slug field to AppConfig in manifest workflow
Add the `slug` field from the [GitHub manifest response](https://docs.github.com/en/rest/reference/apps#create-a-github-app-from-a-manifest) to `AppConfig`

codecov[bot]: # [Codecov](https://codecov.io/gh/google/go-github/pull/2029?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) Report
> Merging [#2029](https://codecov.io/gh/google/go-github/pull/2029?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) (d84383f) into [master](https://codecov.io/gh/google/go-github/commit/0d84fe1b2f64d2813bb97e0fd5f1df4963a2c3a7?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) (0d84fe1) will **not change** coverage.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/google/go-github/pull/2029/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/2029?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google)

```diff
@@           Coverage Diff           @@
##           master    #2029   +/-   ##
=======================================
  Coverage   97.86%   97.86%           
=======================================
  Files         107      107           
  Lines        6901     6901           
=======================================
  Hits         6754     6754           
  Misses         81       81           
  Partials       66       66           
```


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

------

[Continue to review full report at Codecov](https://codecov.io/gh/google/go-github/pull/2029?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/2029?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google). Last update [0d84fe1...d84383f](https://codecov.io/gh/google/go-github/pull/2029?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).


Patch:
diff --git a/github/apps_manifest.go b/github/apps_manifest.go
index defd6c0a..164f4939 100644
--- a/github/apps_manifest.go
+++ b/github/apps_manifest.go
@@ -13,6 +13,7 @@ import (
 // AppConfig describes the configuration of a GitHub App.
 type AppConfig struct {
 	ID            *int64     `json:"id,omitempty"`
+	Slug          *string    `json:"slug,omitempty"`
 	NodeID        *string    `json:"node_id,omitempty"`
 	Owner         *User      `json:"owner,omitempty"`
 	Name          *string    `json:"name,omitempty"`
diff --git a/github/github-accessors.go b/github/github-accessors.go
index 6671ddbc..3fa1e018 100644
--- a/github/github-accessors.go
+++ b/github/github-accessors.go
@@ -460,6 +460,14 @@ func (a *AppConfig) GetPEM() string {
 	return *a.PEM
 }
 
+// GetSlug returns the Slug field if it's non-nil, zero value otherwise.
+func (a *AppConfig) GetSlug() string {
+	if a == nil || a.Slug == nil {
+		return ""
+	}
+	return *a.Slug
+}
+
 // GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
 func (a *AppConfig) GetUpdatedAt() Timestamp {
 	if a == nil || a.UpdatedAt == nil {


Test patch:
diff --git a/github/apps_manifest_test.go b/github/apps_manifest_test.go
index a5d230d0..833982e4 100644
--- a/github/apps_manifest_test.go
+++ b/github/apps_manifest_test.go
@@ -72,6 +72,7 @@ func TestAppConfig_Marshal(t *testing.T) {
 
 	u := &AppConfig{
 		ID:     Int64(1),
+		Slug:   String("s"),
 		NodeID: String("nid"),
 		Owner: &User{
 			Login:           String("l"),
@@ -107,6 +108,7 @@ func TestAppConfig_Marshal(t *testing.T) {
 
 	want := `{
 		"id": 1,
+		"slug": "s",
 		"node_id": "nid",
 		"owner": {
 			"login": "l",
diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go
index efd85f77..b3ef053f 100644
--- a/github/github-accessors_test.go
+++ b/github/github-accessors_test.go
@@ -519,6 +519,16 @@ func TestAppConfig_GetPEM(tt *testing.T) {
 	a.GetPEM()
 }
 
+func TestAppConfig_GetSlug(tt *testing.T) {
+	var zeroValue string
+	a := &AppConfig{Slug: &zeroValue}
+	a.GetSlug()
+	a = &AppConfig{}
+	a.GetSlug()
+	a = nil
+	a.GetSlug()
+}
+
 func TestAppConfig_GetUpdatedAt(tt *testing.T) {
 	var zeroValue Timestamp
 	a := &AppConfig{UpdatedAt: &zeroValue}