mirror of
https://gitea.com/gitea/tea.git
synced 2026-06-06 03:08:44 +02:00
8e0666ab85
Reviewed-on: https://gitea.com/gitea/tea/pulls/1003 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.com> Co-committed-by: techknowlogick <techknowlogick@gitea.com>
26 lines
558 B
Go
26 lines
558 B
Go
// Copyright 2024 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package task
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"code.gitea.io/sdk/gitea"
|
|
|
|
"gitea.dev/tea/modules/config"
|
|
)
|
|
|
|
// PullMerge merges a PR
|
|
func PullMerge(login *config.Login, repoOwner, repoName string, index int64, opt gitea.MergePullRequestOption) error {
|
|
client := login.Client()
|
|
success, _, err := client.MergePullRequest(repoOwner, repoName, index, opt)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if !success {
|
|
return fmt.Errorf("failed to merge PR, is it still open?")
|
|
}
|
|
return nil
|
|
}
|