From 6a2fd7a2148e98e65bb81e063e79473834ea4cea Mon Sep 17 00:00:00 2001 From: felixlut Date: Sun, 22 Sep 2024 16:01:05 +0200 Subject: [PATCH 1/2] support baseRole option for custom organization roles --- github/orgs_custom_roles.go | 1 + 1 file changed, 1 insertion(+) diff --git a/github/orgs_custom_roles.go b/github/orgs_custom_roles.go index ca0c6d7bcba..086c4a824f0 100644 --- a/github/orgs_custom_roles.go +++ b/github/orgs_custom_roles.go @@ -54,6 +54,7 @@ type CreateOrUpdateOrgRoleOptions struct { Name *string `json:"name,omitempty"` Description *string `json:"description,omitempty"` Permissions []string `json:"permissions"` + BaseRole *string `json:"base_role,omitempty"` } // CreateOrUpdateCustomRepoRoleOptions represents options required to create or update a custom repository role. From b86c3543b0c6329e07f08fc5d4f01ad1f5aa9578 Mon Sep 17 00:00:00 2001 From: felixlut Date: Sun, 22 Sep 2024 18:44:41 +0200 Subject: [PATCH 2/2] generate files --- github/github-accessors.go | 8 ++++++++ github/github-accessors_test.go | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/github/github-accessors.go b/github/github-accessors.go index a99a06aa314..a025f781faf 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -4414,6 +4414,14 @@ func (c *CreateOrUpdateCustomRepoRoleOptions) GetName() string { return *c.Name } +// GetBaseRole returns the BaseRole field if it's non-nil, zero value otherwise. +func (c *CreateOrUpdateOrgRoleOptions) GetBaseRole() string { + if c == nil || c.BaseRole == nil { + return "" + } + return *c.BaseRole +} + // GetDescription returns the Description field if it's non-nil, zero value otherwise. func (c *CreateOrUpdateOrgRoleOptions) GetDescription() string { if c == nil || c.Description == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 2db51bab3dd..ae380160dc7 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -5179,6 +5179,16 @@ func TestCreateOrUpdateCustomRepoRoleOptions_GetName(tt *testing.T) { c.GetName() } +func TestCreateOrUpdateOrgRoleOptions_GetBaseRole(tt *testing.T) { + var zeroValue string + c := &CreateOrUpdateOrgRoleOptions{BaseRole: &zeroValue} + c.GetBaseRole() + c = &CreateOrUpdateOrgRoleOptions{} + c.GetBaseRole() + c = nil + c.GetBaseRole() +} + func TestCreateOrUpdateOrgRoleOptions_GetDescription(tt *testing.T) { var zeroValue string c := &CreateOrUpdateOrgRoleOptions{Description: &zeroValue}