feat(open): prefix solutions with common header
Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
parent
a869a3ebf8
commit
10a32ccbbd
1 changed files with 21 additions and 0 deletions
|
@ -32,6 +32,12 @@ var (
|
|||
}
|
||||
)
|
||||
|
||||
func PathFromBranchName(branch string) string {
|
||||
task := strings.Split(branch, ".")[0]
|
||||
source_file := fmt.Sprintf("%s.%s", strings.SplitN(task, "_", 2)[1], config.Language.DefaultSuffix)
|
||||
return fmt.Sprintf("%s/%s", branch, source_file)
|
||||
}
|
||||
|
||||
func ProcessBranches(client *gitea.Client, milestone *gitea.Milestone, branches []*gitea.Branch) {
|
||||
for _, branch := range branches {
|
||||
if !strings.HasPrefix(branch.Name, milestone.Title) {
|
||||
|
@ -47,6 +53,21 @@ func ProcessBranches(client *gitea.Client, milestone *gitea.Milestone, branches
|
|||
})
|
||||
core.ExitOnError("Couldn't create PR", err)
|
||||
|
||||
_, _, err = client.CreatePullReview(config.Gitea.Owner, config.Gitea.Repository, pr.ID, gitea.CreatePullReviewOptions{
|
||||
State: gitea.ReviewStatePending,
|
||||
Body: "",
|
||||
CommitID: pr.Head.Sha,
|
||||
Comments: []gitea.CreatePullReviewComment{
|
||||
gitea.CreatePullReviewComment{
|
||||
Path: PathFromBranchName(branch.Name),
|
||||
Body: config.Prefix,
|
||||
OldLineNum: 0,
|
||||
NewLineNum: 1,
|
||||
},
|
||||
},
|
||||
})
|
||||
core.ExitOnError("Couldn't create a PR review comment", err)
|
||||
|
||||
fmt.Printf("Created PR #%s\n", pr.ID)
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue