diff --git a/CODET.md b/CODET.md new file mode 100644 index 00000000..17e72bb6 --- /dev/null +++ b/CODET.md @@ -0,0 +1,4 @@ +## Preferences + +- The project module path is `gitea.dev/tea`; `code.gitea.io/tea` is the old name and should not be reintroduced. +- Do not use `go-git`; this codebase has moved to git CLI operations behind the existing backend abstraction in `modules/git`. diff --git a/cmd/pulls/reply_test.go b/cmd/pulls/reply_test.go index ac348152..9dcf72b7 100644 --- a/cmd/pulls/reply_test.go +++ b/cmd/pulls/reply_test.go @@ -7,7 +7,7 @@ import ( "context" "testing" - "code.gitea.io/tea/modules/config" + "gitea.dev/tea/modules/config" "github.com/stretchr/testify/assert" ) diff --git a/go.mod b/go.mod index b3c9d250..c691d635 100644 --- a/go.mod +++ b/go.mod @@ -57,10 +57,8 @@ require ( github.com/go-fed/httpsig v1.1.0 // indirect github.com/goccy/go-json v0.10.6 // indirect github.com/godbus/dbus/v5 v5.2.2 // indirect - github.com/google/go-cmp v0.7.0 // indirect github.com/gorilla/css v1.0.1 // indirect github.com/hashicorp/go-version v1.9.0 // indirect - github.com/kr/pretty v0.3.1 // indirect github.com/lucasb-eyer/go-colorful v1.4.0 // indirect github.com/mattn/go-colorable v0.1.14 // indirect github.com/mattn/go-isatty v0.0.22 // indirect @@ -73,7 +71,6 @@ require ( github.com/olekukonko/ll v0.1.8 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rivo/uniseg v0.4.7 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect github.com/yuin/goldmark v1.8.2 // indirect @@ -84,7 +81,6 @@ require ( golang.org/x/sync v0.20.0 // indirect golang.org/x/text v0.37.0 // indirect golang.org/x/tools v0.45.0 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect ) retract v1.3.3 // accidental release, tag deleted diff --git a/go.sum b/go.sum index bf859c6e..365e772d 100644 --- a/go.sum +++ b/go.sum @@ -10,16 +10,8 @@ charm.land/lipgloss/v2 v2.0.3 h1:yM2zJ4Cf5Y51b7RHIwioil4ApI/aypFXXVHSwlM6RzU= charm.land/lipgloss/v2 v2.0.3/go.mod h1:7myLU9iG/3xluAWzpY/fSxYYHCgoKTie7laxk6ATwXA= code.gitea.io/gitea-vet v0.2.3 h1:gdFmm6WOTM65rE8FUBTRzeQZYzXePKSSB1+r574hWwI= code.gitea.io/gitea-vet v0.2.3/go.mod h1:zcNbT/aJEmivCAhfmkHOlT645KNOf9W2KnkLgFjGGfE= -dario.cat/mergo v1.0.2 h1:85+piFYR1tMbRrLcDwR18y4UKJ3aH1Tbzi24VRW1TK8= -dario.cat/mergo v1.0.2/go.mod h1:E/hbnu0NxMFBjpMIE34DRGLWqDy0g5FuKDhCb31ngxA= gitea.com/noerw/unidiff-comments v0.0.0-20220822113322-50f4daa0e35c h1:8fTkq2UaVkLHZCF+iB4wTxINmVAToe2geZGayk9LMbA= gitea.com/noerw/unidiff-comments v0.0.0-20220822113322-50f4daa0e35c/go.mod h1:Fc8iyPm4NINRWujeIk2bTfcbGc4ZYY29/oMAAGcr4qI= -gitea.dev/sdk v0.0.0-20260525162228-ffb5234862e0 h1:ZqpFhspucP2OpkgxWdrXEulp5RLKpIXKqb1aHdewtIg= -gitea.dev/sdk v0.0.0-20260525162228-ffb5234862e0/go.mod h1:jCf5Uzz0Jkb61jxNgMxLOCWwle1J1B2nKdcRtxuK9rY= -gitea.dev/sdk v1.0.0 h1:S7FDAeRnvOwOgWKoEGKsTsjf9jg/b6tcDIzxFY9AiEo= -gitea.dev/sdk v1.0.0/go.mod h1:jCf5Uzz0Jkb61jxNgMxLOCWwle1J1B2nKdcRtxuK9rY= -gitea.dev/sdk v1.0.1-0.20260526041347-23be5b0596e7 h1:06cYUmiIO2X4fsxKmCmkRXKxitaF7s1ZultK5YZvqKU= -gitea.dev/sdk v1.0.1-0.20260526041347-23be5b0596e7/go.mod h1:jCf5Uzz0Jkb61jxNgMxLOCWwle1J1B2nKdcRtxuK9rY= gitea.dev/sdk v1.0.1 h1:CWXQUQvp2I6YKOWkhYo1Flx2sRNfMK1X9Op4oR2awXs= gitea.dev/sdk v1.0.1/go.mod h1:jCf5Uzz0Jkb61jxNgMxLOCWwle1J1B2nKdcRtxuK9rY= github.com/42wim/httpsig v1.2.4 h1:mI5bH0nm4xn7K18fo1K3okNDRq8CCJ0KbBYWyA6r8lU= @@ -80,7 +72,6 @@ github.com/clipperhouse/uax29/v2 v2.7.0 h1:+gs4oBZ2gPfVrKPthwbMzWZDaAFPGYK72F0NJ github.com/clipperhouse/uax29/v2 v2.7.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM= github.com/cpuguy83/go-md2man/v2 v2.0.7 h1:zbFlGlXEAKlwXpmvle3d8Oe3YnkKIK4xSRTd3sHPnBo= github.com/cpuguy83/go-md2man/v2 v2.0.7/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/creack/pty v1.1.24 h1:bJrF4RRfyJnbTJqzRLHzcGaZK1NeM5kTC9jGgovnR1s= github.com/creack/pty v1.1.24/go.mod h1:08sCNb52WyoAwi2QDyzUCTgcvVFhUzewun7wtTfvcwE= github.com/danieljoos/wincred v1.2.3 h1:v7dZC2x32Ut3nEfRH+vhoZGvN72+dQ/snVXo/vMFLdQ= @@ -98,39 +89,22 @@ github.com/enescakir/emoji v1.0.0 h1:W+HsNql8swfCQFtioDGDHCHri8nudlK1n5p2rHCJoog github.com/enescakir/emoji v1.0.0/go.mod h1:Bt1EKuLnKDTYpLALApstIkAjdDrS/8IAgTkKp+WKFD0= github.com/fatih/color v1.19.0 h1:Zp3PiM21/9Ld6FzSKyL5c/BULoe/ONr9KlbYVOfG8+w= github.com/fatih/color v1.19.0/go.mod h1:zNk67I0ZUT1bEGsSGyCZYZNrHuTkJJB+r6Q9VuMi0LE= -github.com/gliderlabs/ssh v0.3.8 h1:a4YXD1V7xMF9g5nTkdfnja3Sxy1PVDCj1Zg4Wb8vY6c= -github.com/gliderlabs/ssh v0.3.8/go.mod h1:xYoytBv1sV0aL3CavoDuJIQNURXkkfPA/wxQ1pL1fAU= -github.com/go-fed/httpsig v1.1.0 h1:9M+hb0jkEICD8/cAiNqEB66R87tTINszBRTjwjQzWcI= -github.com/go-fed/httpsig v1.1.0/go.mod h1:RCMrTZvN1bJYtofsG4rd5NaO5obxQ5xBkdiS7xsT7bM= -github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= -github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= -github.com/go-git/go-billy/v5 v5.8.0 h1:I8hjc3LbBlXTtVuFNJuwYuMiHvQJDq1AT6u4DwDzZG0= -github.com/go-git/go-billy/v5 v5.8.0/go.mod h1:RpvI/rw4Vr5QA+Z60c6d6LXH0rYJo0uD5SqfmrrheCY= -github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399 h1:eMje31YglSBqCdIqdhKBW8lokaMrL3uTkpGYlE2OOT4= -github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399/go.mod h1:1OCfN199q1Jm3HZlxleg+Dw/mwps2Wbk9frAWm+4FII= -github.com/go-git/go-git/v5 v5.18.0 h1:O831KI+0PR51hM2kep6T8k+w0/LIAD490gvqMCvL5hM= -github.com/go-git/go-git/v5 v5.18.0/go.mod h1:pW/VmeqkanRFqR6AljLcs7EA7FbZaN5MQqO7oZADXpo= github.com/go-authgate/sdk-go v0.11.0 h1:ZTfJ0rzeDn4QBqAmF9VKS3CqlKhE8+0tJxg8OGNtIzo= github.com/go-authgate/sdk-go v0.11.0/go.mod h1:sa0ige5wtayj2WcnXlxa8wGuyi5z/c/chc0mXPJTl/Q= +github.com/go-fed/httpsig v1.1.0 h1:9M+hb0jkEICD8/cAiNqEB66R87tTINszBRTjwjQzWcI= +github.com/go-fed/httpsig v1.1.0/go.mod h1:RCMrTZvN1bJYtofsG4rd5NaO5obxQ5xBkdiS7xsT7bM= github.com/goccy/go-json v0.10.6 h1:p8HrPJzOakx/mn/bQtjgNjdTcN+/S6FcG2CTtQOrHVU= github.com/goccy/go-json v0.10.6/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= github.com/godbus/dbus/v5 v5.2.2 h1:TUR3TgtSVDmjiXOgAAyaZbYmIeP3DPkld3jgKGV8mXQ= github.com/godbus/dbus/v5 v5.2.2/go.mod h1:3AAv2+hPq5rdnr5txxxRwiGjPXamgoIHgz9FPBfOp3c= -github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= -github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/gorilla/css v1.0.1 h1:ntNaBIghp6JmvWnxbZKANoLyuXTPZ4cAMlo6RyhlbO8= github.com/gorilla/css v1.0.1/go.mod h1:BvnYkspnSzMmwRK+b8/xgNPLiIuNZr6vbZBTPQ2A3b0= github.com/hashicorp/go-version v1.9.0 h1:CeOIz6k+LoN3qX9Z0tyQrPtiB1DFYRPfCIBtaXPSCnA= github.com/hashicorp/go-version v1.9.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/lucasb-eyer/go-colorful v1.4.0 h1:UtrWVfLdarDgc44HcS7pYloGHJUjHV/4FwW4TvVgFr4= github.com/lucasb-eyer/go-colorful v1.4.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= @@ -156,15 +130,11 @@ github.com/olekukonko/ll v0.1.8 h1:ysHCJRGHYKzmBSdz9w5AySztx7lG8SQY+naTGYUbsz8= github.com/olekukonko/ll v0.1.8/go.mod h1:RPRC6UcscfFZgjo1nulkfMH5IM0QAYim0LfnMvUuozw= github.com/olekukonko/tablewriter v1.1.4 h1:ORUMI3dXbMnRlRggJX3+q7OzQFDdvgbN9nVWj1drm6I= github.com/olekukonko/tablewriter v1.1.4/go.mod h1:+kedxuyTtgoZLwif3P1Em4hARJs+mVnzKxmsCL/C5RY= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/scylladb/termtables v0.0.0-20191203121021-c4c0b6d42ff4/go.mod h1:C1a7PQSMz9NShzorzCiG2fk9+xuCgLkPeCvMHYR2OWg= @@ -234,9 +204,8 @@ golang.org/x/tools v0.45.0/go.mod h1:LuUGqqaXcXMEFEruIVJVm5mgDD8vww/z/SR1gQ4uE/0 golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/modules/task/pull_checkout.go b/modules/task/pull_checkout.go index 7d4854a4..2b4dd89d 100644 --- a/modules/task/pull_checkout.go +++ b/modules/task/pull_checkout.go @@ -5,18 +5,12 @@ package task import ( stdctx "context" - "encoding/base64" "fmt" - "os" - "os/exec" - "strconv" - "strings" gitea "gitea.dev/sdk" "gitea.dev/tea/modules/config" local_git "gitea.dev/tea/modules/git" - "gitea.dev/tea/modules/utils" ) // PullCheckout checkout current workdir to the head branch of specified pull request @@ -163,52 +157,3 @@ func doPRCheckout( fmt.Println(info) return localRepo.TeaCheckout(checkoutRef) } - -func runGitFetch(remoteName, remoteURL, authToken, sshKey string, refspecs ...string) error { - args := []string{} - if authToken != "" && isHTTPRemote(remoteURL) { - args = append(args, "-c", "http.extraheader="+buildGitAuthHeader(authToken)) - } - args = append(args, "fetch") - args = append(args, remoteName) - args = append(args, refspecs...) - - cmd := exec.Command("git", args...) - cmd.Env = os.Environ() - if sshKey != "" && isSSHRemote(remoteURL) { - absKey, err := utils.AbsPathWithExpansion(sshKey) - if err != nil { - return err - } - cmd.Env = append(cmd.Env, "GIT_SSH_COMMAND=ssh -i "+strconv.Quote(absKey)+" -o IdentitiesOnly=yes") - } - - output, err := cmd.CombinedOutput() - if err == nil { - trimmed := string(output) - if trimmed != "" { - fmt.Print(trimmed) - } - return nil - } - - msg := string(output) - if msg == "" { - return fmt.Errorf("git fetch %s: %w", remoteName, err) - } - - return fmt.Errorf("git fetch %s: %w: %s", remoteName, err, msg) -} - -func buildGitAuthHeader(authToken string) string { - encoded := base64.StdEncoding.EncodeToString([]byte(authToken + ":")) - return "Authorization: Basic " + encoded -} - -func isHTTPRemote(remoteURL string) bool { - return strings.HasPrefix(remoteURL, "http://") || strings.HasPrefix(remoteURL, "https://") -} - -func isSSHRemote(remoteURL string) bool { - return strings.HasPrefix(remoteURL, "ssh://") -} diff --git a/tests/integration/git_branch_test.go b/tests/integration/git_branch_test.go index 71dc64c0..94cb81a1 100644 --- a/tests/integration/git_branch_test.go +++ b/tests/integration/git_branch_test.go @@ -10,8 +10,7 @@ import ( "strings" "testing" - teagit "code.gitea.io/tea/modules/git" - git_plumbing "github.com/go-git/go-git/v5/plumbing" + teagit "gitea.dev/tea/modules/git" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -23,7 +22,7 @@ func TestTeaCheckoutRemoteReferenceKeepsWorktreeClean(t *testing.T) { repo, err := teagit.RepoFromPath(clonePath) require.NoError(t, err) - err = repo.TeaCheckout(git_plumbing.NewRemoteReferenceName("origin", "feature/test-branch")) + err = repo.TeaCheckout(teagit.NewRemoteReferenceName("origin", "feature/test-branch")) require.NoError(t, err) assert.Empty(t, gitOutput(t, clonePath, "status", "--porcelain")) @@ -40,7 +39,7 @@ func TestTeaCreateBranchTracksRemoteBranch(t *testing.T) { err = repo.TeaCreateBranch("pulls/123", "feature/test-branch", "origin") require.NoError(t, err) - err = repo.TeaCheckout(git_plumbing.NewBranchReferenceName("pulls/123")) + err = repo.TeaCheckout(teagit.NewBranchReferenceName("pulls/123")) require.NoError(t, err) assert.Empty(t, gitOutput(t, clonePath, "status", "--porcelain")) diff --git a/tests/integration/pulls_reply_test.go b/tests/integration/pulls_reply_test.go index 2383930a..523902fa 100644 --- a/tests/integration/pulls_reply_test.go +++ b/tests/integration/pulls_reply_test.go @@ -12,8 +12,9 @@ import ( "testing" "time" - "code.gitea.io/sdk/gitea" - "code.gitea.io/tea/cmd/pulls" + "gitea.dev/tea/cmd/pulls" + + gitea "gitea.dev/sdk" "github.com/stretchr/testify/require" "github.com/urfave/cli/v3" ) @@ -26,14 +27,14 @@ func TestPullsReply(t *testing.T) { featureBranch := fmt.Sprintf("reply-test-%d", timestamp) replyBody := fmt.Sprintf("Thanks for the review %d", timestamp) - repo, _, err := client.CreateRepo(gitea.CreateRepoOption{ + repo, _, err := client.Repositories.CreateRepo(t.Context(), gitea.CreateRepoOption{ Name: repoName, AutoInit: true, DefaultBranch: "main", }) require.NoError(t, err) t.Cleanup(func() { - if _, delErr := client.DeleteRepo(login.User, repoName); delErr != nil { + if _, delErr := client.Repositories.DeleteRepo(t.Context(), login.User, repoName); delErr != nil { t.Logf("failed to delete integration test repo %q: %v", repoName, delErr) } }) @@ -43,7 +44,7 @@ func TestPullsReply(t *testing.T) { baseBranch = "main" } - _, _, err = client.CreateFile(login.User, repoName, "review.txt", gitea.CreateFileOptions{ + _, _, err = client.Repositories.CreateFile(t.Context(), login.User, repoName, "review.txt", gitea.CreateFileOptions{ FileOptions: gitea.FileOptions{ Message: "add review target", BranchName: baseBranch, @@ -53,7 +54,7 @@ func TestPullsReply(t *testing.T) { }) require.NoError(t, err) - pr, _, err := client.CreatePullRequest(login.User, repoName, gitea.CreatePullRequestOption{ + pr, _, err := client.PullRequests.CreatePullRequest(t.Context(), login.User, repoName, gitea.CreatePullRequestOption{ Base: baseBranch, Head: featureBranch, Title: "Integration test for pr reply", @@ -61,7 +62,7 @@ func TestPullsReply(t *testing.T) { }) require.NoError(t, err) - review, _, err := client.CreatePullReview(login.User, repoName, pr.Index, gitea.CreatePullReviewOptions{ + review, _, err := client.PullRequests.CreatePullReview(t.Context(), login.User, repoName, pr.Index, gitea.CreatePullReviewOptions{ State: gitea.ReviewStateComment, Body: "Please take another look.", Comments: []gitea.CreatePullReviewComment{{ @@ -72,7 +73,7 @@ func TestPullsReply(t *testing.T) { }) require.NoError(t, err) - comments, _, err := client.ListPullReviewComments(login.User, repoName, pr.Index, review.ID) + comments, _, err := client.PullRequests.ListPullReviewComments(t.Context(), login.User, repoName, pr.Index, review.ID) require.NoError(t, err) require.Len(t, comments, 1) @@ -98,7 +99,7 @@ func TestPullsReply(t *testing.T) { require.NoError(t, err) require.Eventually(t, func() bool { - reviewComments, _, listErr := client.ListPullReviewComments(login.User, repoName, pr.Index, review.ID) + reviewComments, _, listErr := client.PullRequests.ListPullReviewComments(t.Context(), login.User, repoName, pr.Index, review.ID) if listErr != nil { t.Logf("failed to list review comments: %v", listErr) return false