Repository: google/go-github
Pull request #3065 (2024-01-31 10:50:49)

Add custom properties on Repository and PushEventRepository
Repository and PushEventRepository updated:
```
CustomProperties map[string]string `json:"custom_properties,omitempty"`
```

Getters generated.

Scripts fmt, test, link passed.

chapurlatn: Note that I can add a space between Topics and CustomProperties to avoid reformating the previous properties.
I added in the "main" set of properties cause it always present and the concept of custom properties is closed to Topics. 
chapurlatn: Related issue: https://github.com/google/go-github/issues/3064
codecov[bot]: ## [Codecov](https://app.codecov.io/gh/google/go-github/pull/3065?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Comparison is base [(`e574cdf`)](https://app.codecov.io/gh/google/go-github/commit/e574cdf07e0fa553edd56660a7daf8416660705f?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) 97.71% compared to head [(`de69728`)](https://app.codecov.io/gh/google/go-github/pull/3065?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) 97.71%.


<details><summary>Additional details and impacted files</summary>


```diff
@@           Coverage Diff           @@
##           master    #3065   +/-   ##
=======================================
  Coverage   97.71%   97.71%           
=======================================
  Files         152      152           
  Lines       13335    13335           
=======================================
  Hits        13030    13030           
  Misses        215      215           
  Partials       90       90           
```



</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/google/go-github/pull/3065?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google).


