diff --git a/src/cmd/open.go b/src/cmd/open.go index a1db161..513a818 100644 --- a/src/cmd/open.go +++ b/src/cmd/open.go @@ -53,7 +53,7 @@ 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{ + _, _, err = client.CreatePullReview(config.Gitea.Owner, config.Gitea.Repository, pr.Index, gitea.CreatePullReviewOptions{ State: gitea.ReviewStatePending, Body: "", CommitID: pr.Head.Sha, diff --git a/src/cmd/patch.go b/src/cmd/patch.go index bf25b53..3a2bcba 100644 --- a/src/cmd/patch.go +++ b/src/cmd/patch.go @@ -16,8 +16,8 @@ import ( ) var ( - prID int64 - branch string + prIndex int64 + branch string patchCmd = &cobra.Command{ Use: "patch", @@ -27,27 +27,27 @@ var ( client, err := gitea.NewClient(config.Gitea.InstanceURL, gitea.SetToken(config.Gitea.Token)) core.ExitOnError("Couldn't create gitea client", err) - err = GetPrID(client, &prID) + err = GetPRIndex(client, &prIndex) core.ExitOnError("Couldn't get PR ID", err) - WriteReview(client, prID) + WriteReview(client, prIndex) }, } ) func init() { - patchCmd.Flags().Int64VarP(&prID, "prID", "p", -1, "specifies ID of pull request containing changes") + patchCmd.Flags().Int64VarP(&prIndex, "prID", "p", -1, "specifies ID of pull request containing changes") patchCmd.Flags().StringVarP(&branch, "branch", "b", "", "specifies branch where the review is present") } -func WriteReview(client *gitea.Client, prID int64) { - comments := core.GetComments(&config, client, prID) +func WriteReview(client *gitea.Client, prIndex int64) { + comments := core.GetComments(&config, client, prIndex) core.ProcessComments(&config, &comments) PatchFiles(comments) } -func GetPrID(client *gitea.Client, prID *int64) error { - if *prID != -1 { +func GetPRIndex(client *gitea.Client, prIndex *int64) error { + if *prIndex != -1 { return nil }