mirror of
https://github.com/go-gitea/gitea.git
synced 2024-12-04 14:46:57 -05:00
Support migrating GitHub/GitLab PR draft status (#32242)
Resolve #32196
This commit is contained in:
parent
9df5ddaf44
commit
74664b08a0
@ -37,6 +37,7 @@ type PullRequest struct {
|
|||||||
ForeignIndex int64
|
ForeignIndex int64
|
||||||
Context DownloaderContext `yaml:"-"`
|
Context DownloaderContext `yaml:"-"`
|
||||||
EnsuredSafe bool `yaml:"ensured_safe"`
|
EnsuredSafe bool `yaml:"ensured_safe"`
|
||||||
|
IsDraft bool `yaml:"is_draft"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PullRequest) GetLocalIndex() int64 { return p.Number }
|
func (p *PullRequest) GetLocalIndex() int64 { return p.Number }
|
||||||
|
@ -760,10 +760,15 @@ func (g *GiteaLocalUploader) newPullRequest(pr *base.PullRequest) (*issues_model
|
|||||||
pr.Updated = pr.Created
|
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{
|
issue := issues_model.Issue{
|
||||||
RepoID: g.repo.ID,
|
RepoID: g.repo.ID,
|
||||||
Repo: g.repo,
|
Repo: g.repo,
|
||||||
Title: pr.Title,
|
Title: prTitle,
|
||||||
Index: pr.Number,
|
Index: pr.Number,
|
||||||
Content: pr.Content,
|
Content: pr.Content,
|
||||||
MilestoneID: milestoneID,
|
MilestoneID: milestoneID,
|
||||||
|
@ -737,6 +737,7 @@ func (g *GithubDownloaderV3) GetPullRequests(page, perPage int) ([]*base.PullReq
|
|||||||
PatchURL: pr.GetPatchURL(), // see below for SECURITY related issues here
|
PatchURL: pr.GetPatchURL(), // see below for SECURITY related issues here
|
||||||
Reactions: reactions,
|
Reactions: reactions,
|
||||||
ForeignIndex: int64(*pr.Number),
|
ForeignIndex: int64(*pr.Number),
|
||||||
|
IsDraft: pr.GetDraft(),
|
||||||
})
|
})
|
||||||
|
|
||||||
// SECURITY: Ensure that the PR is safe
|
// SECURITY: Ensure that the PR is safe
|
||||||
|
@ -722,6 +722,7 @@ func (g *GitlabDownloader) GetPullRequests(page, perPage int) ([]*base.PullReque
|
|||||||
PatchURL: pr.WebURL + ".patch",
|
PatchURL: pr.WebURL + ".patch",
|
||||||
ForeignIndex: int64(pr.IID),
|
ForeignIndex: int64(pr.IID),
|
||||||
Context: gitlabIssueContext{IsMergeRequest: true},
|
Context: gitlabIssueContext{IsMergeRequest: true},
|
||||||
|
IsDraft: pr.Draft,
|
||||||
})
|
})
|
||||||
|
|
||||||
// SECURITY: Ensure that the PR is safe
|
// SECURITY: Ensure that the PR is safe
|
||||||
|
Loading…
Reference in New Issue
Block a user