From e062ff97c5937977f2c19700766ad377b9767ad5 Mon Sep 17 00:00:00 2001 From: Quin Quintero Date: Fri, 21 Jan 2022 15:48:41 -0800 Subject: [PATCH 1/2] Add support for additional pages update parameters. --- github/github-accessors.go | 16 ++++++++++++++++ github/github-accessors_test.go | 20 ++++++++++++++++++++ github/repos_pages.go | 7 +++++++ 3 files changed, 43 insertions(+) diff --git a/github/github-accessors.go b/github/github-accessors.go index 059a285a6c..b16aefff8d 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/github-accessors_test.go b/github/github-accessors_test.go index c36432a7c3..280dc0c774 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} diff --git a/github/repos_pages.go b/github/repos_pages.go index 04825baea1..ac78dcbe6c 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 respository 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. From 735ed9fab9ebb7c2b8adb976f195a1fbd6f136d9 Mon Sep 17 00:00:00 2001 From: Quin Quintero Date: Fri, 21 Jan 2022 16:06:19 -0800 Subject: [PATCH 2/2] Fix typo. --- github/repos_pages.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/repos_pages.go b/github/repos_pages.go index ac78dcbe6c..60a756b647 100644 --- a/github/repos_pages.go +++ b/github/repos_pages.go @@ -97,7 +97,7 @@ type PagesUpdate struct { 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 respository that + // 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.