Support auto detecting branch for PRs #525

Open
harryzcy wants to merge 15 commits from harryzcy/tea:fix-524 into main
harryzcy added 1 commit 2023-01-04 08:24:07 +00:00
continuous-integration/drone/pr Build is failing Details
bff965e84c
Support auto detecting branch for PRs
harryzcy added 1 commit 2023-01-04 19:29:19 +00:00
continuous-integration/drone/pr Build is passing Details
e4ff7b8397
Make function unexported
lunny reviewed 2023-01-06 07:58:23 +00:00
@ -71,0 +92,4 @@
}
for _, pr := range prs {
if pr.Head.Ref == branch {

Maybe we should list multiple PRs in terminal and user could chose one.

Maybe we should list multiple PRs in terminal and user could chose one.
harryzcy marked this conversation as resolved
harryzcy added 1 commit 2023-01-07 22:47:28 +00:00
continuous-integration/drone/pr Build is passing Details
5a0ac6e1e8
List multiple PRs and offer choice
lunny reviewed 2023-01-09 05:15:48 +00:00
@ -71,0 +87,4 @@
func getPullIndex(ctx *context.TeaContext, branch string) (int64, error) {
prs, _, err := ctx.Login.Client().ListRepoPullRequests(ctx.Owner, ctx.Repo, gitea.ListPullRequestsOptions{
State: gitea.StateOpen,

You can send HeadBranch or BaseBranch as options.

You can send `HeadBranch` or `BaseBranch` as options.

I don't see that in ListPullRequestsOptions

// ListPullRequestsOptions options for listing pull requests
type ListPullRequestsOptions struct {
	ListOptions
	State StateType `json:"state"`
	// oldest, recentupdate, leastupdate, mostcomment, leastcomment, priority
	Sort      string
	Milestone int64
}
I don't see that in `ListPullRequestsOptions` ```go // ListPullRequestsOptions options for listing pull requests type ListPullRequestsOptions struct { ListOptions State StateType `json:"state"` // oldest, recentupdate, leastupdate, mostcomment, leastcomment, priority Sort string Milestone int64 } ```
6543 marked this conversation as resolved
lunny reviewed 2023-01-09 05:18:13 +00:00
@ -71,0 +108,4 @@
// then get the rest of the PRs
i := 1
for _, pr := range prs {
if pr.Head.Ref != branch {

We will get all pull requests which base branch or head branch is the current branch via ListRepoPullRequests. So maybe you mean pr.Base.Ref == branch?

We will get all pull requests which base branch or head branch is the current branch via `ListRepoPullRequests`. So maybe you mean `pr.Base.Ref == branch`?
harryzcy marked this conversation as resolved
harryzcy added 1 commit 2023-01-11 04:54:14 +00:00
continuous-integration/drone/pr Build is passing Details
783d167f37
Update branch filtering
jolheiser reviewed 2023-02-09 04:30:33 +00:00
@ -71,0 +119,4 @@
Options: prOptions,
PageSize: 10,
}
survey.AskOne(q, &selected)

This error should probably be checked.

This error should probably be checked.
harryzcy marked this conversation as resolved
6543 added 1 commit 2023-02-15 22:01:07 +00:00
continuous-integration/drone/pr Build is passing Details
90e98063c8
Merge branch 'main' into fix-524
6543 added 1 commit 2023-02-15 22:25:58 +00:00
continuous-integration/drone/pr Build is passing Details
f7587619f8
Merge branch 'main' into fix-524
harryzcy added 1 commit 2023-02-21 19:48:19 +00:00
continuous-integration/drone/pr Build is passing Details
26a5c6bc49
Check command line prompt error
harryzcy added 1 commit 2023-02-21 19:50:09 +00:00
continuous-integration/drone/pr Build is passing Details
8f0f19c5f8
Merge branch 'main' into fix-524
6543 reviewed 2023-03-21 02:35:17 +00:00
@ -71,0 +114,4 @@
}
selected := ""
q := &survey.Select{

if it gets interactive it should go into https://gitea.com/gitea/tea/src/branch/main/modules/interact

if it gets interactive it should go into https://gitea.com/gitea/tea/src/branch/main/modules/interact
harryzcy marked this conversation as resolved
6543 added 1 commit 2023-04-02 21:52:03 +00:00
check-and-test / check-and-test (pull_request) Successful in 1m55s Details
807fd93554
Merge branch 'main' into fix-524
harryzcy added 1 commit 2023-04-03 22:49:38 +00:00
check-and-test / check-and-test (pull_request) Failing after 1m7s Details
86bb8dbcb8
Move interactive part to interact package
harryzcy added 1 commit 2023-04-03 22:50:55 +00:00
check-and-test / check-and-test (pull_request) Failing after 28s Details
80e4b17749
Merge branch 'main' into fix-524
6543 added the
kind
feature
label 2023-04-04 04:35:12 +00:00
6543 added this to the v0.10.0 milestone 2023-04-04 04:35:16 +00:00

CI tell us we have a lint issue

CI tell us we have a lint issue
harryzcy added 1 commit 2023-04-18 03:42:49 +00:00
check-and-test / check-and-test (pull_request) Successful in 33s Details
3ce904ec7d
Add copyright to fix lint
harryzcy added 1 commit 2023-04-18 03:43:42 +00:00
check-and-test / check-and-test (pull_request) Successful in 30s Details
6413d72c22
Merge branch 'main' into fix-524

CI tell us we have a lint issue

Fixed

> CI tell us we have a lint issue Fixed
appleboy requested changes 2023-05-04 08:54:12 +00:00
@ -54,2 +55,4 @@
// If no PR index is provided, try interactive mode
return interact.MergePull(ctx)
}
Collaborator
if ctx.Args().Len() != 1 {
  return interact.MergePull(ctx)
}

for more readable.

```go if ctx.Args().Len() != 1 { return interact.MergePull(ctx) } ``` for more readable.

Fixed in 9fdfb1

Fixed in [9fdfb1](https://gitea.com/gitea/tea/commit/9fdfb1debca52f14bffeb68290a99e1ceadd202a)
lunny marked this conversation as resolved
@ -0,0 +1,90 @@
// Copyright 2020 The Gitea Authors. All rights reserved.
Collaborator

change to 2023?

change to 2023?

Fixed in 96ccce

Fixed in [96ccce](https://gitea.com/gitea/tea/commit/96cccedd3767ff5caa231edb1458d7652b3d6807)
lunny marked this conversation as resolved
@ -0,0 +1,25 @@
// Copyright 2020 The Gitea Authors. All rights reserved.
Collaborator

change to 2023

change to 2023

Fixed in 96ccce

Fixed in [96ccce](https://gitea.com/gitea/tea/commit/96cccedd3767ff5caa231edb1458d7652b3d6807)
lunny marked this conversation as resolved
harryzcy added 1 commit 2023-05-06 18:02:02 +00:00
check-and-test / check-and-test (pull_request) Successful in 1m33s Details
96cccedd37
Change copyright to 2023
harryzcy added 1 commit 2023-05-06 18:03:36 +00:00
check-and-test / check-and-test (pull_request) Successful in 51s Details
9fdfb1debc
Readibility update

Reviewers

appleboy requested changes 2023-05-04 08:54:12 +00:00
All checks were successful
check-and-test / check-and-test (pull_request) Successful in 51s
Required
Details
This Pull Request doesn't have enough approvals yet. 0 of 2 approvals granted.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
Sign in to join this conversation.
There is no content yet.