Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-25 11:16:11 +01:00

Support migrating GitHub/GitLab PR draft status (#32242)

Resolve #32196

(cherry picked from commit 74664b08a004393ce013e872e47901f52645b65a)
This commit is contained in:
Zettat123 2024-10-14 03:58:13 +08:00 committed by Gergely Nagy
parent dfe9bdd15f
commit 89446e60a6
No known key found for this signature in database
4 changed files with 9 additions and 1 deletions

View file

@ -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 }

View file

@ -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,

View file

@ -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

View file

@ -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