Add auto-merge setting and merge now functionality

This commit is contained in:
2026-07-28 17:42:49 +02:00
parent 7511311297
commit 42dcceaf4b
10 changed files with 689 additions and 63 deletions

View File

@@ -164,6 +164,28 @@ func (c *CachedGitHubService) UpdatePullRequest(
return writer.UpdatePullRequest(ctx, pullRequestID, update)
}
func (c *CachedGitHubService) SetPullRequestAutoMerge(
ctx context.Context, pullRequestID, expectedHeadOID, mergeMethod string, enabled bool,
) (*AutoMergeRequest, error) {
writer, ok := c.remote.(GitHubMergeService)
if !ok {
return nil, errors.New("GitHub service does not support auto-merge")
}
return writer.SetPullRequestAutoMerge(
ctx, pullRequestID, expectedHeadOID, mergeMethod, enabled,
)
}
func (c *CachedGitHubService) MergePullRequest(
ctx context.Context, pullRequestID, expectedHeadOID, mergeMethod string,
) (PullRequestMergeResult, error) {
writer, ok := c.remote.(GitHubMergeService)
if !ok {
return PullRequestMergeResult{}, errors.New("GitHub service does not support merging")
}
return writer.MergePullRequest(ctx, pullRequestID, expectedHeadOID, mergeMethod)
}
func (c *CachedGitHubService) ListBranches(
ctx context.Context, owner, repo string,
) ([]RepositoryBranch, error) {