Patch:
diff --git a/github/event_types.go b/github/event_types.go
index 56db9f5b..b820dddf 100644
--- a/github/event_types.go
+++ b/github/event_types.go
@@ -1327,43 +1327,44 @@ func (h HeadCommit) String() string {
 
 // PushEventRepository represents the repo object in a PushEvent payload.
 type PushEventRepository struct {
-	ID              *int64     `json:"id,omitempty"`
-	NodeID          *string    `json:"node_id,omitempty"`
-	Name            *string    `json:"name,omitempty"`
-	FullName        *string    `json:"full_name,omitempty"`
-	Owner           *User      `json:"owner,omitempty"`
-	Private         *bool      `json:"private,omitempty"`
-	Description     *string    `json:"description,omitempty"`
-	Fork            *bool      `json:"fork,omitempty"`
-	CreatedAt       *Timestamp `json:"created_at,omitempty"`
-	PushedAt        *Timestamp `json:"pushed_at,omitempty"`
-	UpdatedAt       *Timestamp `json:"updated_at,omitempty"`
-	Homepage        *string    `json:"homepage,omitempty"`
-	PullsURL        *string    `json:"pulls_url,omitempty"`
-	Size            *int       `json:"size,omitempty"`
-	StargazersCount *int       `json:"stargazers_count,omitempty"`
-	WatchersCount   *int       `json:"watchers_count,omitempty"`
-	Language        *string    `json:"language,omitempty"`
-	HasIssues       *bool      `json:"has_issues,omitempty"`
-	HasDownloads    *bool      `json:"has_downloads,omitempty"`
-	HasWiki         *bool      `json:"has_wiki,omitempty"`
-	HasPages        *bool      `json:"has_pages,omitempty"`
-	ForksCount      *int       `json:"forks_count,omitempty"`
-	Archived        *bool      `json:"archived,omitempty"`
-	Disabled        *bool      `json:"disabled,omitempty"`
-	OpenIssuesCount *int       `json:"open_issues_count,omitempty"`
-	DefaultBranch   *string    `json:"default_branch,omitempty"`
-	MasterBranch    *string    `json:"master_branch,omitempty"`
-	Organization    *string    `json:"organization,omitempty"`
-	URL             *string    `json:"url,omitempty"`
-	ArchiveURL      *string    `json:"archive_url,omitempty"`
-	HTMLURL         *string    `json:"html_url,omitempty"`
-	StatusesURL     *string    `json:"statuses_url,omitempty"`
-	GitURL          *string    `json:"git_url,omitempty"`
-	SSHURL          *string    `json:"ssh_url,omitempty"`
-	CloneURL        *string    `json:"clone_url,omitempty"`
-	SVNURL          *string    `json:"svn_url,omitempty"`
-	Topics          []string   `json:"topics,omitempty"`
+	ID               *int64            `json:"id,omitempty"`
+	NodeID           *string           `json:"node_id,omitempty"`
+	Name             *string           `json:"name,omitempty"`
+	FullName         *string           `json:"full_name,omitempty"`
+	Owner            *User             `json:"owner,omitempty"`
+	Private          *bool             `json:"private,omitempty"`
+	Description      *string           `json:"description,omitempty"`
+	Fork             *bool             `json:"fork,omitempty"`
+	CreatedAt        *Timestamp        `json:"created_at,omitempty"`
+	PushedAt         *Timestamp        `json:"pushed_at,omitempty"`
+	UpdatedAt        *Timestamp        `json:"updated_at,omitempty"`
+	Homepage         *string           `json:"homepage,omitempty"`
+	PullsURL         *string           `json:"pulls_url,omitempty"`
+	Size             *int              `json:"size,omitempty"`
+	StargazersCount  *int              `json:"stargazers_count,omitempty"`
+	WatchersCount    *int              `json:"watchers_count,omitempty"`
+	Language         *string           `json:"language,omitempty"`
+	HasIssues        *bool             `json:"has_issues,omitempty"`
+	HasDownloads     *bool             `json:"has_downloads,omitempty"`
+	HasWiki          *bool             `json:"has_wiki,omitempty"`
+	HasPages         *bool             `json:"has_pages,omitempty"`
+	ForksCount       *int              `json:"forks_count,omitempty"`
+	Archived         *bool             `json:"archived,omitempty"`
+	Disabled         *bool             `json:"disabled,omitempty"`
+	OpenIssuesCount  *int              `json:"open_issues_count,omitempty"`
+	DefaultBranch    *string           `json:"default_branch,omitempty"`
+	MasterBranch     *string           `json:"master_branch,omitempty"`
+	Organization     *string           `json:"organization,omitempty"`
+	URL              *string           `json:"url,omitempty"`
+	ArchiveURL       *string           `json:"archive_url,omitempty"`
+	HTMLURL          *string           `json:"html_url,omitempty"`
+	StatusesURL      *string           `json:"statuses_url,omitempty"`
+	GitURL           *string           `json:"git_url,omitempty"`
+	SSHURL           *string           `json:"ssh_url,omitempty"`
+	CloneURL         *string           `json:"clone_url,omitempty"`
+	SVNURL           *string           `json:"svn_url,omitempty"`
+	Topics           []string          `json:"topics,omitempty"`
+	CustomProperties map[string]string `json:"custom_properties,omitempty"`
 }
 
 // PushEventRepoOwner is a basic representation of user/org in a PushEvent payload.
diff --git a/github/github-accessors.go b/github/github-accessors.go
index 6d32908c..20c84621 100644
--- a/github/github-accessors.go
+++ b/github/github-accessors.go
@@ -17150,6 +17150,14 @@ func (p *PushEventRepository) GetCreatedAt() Timestamp {
 	return *p.CreatedAt
 }
 
+// GetCustomProperties returns the CustomProperties map if it's non-nil, an empty map otherwise.
+func (p *PushEventRepository) GetCustomProperties() map[string]string {
+	if p == nil || p.CustomProperties == nil {
+		return map[string]string{}
+	}
+	return p.CustomProperties
+}
+
 // GetDefaultBranch returns the DefaultBranch field if it's non-nil, zero value otherwise.
 func (p *PushEventRepository) GetDefaultBranch() string {
 	if p == nil || p.DefaultBranch == nil {
@@ -18286,6 +18294,14 @@ func (r *Repository) GetCreatedAt() Timestamp {
 	return *r.CreatedAt
 }
 
+// GetCustomProperties returns the CustomProperties map if it's non-nil, an empty map otherwise.
+func (r *Repository) GetCustomProperties() map[string]string {
+	if r == nil || r.CustomProperties == nil {
+		return map[string]string{}
+	}
+	return r.CustomProperties
+}
+
 // GetDefaultBranch returns the DefaultBranch field if it's non-nil, zero value otherwise.
 func (r *Repository) GetDefaultBranch() string {
 	if r == nil || r.DefaultBranch == nil {
diff --git a/github/repos.go b/github/repos.go
index a7574d72..b492e55b 100644
--- a/github/repos.go
+++ b/github/repos.go
@@ -27,58 +27,59 @@ type RepositoriesService service
 
 // Repository represents a GitHub repository.
 type Repository struct {
-	ID                        *int64          `json:"id,omitempty"`
-	NodeID                    *string         `json:"node_id,omitempty"`
-	Owner                     *User           `json:"owner,omitempty"`
-	Name                      *string         `json:"name,omitempty"`
-	FullName                  *string         `json:"full_name,omitempty"`
-	Description               *string         `json:"description,omitempty"`
-	Homepage                  *string         `json:"homepage,omitempty"`
-	CodeOfConduct             *CodeOfConduct  `json:"code_of_conduct,omitempty"`
-	DefaultBranch             *string         `json:"default_branch,omitempty"`
-	MasterBranch              *string         `json:"master_branch,omitempty"`
-	CreatedAt                 *Timestamp      `json:"created_at,omitempty"`
-	PushedAt                  *Timestamp      `json:"pushed_at,omitempty"`
-	UpdatedAt                 *Timestamp      `json:"updated_at,omitempty"`
-	HTMLURL                   *string         `json:"html_url,omitempty"`
-	CloneURL                  *string         `json:"clone_url,omitempty"`
-	GitURL                    *string         `json:"git_url,omitempty"`
-	MirrorURL                 *string         `json:"mirror_url,omitempty"`
-	SSHURL                    *string         `json:"ssh_url,omitempty"`
-	SVNURL                    *string         `json:"svn_url,omitempty"`
-	Language                  *string         `json:"language,omitempty"`
-	Fork                      *bool           `json:"fork,omitempty"`
-	ForksCount                *int            `json:"forks_count,omitempty"`
-	NetworkCount              *int            `json:"network_count,omitempty"`
-	OpenIssuesCount           *int            `json:"open_issues_count,omitempty"`
-	OpenIssues                *int            `json:"open_issues,omitempty"` // Deprecated: Replaced by OpenIssuesCount. For backward compatibility OpenIssues is still populated.
-	StargazersCount           *int            `json:"stargazers_count,omitempty"`
-	SubscribersCount          *int            `json:"subscribers_count,omitempty"`
-	WatchersCount             *int            `json:"watchers_count,omitempty"` // Deprecated: Replaced by StargazersCount. For backward compatibility WatchersCount is still populated.
-	Watchers                  *int            `json:"watchers,omitempty"`       // Deprecated: Replaced by StargazersCount. For backward compatibility Watchers is still populated.
-	Size                      *int            `json:"size,omitempty"`
-	AutoInit                  *bool           `json:"auto_init,omitempty"`
-	Parent                    *Repository     `json:"parent,omitempty"`
-	Source                    *Repository     `json:"source,omitempty"`
-	TemplateRepository        *Repository     `json:"template_repository,omitempty"`
-	Organization              *Organization   `json:"organization,omitempty"`
-	Permissions               map[string]bool `json:"permissions,omitempty"`
-	AllowRebaseMerge          *bool           `json:"allow_rebase_merge,omitempty"`
-	AllowUpdateBranch         *bool           `json:"allow_update_branch,omitempty"`
-	AllowSquashMerge          *bool           `json:"allow_squash_merge,omitempty"`
-	AllowMergeCommit          *bool           `json:"allow_merge_commit,omitempty"`
-	AllowAutoMerge            *bool           `json:"allow_auto_merge,omitempty"`
-	AllowForking              *bool           `json:"allow_forking,omitempty"`
-	WebCommitSignoffRequired  *bool           `json:"web_commit_signoff_required,omitempty"`
-	DeleteBranchOnMerge       *bool           `json:"delete_branch_on_merge,omitempty"`
-	UseSquashPRTitleAsDefault *bool           `json:"use_squash_pr_title_as_default,omitempty"`
-	SquashMergeCommitTitle    *string         `json:"squash_merge_commit_title,omitempty"`   // Can be one of: "PR_TITLE", "COMMIT_OR_PR_TITLE"
-	SquashMergeCommitMessage  *string         `json:"squash_merge_commit_message,omitempty"` // Can be one of: "PR_BODY", "COMMIT_MESSAGES", "BLANK"
-	MergeCommitTitle          *string         `json:"merge_commit_title,omitempty"`          // Can be one of: "PR_TITLE", "MERGE_MESSAGE"
-	MergeCommitMessage        *string         `json:"merge_commit_message,omitempty"`        // Can be one of: "PR_BODY", "PR_TITLE", "BLANK"
-	Topics                    []string        `json:"topics,omitempty"`
-	Archived                  *bool           `json:"archived,omitempty"`
-	Disabled                  *bool           `json:"disabled,omitempty"`
+	ID                        *int64            `json:"id,omitempty"`
+	NodeID                    *string           `json:"node_id,omitempty"`
+	Owner                     *User             `json:"owner,omitempty"`
+	Name                      *string           `json:"name,omitempty"`
+	FullName                  *string           `json:"full_name,omitempty"`
+	Description               *string           `json:"description,omitempty"`
+	Homepage                  *string           `json:"homepage,omitempty"`
+	CodeOfConduct             *CodeOfConduct    `json:"code_of_conduct,omitempty"`
+	DefaultBranch             *string           `json:"default_branch,omitempty"`
+	MasterBranch              *string           `json:"master_branch,omitempty"`
+	CreatedAt                 *Timestamp        `json:"created_at,omitempty"`
+	PushedAt                  *Timestamp        `json:"pushed_at,omitempty"`
+	UpdatedAt                 *Timestamp        `json:"updated_at,omitempty"`
+	HTMLURL                   *string           `json:"html_url,omitempty"`
+	CloneURL                  *string           `json:"clone_url,omitempty"`
+	GitURL                    *string           `json:"git_url,omitempty"`
+	MirrorURL                 *string           `json:"mirror_url,omitempty"`
+	SSHURL                    *string           `json:"ssh_url,omitempty"`
+	SVNURL                    *string           `json:"svn_url,omitempty"`
+	Language                  *string           `json:"language,omitempty"`
+	Fork                      *bool             `json:"fork,omitempty"`
+	ForksCount                *int              `json:"forks_count,omitempty"`
+	NetworkCount              *int              `json:"network_count,omitempty"`
+	OpenIssuesCount           *int              `json:"open_issues_count,omitempty"`
+	OpenIssues                *int              `json:"open_issues,omitempty"` // Deprecated: Replaced by OpenIssuesCount. For backward compatibility OpenIssues is still populated.
+	StargazersCount           *int              `json:"stargazers_count,omitempty"`
+	SubscribersCount          *int              `json:"subscribers_count,omitempty"`
+	WatchersCount             *int              `json:"watchers_count,omitempty"` // Deprecated: Replaced by StargazersCount. For backward compatibility WatchersCount is still populated.
+	Watchers                  *int              `json:"watchers,omitempty"`       // Deprecated: Replaced by StargazersCount. For backward compatibility Watchers is still populated.
+	Size                      *int              `json:"size,omitempty"`
+	AutoInit                  *bool             `json:"auto_init,omitempty"`
+	Parent                    *Repository       `json:"parent,omitempty"`
+	Source                    *Repository       `json:"source,omitempty"`
+	TemplateRepository        *Repository       `json:"template_repository,omitempty"`
+	Organization              *Organization     `json:"organization,omitempty"`
+	Permissions               map[string]bool   `json:"permissions,omitempty"`
+	AllowRebaseMerge          *bool             `json:"allow_rebase_merge,omitempty"`
+	AllowUpdateBranch         *bool             `json:"allow_update_branch,omitempty"`
+	AllowSquashMerge          *bool             `json:"allow_squash_merge,omitempty"`
+	AllowMergeCommit          *bool             `json:"allow_merge_commit,omitempty"`
+	AllowAutoMerge            *bool             `json:"allow_auto_merge,omitempty"`
+	AllowForking              *bool             `json:"allow_forking,omitempty"`
+	WebCommitSignoffRequired  *bool             `json:"web_commit_signoff_required,omitempty"`
+	DeleteBranchOnMerge       *bool             `json:"delete_branch_on_merge,omitempty"`
+	UseSquashPRTitleAsDefault *bool             `json:"use_squash_pr_title_as_default,omitempty"`
+	SquashMergeCommitTitle    *string           `json:"squash_merge_commit_title,omitempty"`   // Can be one of: "PR_TITLE", "COMMIT_OR_PR_TITLE"
+	SquashMergeCommitMessage  *string           `json:"squash_merge_commit_message,omitempty"` // Can be one of: "PR_BODY", "COMMIT_MESSAGES", "BLANK"
+	MergeCommitTitle          *string           `json:"merge_commit_title,omitempty"`          // Can be one of: "PR_TITLE", "MERGE_MESSAGE"
+	MergeCommitMessage        *string           `json:"merge_commit_message,omitempty"`        // Can be one of: "PR_BODY", "PR_TITLE", "BLANK"
+	Topics                    []string          `json:"topics,omitempty"`
+	CustomProperties          map[string]string `json:"custom_properties,omitempty"`
+	Archived                  *bool             `json:"archived,omitempty"`
+	Disabled                  *bool             `json:"disabled,omitempty"`
 
 	// Only provided when using RepositoriesService.Get while in preview
 	License *License `json:"license,omitempty"`


Test patch:
diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go
index 5856cc7a..d35d4bf2 100644
--- a/github/github-accessors_test.go
+++ b/github/github-accessors_test.go
@@ -19842,6 +19842,16 @@ func TestPushEventRepository_GetCreatedAt(tt *testing.T) {
 	p.GetCreatedAt()
 }
 
+func TestPushEventRepository_GetCustomProperties(tt *testing.T) {
+	zeroValue := map[string]string{}
+	p := &PushEventRepository{CustomProperties: zeroValue}
+	p.GetCustomProperties()
+	p = &PushEventRepository{}
+	p.GetCustomProperties()
+	p = nil
+	p.GetCustomProperties()
+}
+
 func TestPushEventRepository_GetDefaultBranch(tt *testing.T) {
 	var zeroValue string
 	p := &PushEventRepository{DefaultBranch: &zeroValue}
@@ -21196,6 +21206,16 @@ func TestRepository_GetCreatedAt(tt *testing.T) {
 	r.GetCreatedAt()
 }
 
+func TestRepository_GetCustomProperties(tt *testing.T) {
+	zeroValue := map[string]string{}
+	r := &Repository{CustomProperties: zeroValue}
+	r.GetCustomProperties()
+	r = &Repository{}
+	r.GetCustomProperties()
+	r = nil
+	r.GetCustomProperties()
+}
+
 func TestRepository_GetDefaultBranch(tt *testing.T) {
 	var zeroValue string
 	r := &Repository{DefaultBranch: &zeroValue}