From a4ea80a74fff8cc2e6af859c7ae5016cc919120a Mon Sep 17 00:00:00 2001 From: Garrett Heel Date: Thu, 23 Jun 2022 17:12:42 +0800 Subject: [PATCH] Add support for `use_squash_pr_title_as_default` on repo --- github/data_source_github_repository.go | 5 + github/resource_github_repository.go | 45 ++--- github/resource_github_repository_test.go | 21 ++- go.mod | 2 +- go.sum | 4 +- .../v45/github/actions_workflow_runs.go | 1 + .../go-github/v45/github/event_types.go | 20 ++- .../go-github/v45/github/github-accessors.go | 96 +++++++++++ .../google/go-github/v45/github/orgs.go | 3 + .../google/go-github/v45/github/repos.go | 155 +++++++++--------- .../google/go-github/v45/github/teams.go | 2 +- .../google/go-github/v45/github/users.go | 5 +- vendor/modules.txt | 2 +- website/docs/d/repository.html.markdown | 2 + website/docs/r/repository.html.markdown | 2 + 15 files changed, 250 insertions(+), 115 deletions(-) diff --git a/github/data_source_github_repository.go b/github/data_source_github_repository.go index 37e6935ff2..1110783e98 100644 --- a/github/data_source_github_repository.go +++ b/github/data_source_github_repository.go @@ -79,6 +79,10 @@ func dataSourceGithubRepository() *schema.Resource { Type: schema.TypeBool, Computed: true, }, + "use_squash_pr_title_as_default": { + Type: schema.TypeBool, + Computed: true, + }, "default_branch": { Type: schema.TypeString, Computed: true, @@ -229,6 +233,7 @@ func dataSourceGithubRepositoryRead(d *schema.ResourceData, meta interface{}) er d.Set("allow_squash_merge", repo.GetAllowSquashMerge()) d.Set("allow_rebase_merge", repo.GetAllowRebaseMerge()) d.Set("allow_auto_merge", repo.GetAllowAutoMerge()) + d.Set("use_squash_pr_title_as_default", repo.GetUseSquashPRTitleAsDefault()) d.Set("has_downloads", repo.GetHasDownloads()) d.Set("full_name", repo.GetFullName()) d.Set("default_branch", repo.GetDefaultBranch()) diff --git a/github/resource_github_repository.go b/github/resource_github_repository.go index 948f9ffe95..649fc8efef 100644 --- a/github/resource_github_repository.go +++ b/github/resource_github_repository.go @@ -94,6 +94,11 @@ func resourceGithubRepository() *schema.Resource { Optional: true, Default: false, }, + "use_squash_pr_title_as_default": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, "delete_branch_on_merge": { Type: schema.TypeBool, Optional: true, @@ -282,25 +287,26 @@ func calculateVisibility(d *schema.ResourceData) string { func resourceGithubRepositoryObject(d *schema.ResourceData) *github.Repository { return &github.Repository{ - Name: github.String(d.Get("name").(string)), - Description: github.String(d.Get("description").(string)), - Homepage: github.String(d.Get("homepage_url").(string)), - Visibility: github.String(calculateVisibility(d)), - HasDownloads: github.Bool(d.Get("has_downloads").(bool)), - HasIssues: github.Bool(d.Get("has_issues").(bool)), - HasProjects: github.Bool(d.Get("has_projects").(bool)), - HasWiki: github.Bool(d.Get("has_wiki").(bool)), - IsTemplate: github.Bool(d.Get("is_template").(bool)), - AllowMergeCommit: github.Bool(d.Get("allow_merge_commit").(bool)), - AllowSquashMerge: github.Bool(d.Get("allow_squash_merge").(bool)), - AllowRebaseMerge: github.Bool(d.Get("allow_rebase_merge").(bool)), - AllowAutoMerge: github.Bool(d.Get("allow_auto_merge").(bool)), - DeleteBranchOnMerge: github.Bool(d.Get("delete_branch_on_merge").(bool)), - AutoInit: github.Bool(d.Get("auto_init").(bool)), - LicenseTemplate: github.String(d.Get("license_template").(string)), - GitignoreTemplate: github.String(d.Get("gitignore_template").(string)), - Archived: github.Bool(d.Get("archived").(bool)), - Topics: expandStringList(d.Get("topics").(*schema.Set).List()), + Name: github.String(d.Get("name").(string)), + Description: github.String(d.Get("description").(string)), + Homepage: github.String(d.Get("homepage_url").(string)), + Visibility: github.String(calculateVisibility(d)), + HasDownloads: github.Bool(d.Get("has_downloads").(bool)), + HasIssues: github.Bool(d.Get("has_issues").(bool)), + HasProjects: github.Bool(d.Get("has_projects").(bool)), + HasWiki: github.Bool(d.Get("has_wiki").(bool)), + IsTemplate: github.Bool(d.Get("is_template").(bool)), + AllowMergeCommit: github.Bool(d.Get("allow_merge_commit").(bool)), + AllowSquashMerge: github.Bool(d.Get("allow_squash_merge").(bool)), + AllowRebaseMerge: github.Bool(d.Get("allow_rebase_merge").(bool)), + AllowAutoMerge: github.Bool(d.Get("allow_auto_merge").(bool)), + UseSquashPRTitleAsDefault: github.Bool(d.Get("use_squash_pr_title_as_default").(bool)), + DeleteBranchOnMerge: github.Bool(d.Get("delete_branch_on_merge").(bool)), + AutoInit: github.Bool(d.Get("auto_init").(bool)), + LicenseTemplate: github.String(d.Get("license_template").(string)), + GitignoreTemplate: github.String(d.Get("gitignore_template").(string)), + Archived: github.Bool(d.Get("archived").(bool)), + Topics: expandStringList(d.Get("topics").(*schema.Set).List()), } } @@ -440,6 +446,7 @@ func resourceGithubRepositoryRead(d *schema.ResourceData, meta interface{}) erro d.Set("allow_squash_merge", repo.GetAllowSquashMerge()) d.Set("allow_rebase_merge", repo.GetAllowRebaseMerge()) d.Set("allow_auto_merge", repo.GetAllowAutoMerge()) + d.Set("use_squash_pr_title_as_default", repo.GetUseSquashPRTitleAsDefault()) d.Set("delete_branch_on_merge", repo.GetDeleteBranchOnMerge()) d.Set("has_downloads", repo.GetHasDownloads()) d.Set("full_name", repo.GetFullName()) diff --git a/github/resource_github_repository_test.go b/github/resource_github_repository_test.go index 8814659406..2006edd70b 100644 --- a/github/resource_github_repository_test.go +++ b/github/resource_github_repository_test.go @@ -24,14 +24,15 @@ func TestAccGithubRepositories(t *testing.T) { name = "tf-acc-test-create-%[1]s" description = "Terraform acceptance tests %[1]s" - has_issues = true - has_wiki = true - has_downloads = true - allow_merge_commit = true - allow_squash_merge = false - allow_rebase_merge = false - allow_auto_merge = true - auto_init = false + has_issues = true + has_wiki = true + has_downloads = true + allow_merge_commit = true + allow_squash_merge = false + allow_rebase_merge = false + allow_auto_merge = true + use_squash_pr_title_as_default = true + auto_init = false } `, randomID) @@ -45,6 +46,10 @@ func TestAccGithubRepositories(t *testing.T) { "github_repository.test", "allow_auto_merge", "true", ), + resource.TestCheckResourceAttr( + "github_repository.test", "use_squash_pr_title_as_default", + "true", + ), ) testCase := func(t *testing.T, mode string) { diff --git a/go.mod b/go.mod index 55537d34af..cf6964431d 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.16 require ( github.com/client9/misspell v0.3.4 github.com/golangci/golangci-lint v1.25.1 - github.com/google/go-github/v45 v45.1.0 + github.com/google/go-github/v45 v45.2.0 github.com/hashicorp/go-getter v1.4.2-0.20200106182914-9813cbd4eb02 // indirect github.com/hashicorp/hcl/v2 v2.3.0 // indirect github.com/hashicorp/terraform-config-inspect v0.0.0-20191212124732-c6ae6269b9d7 // indirect diff --git a/go.sum b/go.sum index 026210c243..0cb178971c 100644 --- a/go.sum +++ b/go.sum @@ -157,8 +157,8 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-github/v45 v45.1.0 h1:SbUjHMRiCe9cHfu6Me4idWxLQEV8ZW9DLPz69zopyWo= -github.com/google/go-github/v45 v45.1.0/go.mod h1:FObaZJEDSTa/WGCzZ2Z3eoCDXWJKMenWWTrd8jrta28= +github.com/google/go-github/v45 v45.2.0 h1:5oRLszbrkvxDDqBCNj2hjDZMKmvexaZ1xw/FCD+K3FI= +github.com/google/go-github/v45 v45.2.0/go.mod h1:FObaZJEDSTa/WGCzZ2Z3eoCDXWJKMenWWTrd8jrta28= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no= diff --git a/vendor/github.com/google/go-github/v45/github/actions_workflow_runs.go b/vendor/github.com/google/go-github/v45/github/actions_workflow_runs.go index de1e6c277a..18fdd57d6a 100644 --- a/vendor/github.com/google/go-github/v45/github/actions_workflow_runs.go +++ b/vendor/github.com/google/go-github/v45/github/actions_workflow_runs.go @@ -44,6 +44,7 @@ type WorkflowRun struct { WorkflowURL *string `json:"workflow_url,omitempty"` Repository *Repository `json:"repository,omitempty"` HeadRepository *Repository `json:"head_repository,omitempty"` + Actor *User `json:"actor,omitempty"` } // WorkflowRuns represents a slice of repository action workflow run. diff --git a/vendor/github.com/google/go-github/v45/github/event_types.go b/vendor/github.com/google/go-github/v45/github/event_types.go index c80a835f6b..b550361848 100644 --- a/vendor/github.com/google/go-github/v45/github/event_types.go +++ b/vendor/github.com/google/go-github/v45/github/event_types.go @@ -106,10 +106,11 @@ type CreateEvent struct { RefType *string `json:"ref_type,omitempty"` MasterBranch *string `json:"master_branch,omitempty"` Description *string `json:"description,omitempty"` + PusherType *string `json:"pusher_type,omitempty"` // The following fields are only populated by Webhook events. - PusherType *string `json:"pusher_type,omitempty"` Repo *Repository `json:"repository,omitempty"` + Org *Organization `json:"organization,omitempty"` Sender *User `json:"sender,omitempty"` Installation *Installation `json:"installation,omitempty"` } @@ -493,13 +494,14 @@ type IssuesEvent struct { type LabelEvent struct { // Action is the action that was performed. Possible values are: // "created", "edited", "deleted" - Action *string `json:"action,omitempty"` - Label *Label `json:"label,omitempty"` + Action *string `json:"action,omitempty"` + Label *Label `json:"label,omitempty"` + Changes *EditChange `json:"changes,omitempty"` // The following fields are only populated by Webhook events. - Changes *EditChange `json:"changes,omitempty"` Repo *Repository `json:"repository,omitempty"` Org *Organization `json:"organization,omitempty"` + Sender *User `json:"sender,omitempty"` Installation *Installation `json:"installation,omitempty"` } @@ -574,6 +576,9 @@ type MetaEvent struct { Hook *Hook `json:"hook,omitempty"` // The following fields are only populated by Webhook events. + Repo *Repository `json:"repository,omitempty"` + Org *Organization `json:"organization,omitempty"` + Sender *User `json:"sender,omitempty"` Installation *Installation `json:"installation,omitempty"` } @@ -682,7 +687,12 @@ type PingEvent struct { // The ID of the webhook that triggered the ping. HookID *int64 `json:"hook_id,omitempty"` // The webhook configuration. - Hook *Hook `json:"hook,omitempty"` + Hook *Hook `json:"hook,omitempty"` + + // The following fields are only populated by Webhook events. + Repo *Repository `json:"repository,omitempty"` + Org *Organization `json:"organization,omitempty"` + Sender *User `json:"sender,omitempty"` Installation *Installation `json:"installation,omitempty"` } diff --git a/vendor/github.com/google/go-github/v45/github/github-accessors.go b/vendor/github.com/google/go-github/v45/github/github-accessors.go index 774dc0bf0c..0092c58840 100644 --- a/vendor/github.com/google/go-github/v45/github/github-accessors.go +++ b/vendor/github.com/google/go-github/v45/github/github-accessors.go @@ -3438,6 +3438,14 @@ func (c *CreateEvent) GetMasterBranch() string { return *c.MasterBranch } +// GetOrg returns the Org field. +func (c *CreateEvent) GetOrg() *Organization { + if c == nil { + return nil + } + return c.Org +} + // GetPusherType returns the PusherType field if it's non-nil, zero value otherwise. func (c *CreateEvent) GetPusherType() string { if c == nil || c.PusherType == nil { @@ -7902,6 +7910,14 @@ func (l *LabelEvent) GetRepo() *Repository { return l.Repo } +// GetSender returns the Sender field. +func (l *LabelEvent) GetSender() *User { + if l == nil { + return nil + } + return l.Sender +} + // GetColor returns the Color field if it's non-nil, zero value otherwise. func (l *LabelResult) GetColor() string { if l == nil || l.Color == nil { @@ -8742,6 +8758,30 @@ func (m *MetaEvent) GetInstallation() *Installation { return m.Installation } +// GetOrg returns the Org field. +func (m *MetaEvent) GetOrg() *Organization { + if m == nil { + return nil + } + return m.Org +} + +// GetRepo returns the Repo field. +func (m *MetaEvent) GetRepo() *Repository { + if m == nil { + return nil + } + return m.Repo +} + +// GetSender returns the Sender field. +func (m *MetaEvent) GetSender() *User { + if m == nil { + return nil + } + return m.Sender +} + // GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. func (m *Metric) GetHTMLURL() string { if m == nil || m.HTMLURL == nil { @@ -9582,6 +9622,14 @@ func (o *Organization) GetMembersCanCreateRepos() bool { return *o.MembersCanCreateRepos } +// GetMembersCanForkPrivateRepos returns the MembersCanForkPrivateRepos field if it's non-nil, zero value otherwise. +func (o *Organization) GetMembersCanForkPrivateRepos() bool { + if o == nil || o.MembersCanForkPrivateRepos == nil { + return false + } + return *o.MembersCanForkPrivateRepos +} + // GetMembersURL returns the MembersURL field if it's non-nil, zero value otherwise. func (o *Organization) GetMembersURL() string { if o == nil || o.MembersURL == nil { @@ -10766,6 +10814,30 @@ func (p *PingEvent) GetInstallation() *Installation { return p.Installation } +// GetOrg returns the Org field. +func (p *PingEvent) GetOrg() *Organization { + if p == nil { + return nil + } + return p.Org +} + +// GetRepo returns the Repo field. +func (p *PingEvent) GetRepo() *Repository { + if p == nil { + return nil + } + return p.Repo +} + +// GetSender returns the Sender field. +func (p *PingEvent) GetSender() *User { + if p == nil { + return nil + } + return p.Sender +} + // GetZen returns the Zen field if it's non-nil, zero value otherwise. func (p *PingEvent) GetZen() string { if p == nil || p.Zen == nil { @@ -14758,6 +14830,14 @@ func (r *Repository) GetURL() string { return *r.URL } +// GetUseSquashPRTitleAsDefault returns the UseSquashPRTitleAsDefault field if it's non-nil, zero value otherwise. +func (r *Repository) GetUseSquashPRTitleAsDefault() bool { + if r == nil || r.UseSquashPRTitleAsDefault == nil { + return false + } + return *r.UseSquashPRTitleAsDefault +} + // GetVisibility returns the Visibility field if it's non-nil, zero value otherwise. func (r *Repository) GetVisibility() string { if r == nil || r.Visibility == nil { @@ -18710,6 +18790,14 @@ func (u *User) GetReposURL() string { return *u.ReposURL } +// GetRoleName returns the RoleName field if it's non-nil, zero value otherwise. +func (u *User) GetRoleName() string { + if u == nil || u.RoleName == nil { + return "" + } + return *u.RoleName +} + // GetSiteAdmin returns the SiteAdmin field if it's non-nil, zero value otherwise. func (u *User) GetSiteAdmin() bool { if u == nil || u.SiteAdmin == nil { @@ -19654,6 +19742,14 @@ func (w *WorkflowJobEvent) GetWorkflowJob() *WorkflowJob { return w.WorkflowJob } +// GetActor returns the Actor field. +func (w *WorkflowRun) GetActor() *User { + if w == nil { + return nil + } + return w.Actor +} + // GetArtifactsURL returns the ArtifactsURL field if it's non-nil, zero value otherwise. func (w *WorkflowRun) GetArtifactsURL() string { if w == nil || w.ArtifactsURL == nil { diff --git a/vendor/github.com/google/go-github/v45/github/orgs.go b/vendor/github.com/google/go-github/v45/github/orgs.go index 80979db350..26b55c62d0 100644 --- a/vendor/github.com/google/go-github/v45/github/orgs.go +++ b/vendor/github.com/google/go-github/v45/github/orgs.go @@ -65,6 +65,9 @@ type Organization struct { MembersCanCreatePrivateRepos *bool `json:"members_can_create_private_repositories,omitempty"` MembersCanCreateInternalRepos *bool `json:"members_can_create_internal_repositories,omitempty"` + // MembersCanForkPrivateRepos toggles whether organization members can fork private organization repositories. + MembersCanForkPrivateRepos *bool `json:"members_can_fork_private_repositories,omitempty"` + // MembersAllowedRepositoryCreationType denotes if organization members can create repositories // and the type of repositories they can create. Possible values are: "all", "private", or "none". // diff --git a/vendor/github.com/google/go-github/v45/github/repos.go b/vendor/github.com/google/go-github/v45/github/repos.go index c9bbe5a7da..a5f7fc6cf8 100644 --- a/vendor/github.com/google/go-github/v45/github/repos.go +++ b/vendor/github.com/google/go-github/v45/github/repos.go @@ -26,52 +26,53 @@ 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"` - DeleteBranchOnMerge *bool `json:"delete_branch_on_merge,omitempty"` - 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"` + DeleteBranchOnMerge *bool `json:"delete_branch_on_merge,omitempty"` + UseSquashPRTitleAsDefault *bool `json:"use_squash_pr_title_as_default,omitempty"` + Topics []string `json:"topics,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"` @@ -362,16 +363,17 @@ type createRepoRequest struct { // Creating an organization repository. Required for non-owners. TeamID *int64 `json:"team_id,omitempty"` - AutoInit *bool `json:"auto_init,omitempty"` - GitignoreTemplate *string `json:"gitignore_template,omitempty"` - LicenseTemplate *string `json:"license_template,omitempty"` - AllowSquashMerge *bool `json:"allow_squash_merge,omitempty"` - AllowMergeCommit *bool `json:"allow_merge_commit,omitempty"` - AllowRebaseMerge *bool `json:"allow_rebase_merge,omitempty"` - AllowUpdateBranch *bool `json:"allow_update_branch,omitempty"` - AllowAutoMerge *bool `json:"allow_auto_merge,omitempty"` - AllowForking *bool `json:"allow_forking,omitempty"` - DeleteBranchOnMerge *bool `json:"delete_branch_on_merge,omitempty"` + AutoInit *bool `json:"auto_init,omitempty"` + GitignoreTemplate *string `json:"gitignore_template,omitempty"` + LicenseTemplate *string `json:"license_template,omitempty"` + AllowSquashMerge *bool `json:"allow_squash_merge,omitempty"` + AllowMergeCommit *bool `json:"allow_merge_commit,omitempty"` + AllowRebaseMerge *bool `json:"allow_rebase_merge,omitempty"` + AllowUpdateBranch *bool `json:"allow_update_branch,omitempty"` + AllowAutoMerge *bool `json:"allow_auto_merge,omitempty"` + AllowForking *bool `json:"allow_forking,omitempty"` + DeleteBranchOnMerge *bool `json:"delete_branch_on_merge,omitempty"` + UseSquashPRTitleAsDefault *bool `json:"use_squash_pr_title_as_default,omitempty"` } // Create a new repository. If an organization is specified, the new @@ -397,26 +399,27 @@ func (s *RepositoriesService) Create(ctx context.Context, org string, repo *Repo } repoReq := &createRepoRequest{ - Name: repo.Name, - Description: repo.Description, - Homepage: repo.Homepage, - Private: repo.Private, - Visibility: repo.Visibility, - HasIssues: repo.HasIssues, - HasProjects: repo.HasProjects, - HasWiki: repo.HasWiki, - IsTemplate: repo.IsTemplate, - TeamID: repo.TeamID, - AutoInit: repo.AutoInit, - GitignoreTemplate: repo.GitignoreTemplate, - LicenseTemplate: repo.LicenseTemplate, - AllowSquashMerge: repo.AllowSquashMerge, - AllowMergeCommit: repo.AllowMergeCommit, - AllowRebaseMerge: repo.AllowRebaseMerge, - AllowUpdateBranch: repo.AllowUpdateBranch, - AllowAutoMerge: repo.AllowAutoMerge, - AllowForking: repo.AllowForking, - DeleteBranchOnMerge: repo.DeleteBranchOnMerge, + Name: repo.Name, + Description: repo.Description, + Homepage: repo.Homepage, + Private: repo.Private, + Visibility: repo.Visibility, + HasIssues: repo.HasIssues, + HasProjects: repo.HasProjects, + HasWiki: repo.HasWiki, + IsTemplate: repo.IsTemplate, + TeamID: repo.TeamID, + AutoInit: repo.AutoInit, + GitignoreTemplate: repo.GitignoreTemplate, + LicenseTemplate: repo.LicenseTemplate, + AllowSquashMerge: repo.AllowSquashMerge, + AllowMergeCommit: repo.AllowMergeCommit, + AllowRebaseMerge: repo.AllowRebaseMerge, + AllowUpdateBranch: repo.AllowUpdateBranch, + AllowAutoMerge: repo.AllowAutoMerge, + AllowForking: repo.AllowForking, + DeleteBranchOnMerge: repo.DeleteBranchOnMerge, + UseSquashPRTitleAsDefault: repo.UseSquashPRTitleAsDefault, } req, err := s.client.NewRequest("POST", u, repoReq) diff --git a/vendor/github.com/google/go-github/v45/github/teams.go b/vendor/github.com/google/go-github/v45/github/teams.go index 77b38dd6dd..38845e0953 100644 --- a/vendor/github.com/google/go-github/v45/github/teams.go +++ b/vendor/github.com/google/go-github/v45/github/teams.go @@ -452,7 +452,7 @@ func (s *TeamsService) IsTeamRepoBySlug(ctx context.Context, org, slug, owner, r } // TeamAddTeamRepoOptions specifies the optional parameters to the -// TeamsService.AddTeamRepo method. +// TeamsService.AddTeamRepoByID and TeamsService.AddTeamRepoBySlug methods. type TeamAddTeamRepoOptions struct { // Permission specifies the permission to grant the team on this repository. // Possible values are: diff --git a/vendor/github.com/google/go-github/v45/github/users.go b/vendor/github.com/google/go-github/v45/github/users.go index e694e05416..d40d23e90f 100644 --- a/vendor/github.com/google/go-github/v45/github/users.go +++ b/vendor/github.com/google/go-github/v45/github/users.go @@ -66,9 +66,10 @@ type User struct { // See: search.go and https://docs.github.com/en/rest/search/#text-match-metadata TextMatches []*TextMatch `json:"text_matches,omitempty"` - // Permissions identifies the permissions that a user has on a given - // repository. This is only populated when calling Repositories.ListCollaborators. + // Permissions and RoleName identify the permissions and role that a user has on a given + // repository. These are only populated when calling Repositories.ListCollaborators. Permissions map[string]bool `json:"permissions,omitempty"` + RoleName *string `json:"role_name,omitempty"` } func (u User) String() string { diff --git a/vendor/modules.txt b/vendor/modules.txt index daf673dff7..98f36e966e 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -180,7 +180,7 @@ github.com/google/go-cmp/cmp/internal/diff github.com/google/go-cmp/cmp/internal/flags github.com/google/go-cmp/cmp/internal/function github.com/google/go-cmp/cmp/internal/value -# github.com/google/go-github/v45 v45.1.0 +# github.com/google/go-github/v45 v45.2.0 ## explicit github.com/google/go-github/v45/github # github.com/google/go-querystring v1.1.0 diff --git a/website/docs/d/repository.html.markdown b/website/docs/d/repository.html.markdown index 59f934bffc..4e187e8183 100644 --- a/website/docs/d/repository.html.markdown +++ b/website/docs/d/repository.html.markdown @@ -51,6 +51,8 @@ The following arguments are supported: * `allow_auto_merge` - Whether the repository allows auto-merging pull requests. +* `use_squash_pr_title_as_default` - Whether the repository defaults to using PR titles for squash merge commit messages. + * `has_downloads` - Whether the repository has Downloads feature enabled. * `default_branch` - The name of the default branch of the repository. diff --git a/website/docs/r/repository.html.markdown b/website/docs/r/repository.html.markdown index 7ebbbfd3f5..7d1385194b 100644 --- a/website/docs/r/repository.html.markdown +++ b/website/docs/r/repository.html.markdown @@ -77,6 +77,8 @@ The following arguments are supported: * `allow_auto_merge` - (Optional) Set to `true` to allow auto-merging pull requests on the repository. +* `use_squash_pr_title_as_default` - (Optional) Set to `true` to default to using PR titles for squash merge commit messages on the repository. + * `delete_branch_on_merge` - (Optional) Automatically delete head branch after a pull request is merged. Defaults to `false`. * `has_downloads` - (Optional) Set to `true` to enable the (deprecated) downloads features on the repository.