Repository: google/go-github
Pull request #1803 (2021-02-16 18:45:32)

Add Actions field to InstallationPermissions model
Addresses https://github.com/google/go-github/issues/1802

codecov[bot]: # [Codecov](https://codecov.io/gh/google/go-github/pull/1803?src=pr&el=h1) Report
> Merging [#1803](https://codecov.io/gh/google/go-github/pull/1803?src=pr&el=desc) (5d2a6b4) into [master](https://codecov.io/gh/google/go-github/commit/873f95568edb51affada39373a89f69a9173f7f1?el=desc) (873f955) will **not change** coverage.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/google/go-github/pull/1803/graphs/tree.svg?width=650&height=150&src=pr&token=EgYjGjZlI0)](https://codecov.io/gh/google/go-github/pull/1803?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master    #1803   +/-   ##
=======================================
  Coverage   97.55%   97.55%           
=======================================
  Files          99       99           
  Lines        6426     6426           
=======================================
  Hits         6269     6269           
  Misses         85       85           
  Partials       72       72           
```


| [Impacted Files](https://codecov.io/gh/google/go-github/pull/1803?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [github/apps.go](https://codecov.io/gh/google/go-github/pull/1803/diff?src=pr&el=tree#diff-Z2l0aHViL2FwcHMuZ28=) | `95.29% <ø> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/google/go-github/pull/1803?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/google/go-github/pull/1803?src=pr&el=footer). Last update [873f955...8a445d9](https://codecov.io/gh/google/go-github/pull/1803?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/github/apps.go b/github/apps.go
index 97b8c314..12df54dd 100644
--- a/github/apps.go
+++ b/github/apps.go
@@ -58,6 +58,7 @@ type InstallationTokenOptions struct {
 //   https://docs.github.com/en/free-pro-team@latest/rest/reference/apps/permissions/
 //   https://developer.github.com/enterprise/v3/apps/permissions/
 type InstallationPermissions struct {
+	Actions                     *string `json:"actions,omitempty"`
 	Administration              *string `json:"administration,omitempty"`
 	Blocking                    *string `json:"blocking,omitempty"`
 	Checks                      *string `json:"checks,omitempty"`
diff --git a/github/github-accessors.go b/github/github-accessors.go
index 40b52d17..5794c076 100644
--- a/github/github-accessors.go
+++ b/github/github-accessors.go
@@ -4364,6 +4364,14 @@ func (i *InstallationEvent) GetSender() *User {
 	return i.Sender
 }
 
+// GetActions returns the Actions field if it's non-nil, zero value otherwise.
+func (i *InstallationPermissions) GetActions() string {
+	if i == nil || i.Actions == nil {
+		return ""
+	}
+	return *i.Actions
+}
+
 // GetAdministration returns the Administration field if it's non-nil, zero value otherwise.
 func (i *InstallationPermissions) GetAdministration() string {
 	if i == nil || i.Administration == nil {


Test patch:
diff --git a/github/apps_test.go b/github/apps_test.go
index 725bc558..f8faca41 100644
--- a/github/apps_test.go
+++ b/github/apps_test.go
@@ -90,6 +90,7 @@ func TestAppsService_ListInstallations(t *testing.T) {
                                    "target_id":1,
                                    "target_type": "Organization",
                                    "permissions": {
+                                       "actions": "read",
                                        "administration": "read",
                                        "checks": "read",
                                        "contents": "read",
@@ -142,6 +143,7 @@ func TestAppsService_ListInstallations(t *testing.T) {
 		SingleFileName:      String("config.yml"),
 		RepositorySelection: String("selected"),
 		Permissions: &InstallationPermissions{
+			Actions:                     String("read"),
 			Administration:              String("read"),
 			Checks:                      String("read"),
 			Contents:                    String("read"),
diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go
index bdcfa107..f06fa5cc 100644
--- a/github/github-accessors_test.go
+++ b/github/github-accessors_test.go
@@ -5114,6 +5114,16 @@ func TestInstallationEvent_GetSender(tt *testing.T) {
 	i.GetSender()
 }
 
+func TestInstallationPermissions_GetActions(tt *testing.T) {
+	var zeroValue string
+	i := &InstallationPermissions{Actions: &zeroValue}
+	i.GetActions()
+	i = &InstallationPermissions{}
+	i.GetActions()
+	i = nil
+	i.GetActions()
+}
+
 func TestInstallationPermissions_GetAdministration(tt *testing.T) {
 	var zeroValue string
 	i := &InstallationPermissions{Administration: &zeroValue}