diff --git a/modules/migration/pullrequest.go b/modules/migration/pullrequest.go index 1435991bd2..fbfdff0315 100644 --- a/modules/migration/pullrequest.go +++ b/modules/migration/pullrequest.go @@ -37,6 +37,7 @@ type PullRequest struct { ForeignIndex int64 Context DownloaderContext `yaml:"-"` EnsuredSafe bool `yaml:"ensured_safe"` + IsDraft bool `yaml:"is_draft"` } func (p *PullRequest) GetLocalIndex() int64 { return p.Number } diff --git a/services/migrations/gitea_uploader.go b/services/migrations/gitea_uploader.go index 3ba4ca203b..2076348535 100644 --- a/services/migrations/gitea_uploader.go +++ b/services/migrations/gitea_uploader.go @@ -760,10 +760,15 @@ func (g *GiteaLocalUploader) newPullRequest(pr *base.PullRequest) (*issues_model pr.Updated = pr.Created } + prTitle := pr.Title + if pr.IsDraft && !issues_model.HasWorkInProgressPrefix(pr.Title) { + prTitle = fmt.Sprintf("%s %s", setting.Repository.PullRequest.WorkInProgressPrefixes[0], pr.Title) + } + issue := issues_model.Issue{ RepoID: g.repo.ID, Repo: g.repo, - Title: pr.Title, + Title: prTitle, Index: pr.Number, Content: pr.Content, MilestoneID: milestoneID, diff --git a/services/migrations/github.go b/services/migrations/github.go index 44553e1802..3b127438d0 100644 --- a/services/migrations/github.go +++ b/services/migrations/github.go @@ -737,6 +737,7 @@ func (g *GithubDownloaderV3) GetPullRequests(page, perPage int) ([]*base.PullReq PatchURL: pr.GetPatchURL(), // see below for SECURITY related issues here Reactions: reactions, ForeignIndex: int64(*pr.Number), + IsDraft: pr.GetDraft(), }) // SECURITY: Ensure that the PR is safe diff --git a/services/migrations/gitlab.go b/services/migrations/gitlab.go index 1639a34862..da56d2a175 100644 --- a/services/migrations/gitlab.go +++ b/services/migrations/gitlab.go @@ -723,6 +723,7 @@ func (g *GitlabDownloader) GetPullRequests(page, perPage int) ([]*base.PullReque PatchURL: pr.WebURL + ".patch", ForeignIndex: int64(pr.IID), Context: gitlabIssueContext{IsMergeRequest: true}, + IsDraft: pr.Draft, }) // SECURITY: Ensure that the PR is safe