Skip to content

Commit

Permalink
Add ability to use GitHub merge queues
Browse files Browse the repository at this point in the history
fixes #289

commit-id:d1895370
  • Loading branch information
ejoffe committed Apr 22, 2023
1 parent 3b93446 commit 05c9868
Show file tree
Hide file tree
Showing 9 changed files with 21,904 additions and 6,870 deletions.
1 change: 1 addition & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type RepoConfig struct {
RemoteBranches []string `yaml:"remoteBranches"`

MergeMethod string `default:"rebase" yaml:"mergeMethod"`
MergeQueue bool `default:"false" yaml:"mergeQueue"`

PRTemplatePath string `yaml:"prTemplatePath,omitempty"`
PRTemplateInsertStart string `yaml:"prTemplateInsertStart,omitempty"`
Expand Down
16 changes: 12 additions & 4 deletions github/githubclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -596,10 +596,18 @@ func (c *client) MergePullRequest(ctx context.Context,
Str("mergeMethod", string(mergeMethod)).
Msg("MergePullRequest")

_, err := c.api.MergePullRequest(ctx, genclient.MergePullRequestInput{
PullRequestId: pr.ID,
MergeMethod: &mergeMethod,
})
var err error
if c.config.Repo.MergeQueue {
_, err = c.api.AutoMergePullRequest(ctx, genclient.EnablePullRequestAutoMergeInput{
PullRequestId: pr.ID,
MergeMethod: &mergeMethod,
})
} else {
_, err = c.api.MergePullRequest(ctx, genclient.MergePullRequestInput{
PullRequestId: pr.ID,
MergeMethod: &mergeMethod,
})
}
if err != nil {
log.Fatal().
Str("id", pr.ID).
Expand Down
12 changes: 7 additions & 5 deletions github/githubclient/fezzik.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ operations:
package_name: genclient
package_dir: gen
scalar_type_map:
ID: string
GitObjectID: string
DateTime: string
URI: string
GitRefname: string
ID: string
GitObjectID: string
DateTime: string
URI: string
GitRefname: string
Date: string
Base64String: string
generate_mocks: false
debug: false
13 changes: 9 additions & 4 deletions github/githubclient/gen/genclient/client.go

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

Loading

0 comments on commit 05c9868

Please sign in to comment.