refactor: Factor out patching to separate function
Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
parent
171411f13a
commit
90800cfb67
1 changed files with 7 additions and 3 deletions
|
@ -30,9 +30,7 @@ var (
|
|||
err = GetPrID(client, &prID)
|
||||
core.ExitOnError("Couldn't get PR ID", err)
|
||||
|
||||
comments := core.GetComments(&config, client, prID)
|
||||
core.ProcessComments(&config, &comments)
|
||||
PatchFiles(comments)
|
||||
WriteReview(client, prID)
|
||||
},
|
||||
}
|
||||
)
|
||||
|
@ -42,6 +40,12 @@ func init() {
|
|||
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)
|
||||
core.ProcessComments(&config, &comments)
|
||||
PatchFiles(comments)
|
||||
}
|
||||
|
||||
func GetPrID(client *gitea.Client, prID *int64) error {
|
||||
if *prID != -1 {
|
||||
return nil
|
||||
|
|
Loading…
Reference in a new issue