diff --git a/.ci/containers/membership-checker/reviewer_assignment.go b/.ci/containers/membership-checker/reviewer_assignment.go index 3162e9090e1d..e7afdc9a50a7 100644 --- a/.ci/containers/membership-checker/reviewer_assignment.go +++ b/.ci/containers/membership-checker/reviewer_assignment.go @@ -4,6 +4,13 @@ import ( "fmt" "net/http" "strings" + + _ "embed" +) + +var ( + //go:embed REVIEWER_ASSIGNMENT_COMMENT.md + reviewerAssignmentComment string ) func requestReviewer(author, prNumber, GITHUB_TOKEN string) error { @@ -153,12 +160,8 @@ func requestRandomReviewer(prNumber, GITHUB_TOKEN string) error { func postComment(prNumber, reviewer, GITHUB_TOKEN string) error { url := fmt.Sprintf("https://api.github.com/repos/GoogleCloudPlatform/magic-modules/issues/%s/comments", prNumber) - comment, err := readFile(".ci/containers/membership-checker/REVIEWER_ASSIGNMENT_COMMENT.md") - if err != nil { - return err - } - comment = strings.Replace(comment, "{{reviewer}}", reviewer, 1) + comment := strings.Replace(reviewerAssignmentComment, "{{reviewer}}", reviewer, 1) body := map[string]string{ "body": comment, diff --git a/.ci/containers/membership-checker/utils.go b/.ci/containers/membership-checker/utils.go index 65217579ce8a..b08a7572691e 100644 --- a/.ci/containers/membership-checker/utils.go +++ b/.ci/containers/membership-checker/utils.go @@ -4,7 +4,6 @@ import ( "bytes" "encoding/json" "fmt" - "io/ioutil" "net/http" "golang.org/x/exp/slices" @@ -37,14 +36,6 @@ func requestCall(url, method, credentials string, result interface{}, body inter return resp.StatusCode, nil } -func readFile(filename string) (string, error) { - contents, err := ioutil.ReadFile(filename) - if err != nil { - return "", err - } - return string(contents), nil -} - func removes(s1 []string, s2 []string) []string { result := make([]string, 0, len(s1))