Merge branch 'main' into lunny/add_reply_code_review

This commit is contained in:
Lunny Xiao
2026-05-25 21:58:27 -07:00
230 changed files with 2346 additions and 1495 deletions
+15 -13
View File
@@ -4,24 +4,26 @@
package pulls
import (
stdctx "context"
"errors"
"fmt"
"io"
"strings"
"code.gitea.io/sdk/gitea"
"code.gitea.io/tea/modules/config"
"code.gitea.io/tea/modules/context"
"code.gitea.io/tea/modules/interact"
"code.gitea.io/tea/modules/task"
"code.gitea.io/tea/modules/theme"
"code.gitea.io/tea/modules/utils"
gitea "gitea.dev/sdk"
"gitea.dev/tea/modules/config"
"gitea.dev/tea/modules/context"
"gitea.dev/tea/modules/interact"
"gitea.dev/tea/modules/task"
"gitea.dev/tea/modules/theme"
"gitea.dev/tea/modules/utils"
"charm.land/huh/v2"
)
// runPullReview handles the common logic for approving/rejecting pull requests
func runPullReview(ctx *context.TeaContext, state gitea.ReviewStateType, requireComment bool) error {
func runPullReview(requestCtx stdctx.Context, ctx *context.TeaContext, state gitea.ReviewStateType, requireComment bool) error {
if err := ctx.Ensure(context.CtxRequirement{RemoteRepo: true}); err != nil {
return err
}
@@ -45,11 +47,11 @@ func runPullReview(ctx *context.TeaContext, state gitea.ReviewStateType, require
comment := strings.Join(ctx.Args().Tail(), " ")
return task.CreatePullReview(ctx, idx, state, comment, nil)
return task.CreatePullReview(requestCtx, ctx, idx, state, comment, nil)
}
// runResolveComment handles the common logic for resolving/unresolving review comments
func runResolveComment(ctx *context.TeaContext, action func(*context.TeaContext, int64) error) error {
func runResolveComment(requestCtx stdctx.Context, ctx *context.TeaContext, action func(stdctx.Context, *context.TeaContext, int64) error) error {
if err := ctx.Ensure(context.CtxRequirement{RemoteRepo: true}); err != nil {
return err
}
@@ -63,11 +65,11 @@ func runResolveComment(ctx *context.TeaContext, action func(*context.TeaContext,
return err
}
return action(ctx, commentID)
return action(requestCtx, ctx, commentID)
}
// runPullReviewReply handles replying to a specific review comment on a pull request.
func runPullReviewReply(ctx *context.TeaContext) error {
func runPullReviewReply(requestCtx stdctx.Context, ctx *context.TeaContext) error {
if err := ctx.Ensure(context.CtxRequirement{RemoteRepo: true}); err != nil {
return err
}
@@ -91,7 +93,7 @@ func runPullReviewReply(ctx *context.TeaContext) error {
return err
}
return task.ReplyToPullReviewComment(ctx, idx, commentID, body)
return task.ReplyToPullReviewComment(requestCtx, ctx, idx, commentID, body)
}
func getCommentBody(ctx *context.TeaContext, extraArgs []string, promptTitle, noun string) (string, error) {