Repository: google/go-github (go)

Issue:
Support additional GitHub pages update parameters
The https://pkg.go.dev/github.com/google/go-github/v41/github#RepositoriesService.UpdatePages API only currently supports updating the CNAME and source properties: https://github.com/google/go-github/blob/178169fc04bc4a05ca48f98709cdd02ab5b556e3/github/repos_pages.go#L90-L98

There are additional parameters which would be useful for consumers (i.e. terraform provider) to be able to update (see https://docs.github.com/en/rest/reference/pages#update-information-about-a-github-pages-site for reference):
* https_enforced
* public

Pull request description:
Add support for additional PagesUpdate parameters
Closes #2261 

This change introduces 2 additional parameters provided by the GitHub API to the PagesUpdate type, `Public` and `HTTPSEnforced`. 

Note: I had to open a new PR because the author email for one of the commits in the first PR did not match the email associated with my CLA. 

Patch:
diff --git a/github/github-accessors.go b/github/github-accessors.go
index 059a285a..b16aefff 100644
--- a/github/github-accessors.go
+++ b/github/github-accessors.go
@@ -10484,6 +10484,22 @@ func (p *PagesUpdate) GetCNAME() string {
 	return *p.CNAME
 }
 
+// GetHTTPSEnforced returns the HTTPSEnforced field if it's non-nil, zero value otherwise.
+func (p *PagesUpdate) GetHTTPSEnforced() bool {
+	if p == nil || p.HTTPSEnforced == nil {
+		return false
+	}
+	return *p.HTTPSEnforced
+}
+
+// GetPublic returns the Public field if it's non-nil, zero value otherwise.
+func (p *PagesUpdate) GetPublic() bool {
+	if p == nil || p.Public == nil {
+		return false
+	}
+	return *p.Public
+}
+
 // GetSource returns the Source field if it's non-nil, zero value otherwise.
 func (p *PagesUpdate) GetSource() string {
 	if p == nil || p.Source == nil {
diff --git a/github/repos_pages.go b/github/repos_pages.go
index 04825bae..60a756b6 100644
--- a/github/repos_pages.go
+++ b/github/repos_pages.go
@@ -95,6 +95,13 @@ type PagesUpdate struct {
 	// Source must include the branch name, and may optionally specify the subdirectory "/docs".
 	// Possible values are: "gh-pages", "master", and "master /docs".
 	Source *string `json:"source,omitempty"`
+	// Public configures access controls for the site.
+	// If "true", the site will be accessible to anyone on the internet. If "false",
+	// the site will be accessible to anyone with read access to the repository that
+	// published the site.
+	Public *bool `json:"public,omitempty"`
+	// HTTPSEnforced specifies whether HTTPS should be enforced for the repository.
+	HTTPSEnforced *bool `json:"https_enforced,omitempty"`
 }
 
 // UpdatePages updates GitHub Pages for the named repo.


Test patch:
diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go
index c36432a7..280dc0c7 100644
--- a/github/github-accessors_test.go
+++ b/github/github-accessors_test.go
@@ -12305,6 +12305,26 @@ func TestPagesUpdate_GetCNAME(tt *testing.T) {
 	p.GetCNAME()
 }
 
+func TestPagesUpdate_GetHTTPSEnforced(tt *testing.T) {
+	var zeroValue bool
+	p := &PagesUpdate{HTTPSEnforced: &zeroValue}
+	p.GetHTTPSEnforced()
+	p = &PagesUpdate{}
+	p.GetHTTPSEnforced()
+	p = nil
+	p.GetHTTPSEnforced()
+}
+
+func TestPagesUpdate_GetPublic(tt *testing.T) {
+	var zeroValue bool
+	p := &PagesUpdate{Public: &zeroValue}
+	p.GetPublic()
+	p = &PagesUpdate{}
+	p.GetPublic()
+	p = nil
+	p.GetPublic()
+}
+
 func TestPagesUpdate_GetSource(tt *testing.T) {
 	var zeroValue string
 	p := &PagesUpdate{Source: &zeroValue}