diff --git a/modules/print/pull.go b/modules/print/pull.go index 1be458f3..fcdf9781 100644 --- a/modules/print/pull.go +++ b/modules/print/pull.go @@ -73,6 +73,10 @@ func PullDetails(pr *gitea.PullRequest, reviews []*gitea.PullReview, ciStatus *g out += "- Maintainers are allowed to edit\n" } + if pr.HTMLURL != "" { + out = strings.TrimRight(out, "\n") + "\n\n" + pr.HTMLURL + "\n" + } + outputMarkdown(out, getRepoURL(pr.HTMLURL)) } diff --git a/modules/print/pull_test.go b/modules/print/pull_test.go index d771ff82..39db8bd7 100644 --- a/modules/print/pull_test.go +++ b/modules/print/pull_test.go @@ -99,6 +99,17 @@ func TestFormatCIStatusAllStates(t *testing.T) { } } +func TestPullDetailsIncludesHTMLURL(t *testing.T) { + pr := newTestPR(8, "Crm wip") + pr.HTMLURL = "https://gitea.example.com/owner/repo/pulls/8" + + out := captureStdout(t, func() { + PullDetails(pr, nil, nil) + }) + + assert.Contains(t, out, pr.HTMLURL) +} + func TestPullsListWithCIField(t *testing.T) { prs := []*gitea.PullRequest{ newTestPR(1, "feat: add feature"), diff --git a/modules/task/pull_create.go b/modules/task/pull_create.go index 9bd2f597..f35f5783 100644 --- a/modules/task/pull_create.go +++ b/modules/task/pull_create.go @@ -88,8 +88,6 @@ func CreatePull(requestCtx stdctx.Context, ctx *context.TeaContext, base, head s print.PullDetails(pr, nil, nil) - fmt.Println(pr.HTMLURL) - return err }