fix: rename prID to prIndex
Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
parent
10a32ccbbd
commit
6e68afcac4
2 changed files with 10 additions and 10 deletions
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue