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)
|
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,
|
State: gitea.ReviewStatePending,
|
||||||
Body: "",
|
Body: "",
|
||||||
CommitID: pr.Head.Sha,
|
CommitID: pr.Head.Sha,
|
||||||
|
|
|
@ -16,7 +16,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
prID int64
|
prIndex int64
|
||||||
branch string
|
branch string
|
||||||
|
|
||||||
patchCmd = &cobra.Command{
|
patchCmd = &cobra.Command{
|
||||||
|
@ -27,27 +27,27 @@ var (
|
||||||
client, err := gitea.NewClient(config.Gitea.InstanceURL, gitea.SetToken(config.Gitea.Token))
|
client, err := gitea.NewClient(config.Gitea.InstanceURL, gitea.SetToken(config.Gitea.Token))
|
||||||
core.ExitOnError("Couldn't create gitea client", err)
|
core.ExitOnError("Couldn't create gitea client", err)
|
||||||
|
|
||||||
err = GetPrID(client, &prID)
|
err = GetPRIndex(client, &prIndex)
|
||||||
core.ExitOnError("Couldn't get PR ID", err)
|
core.ExitOnError("Couldn't get PR ID", err)
|
||||||
|
|
||||||
WriteReview(client, prID)
|
WriteReview(client, prIndex)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
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")
|
patchCmd.Flags().StringVarP(&branch, "branch", "b", "", "specifies branch where the review is present")
|
||||||
}
|
}
|
||||||
|
|
||||||
func WriteReview(client *gitea.Client, prID int64) {
|
func WriteReview(client *gitea.Client, prIndex int64) {
|
||||||
comments := core.GetComments(&config, client, prID)
|
comments := core.GetComments(&config, client, prIndex)
|
||||||
core.ProcessComments(&config, &comments)
|
core.ProcessComments(&config, &comments)
|
||||||
PatchFiles(comments)
|
PatchFiles(comments)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetPrID(client *gitea.Client, prID *int64) error {
|
func GetPRIndex(client *gitea.Client, prIndex *int64) error {
|
||||||
if *prID != -1 {
|
if *prIndex != -1 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue