diff --git a/cmd/labelPRs.go b/cmd/labelPRs.go index 29e21a4..8dc9b16 100644 --- a/cmd/labelPRs.go +++ b/cmd/labelPRs.go @@ -27,7 +27,7 @@ var labelPRsCmd = &cobra.Command{ loopDuration := viper.GetDuration("loop-time") for { log.Println("Labeling Pull Requests") - err = label.PullRequests(client, cfg.InternalTeam, cfg) + err = label.PullRequests(client, cfg) if err != nil { log.Fatalln(err.Error()) } diff --git a/cmd/notifyPendingCI.go b/cmd/notifyPendingCI.go index 84b7572..d3784c2 100644 --- a/cmd/notifyPendingCI.go +++ b/cmd/notifyPendingCI.go @@ -27,7 +27,7 @@ var notifyPendingCICmd = &cobra.Command{ var listPendingPRs []string for { log.Println("Checking for community PRs that are waiting for CI to run") - listPendingPRs, err = github2.CheckForPendingCI(client, cfg.InternalTeam, cfg) + listPendingPRs, err = github2.CheckForPendingCI(client, cfg) if err != nil { log.Printf("The following error occurred while obtaining a list of pending PRs: %s", err) time.Sleep(loopDuration) diff --git a/cmd/notifyStale.go b/cmd/notifyStale.go index 06a779c..dbbf3ae 100644 --- a/cmd/notifyStale.go +++ b/cmd/notifyStale.go @@ -27,7 +27,7 @@ var notifyStaleCmd = &cobra.Command{ var listPendingPRs []string for { log.Println("Checking for community PRs that have no update in the last 7 days") - _, err = github2.CheckStalePRs(client, cfg.InternalTeam, cfg) + _, err = github2.CheckStalePRs(client, cfg) if err != nil { log.Printf("The following error occurred while obtaining a list of stale PRs: %s", err) time.Sleep(loopDuration) diff --git a/internal/github/checkPendingCI.go b/internal/github/checkPendingCI.go index 3d21433..26d458c 100644 --- a/internal/github/checkPendingCI.go +++ b/internal/github/checkPendingCI.go @@ -14,11 +14,11 @@ import ( ) // CheckForPendingCI returns a list of PR URLs that are ready for CI to run but haven't started yet. -func CheckForPendingCI(githubClient *github.Client, internalTeam string, repos *config.Config) ([]string, error) { - teamMembers, _ := GetTeamMemberList(githubClient, internalTeam) +func CheckForPendingCI(githubClient *github.Client, cfg *config.Config) ([]string, error) { + teamMembers, _ := GetTeamMemberList(githubClient, cfg.InternalTeam) var pendingPRs []string - for _, fullRepo := range repos.CheckRepos { + for _, fullRepo := range cfg.CheckRepos { log.Println("Checking repository:", fullRepo.Name) parts := strings.Split(fullRepo.Name, "/") if len(parts) != 2 { @@ -28,7 +28,7 @@ func CheckForPendingCI(githubClient *github.Client, internalTeam string, repos * owner, repo := parts[0], parts[1] // Fetch community PRs using the FindCommunityPRs function - communityPRs, err := FindCommunityPRs(repos, teamMembers, githubClient) + communityPRs, err := FindCommunityPRs(cfg, teamMembers, githubClient) if err != nil { return nil, err } diff --git a/internal/github/checkStalePRs.go b/internal/github/checkStalePRs.go index aeab26a..455fde9 100644 --- a/internal/github/checkStalePRs.go +++ b/internal/github/checkStalePRs.go @@ -12,10 +12,10 @@ import ( ) // CheckStalePRs will return a list of PR URLs that have not been updated in the last 7 days by internal team members. -func CheckStalePRs(githubClient *github.Client, internalTeam string, cfg *config.Config) ([]string, error) { +func CheckStalePRs(githubClient *github.Client, cfg *config.Config) ([]string, error) { var stalePRUrls []string cutoffDate := time.Now().Add(7 * 24 * time.Hour) // 7 days ago - teamMembers, err := GetTeamMemberList(githubClient, internalTeam) + teamMembers, err := GetTeamMemberList(githubClient, cfg.InternalTeam) if err != nil { return nil, err } diff --git a/internal/label/pullrequests.go b/internal/label/pullrequests.go index 7ebeca4..a93a4d8 100644 --- a/internal/label/pullrequests.go +++ b/internal/label/pullrequests.go @@ -12,8 +12,8 @@ import ( ) // PullRequests applies internal or community labels to pull requests -func PullRequests(githubClient *github.Client, internalTeam string, cfg *config.Config) error { - teamMembers, err := github2.GetTeamMemberList(githubClient, internalTeam) +func PullRequests(githubClient *github.Client, cfg *config.Config) error { + teamMembers, err := github2.GetTeamMemberList(githubClient, cfg.InternalTeam) if err != nil { return fmt.Errorf("error getting team members: %w", err) // Properly handle and return error if team member list fetch fails }