Skip to content

Commit

Permalink
Move GitHub Issue loading
Browse files Browse the repository at this point in the history
  • Loading branch information
jodyheavener committed Mar 19, 2024
1 parent 3980c65 commit 4b37c28
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
1 change: 1 addition & 0 deletions script/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type GitHub struct {
func (g *GitHub) Init() error {
if isTestingIssue() {
debugMessage("Skipping GitHub Init")
g.Issue = getTestIssue()
return nil
}

Expand Down
12 changes: 1 addition & 11 deletions script/reviewer.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package main
import (
"fmt"
"log"

"github.com/google/go-github/v60/github"
)

type Reviewer struct {
Expand All @@ -19,15 +17,7 @@ func (r *Reviewer) Review() {
}

// TODO: parse and validate the issue's body contents
fmt.Println(r.GetIssue())
}

func (r *Reviewer) GetIssue() github.Issue {
if isTestingIssue() {
return getTestIssue()
} else {
return *r.GitHub.Issue
}
fmt.Println(r.GitHub.Issue)
}

func (r *Reviewer) PrintErrorAndExit(err error) {
Expand Down
4 changes: 2 additions & 2 deletions script/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func debugMessage(message string, data ...interface{}) {
}
}

func getTestIssue() github.Issue {
func getTestIssue() *github.Issue {
data, err := os.ReadFile(fmt.Sprintf("./script/test-issues/%s.json", testIssueName))
if err != nil {
log.Fatalf("Unable to read the file: %v", err)
Expand All @@ -38,5 +38,5 @@ func getTestIssue() github.Issue {
log.Fatalf("Unable to unmarshal JSON: %v", err)
}

return issue
return &issue
}

0 comments on commit 4b37c28

Please sign in to comment.