Skip to content

Commit

Permalink
Add parameters to configure merge commit messages to repo (#2440)
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettheel committed Aug 21, 2022
1 parent e5e45da commit 01c8feb
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 1 deletion.
32 changes: 32 additions & 0 deletions github/github-accessors.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions github/github-accessors_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion github/github-stringify_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions github/repos.go
Expand Up @@ -70,6 +70,10 @@ type Repository struct {
AllowForking *bool `json:"allow_forking,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"`
Expand Down Expand Up @@ -374,6 +378,10 @@ type createRepoRequest struct {
AllowForking *bool `json:"allow_forking,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"`
SquashMergeCommitMessage *string `json:"squash_merge_commit_message,omitempty"`
MergeCommitTitle *string `json:"merge_commit_title,omitempty"`
MergeCommitMessage *string `json:"merge_commit_message,omitempty"`
}

// Create a new repository. If an organization is specified, the new
Expand Down Expand Up @@ -420,6 +428,10 @@ func (s *RepositoriesService) Create(ctx context.Context, org string, repo *Repo
AllowForking: repo.AllowForking,
DeleteBranchOnMerge: repo.DeleteBranchOnMerge,
UseSquashPRTitleAsDefault: repo.UseSquashPRTitleAsDefault,
SquashMergeCommitTitle: repo.SquashMergeCommitTitle,
SquashMergeCommitMessage: repo.SquashMergeCommitMessage,
MergeCommitTitle: repo.MergeCommitTitle,
MergeCommitMessage: repo.MergeCommitMessage,
}

req, err := s.client.NewRequest("POST", u, repoReq)
Expand Down

0 comments on commit 01c8feb

Please sign in to comment.