diff --git a/common/associated_pr_scanner.go b/common/associated_pr_scanner.go index 92a83b6..0c18521 100644 --- a/common/associated_pr_scanner.go +++ b/common/associated_pr_scanner.go @@ -11,7 +11,7 @@ import ( "strings" ) -const PrPattern = "PR: %s/%s#%d" +const PrPattern = "PR: %s/%s!%d" type BasicPR struct { Org, Repo string @@ -36,10 +36,14 @@ func parsePrLine(line string) (BasicPR, error) { return ret, errors.New("missing / separator") } - repo := strings.SplitN(org[1], "#", 2) + repo := strings.SplitN(org[1], "!", 2) ret.Repo = repo[0] if len(repo) != 2 { - return ret, errors.New("Missing # separator") + repo := strings.SplitN(org[1], "#", 2) + ret.Repo = repo[0] + } + if len(repo) != 2 { + return ret, errors.New("Missing ! or # separator") } // Gitea requires that each org and repo be [A-Za-z0-9_-]+ diff --git a/common/pr.go b/common/pr.go index 83b5513..5adb906 100644 --- a/common/pr.go +++ b/common/pr.go @@ -273,7 +273,7 @@ func (rs *PRSet) AssignReviewers(gitea GiteaReviewFetcherAndRequester, maintaine if !IsDryRun { for _, r := range reviewers { if _, err := gitea.RequestReviews(pr.PR, r); err != nil { - LogError("Cannot create reviews on", fmt.Sprintf("%s/%s#%d for [%s]", pr.PR.Base.Repo.Owner.UserName, pr.PR.Base.Repo.Name, pr.PR.Index, strings.Join(reviewers, ", ")), err) + LogError("Cannot create reviews on", fmt.Sprintf("%s/%s!%d for [%s]", pr.PR.Base.Repo.Owner.UserName, pr.PR.Base.Repo.Name, pr.PR.Index, strings.Join(reviewers, ", ")), err) } } } @@ -397,7 +397,7 @@ func (rs *PRSet) Merge(gitea GiteaReviewUnrequester, git Git) error { panic("FIXME") } */ - msg := fmt.Sprintf("Merging\n\nPR: %s/%s#%d", prjgit.Base.Repo.Owner.UserName, prjgit.Base.Repo.Name, prjgit.Index) + msg := fmt.Sprintf("Merging\n\nPR: %s/%s!%d", prjgit.Base.Repo.Owner.UserName, prjgit.Base.Repo.Name, prjgit.Index) err = git.GitExec(DefaultGitPrj, "merge", "--no-ff", "-m", msg, prjgit.Head.Sha) if err != nil { diff --git a/common/utils.go b/common/utils.go index 08fb05b..d342235 100644 --- a/common/utils.go +++ b/common/utils.go @@ -132,7 +132,7 @@ func PRtoString(pr *models.PullRequest) string { return "(null)" } - return fmt.Sprintf("%s/%s#%d", pr.Base.Repo.Owner.UserName, pr.Base.Repo.Name, pr.Index) + return fmt.Sprintf("%s/%s!%d", pr.Base.Repo.Owner.UserName, pr.Base.Repo.Name, pr.Index) } type DevelProject struct { diff --git a/group-review/main.go b/group-review/main.go index cc6dd80..608791a 100644 --- a/group-review/main.go +++ b/group-review/main.go @@ -157,7 +157,7 @@ func ProcessNotifications(notification *models.NotificationThread, gitea common. repo := match[2] id, _ := strconv.ParseInt(match[3], 10, 64) - common.LogInfo("processing:", fmt.Sprintf("%s/%s#%d", org, repo, id)) + common.LogInfo("processing:", fmt.Sprintf("%s/%s!%d", org, repo, id)) pr, err := gitea.GetPullRequest(org, repo, id) if err != nil { common.LogError(" ** Cannot fetch PR associated with review:", subject.URL, "Error:", err) @@ -181,7 +181,7 @@ func ProcessNotifications(notification *models.NotificationThread, gitea common. config := configs.GetPrjGitConfig(org, repo, pr.Base.Name) if config == nil { - common.LogError("Cannot find config for:", fmt.Sprintf("%s/%s#%s", org, repo, pr.Base.Name)) + common.LogError("Cannot find config for:", fmt.Sprintf("%s/%s!%s", org, repo, pr.Base.Name)) return } if pr.State == "closed" { diff --git a/obs-forward-bot/main.go b/obs-forward-bot/main.go index 32ad54e..bf0ccfb 100644 --- a/obs-forward-bot/main.go +++ b/obs-forward-bot/main.go @@ -108,7 +108,7 @@ func ProcessNotification(notification *models.NotificationThread) { repo := match[2] id, _ := strconv.ParseInt(match[3], 10, 64) - common.LogInfo("processing:", fmt.Sprintf("%s/%s#%d", org, repo, id)) + common.LogInfo("processing:", fmt.Sprintf("%s/%s!%d", org, repo, id)) pr, err := Gitea.GetPullRequest(org, repo, id) if err != nil { common.LogError(" ** Cannot fetch PR associated with review:", subject.URL, "Error:", err) diff --git a/workflow-pr/pr_processor.go b/workflow-pr/pr_processor.go index 2e52f9d..5c966de 100644 --- a/workflow-pr/pr_processor.go +++ b/workflow-pr/pr_processor.go @@ -80,7 +80,7 @@ func AllocatePRProcessor(req *common.PullRequestWebhookEvent, configs common.Aut branch := req.Pull_Request.Base.Ref - PRstr := fmt.Sprintf("%s/%s#%d", org, repo, id) + PRstr := fmt.Sprintf("%s/%s!%d", org, repo, id) common.LogInfo("*** Starting processing PR:", PRstr, "branch:", branch) config := configs.GetPrjGitConfig(org, repo, branch)