Skip to content

Commit

Permalink
fixup! fixup! feat: 🎸 skip creating a pr for rds drift if one already…
Browse files Browse the repository at this point in the history
… exists
  • Loading branch information
jaskaransarkaria committed Oct 1, 2024
1 parent 006732f commit e8a218f
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions pkg/environment/createPR.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ func createPR(description, namespace, ghToken, repo string) func(github.GithubIf
useGhTokenCmd.Start() //nolint:errcheck
useGhTokenCmd.Wait() //nolint:errcheck

pulls, err := gh.ListOpenPRs(namespace)
if err != nil {
fmt.Printf("warning: Error listing open prs: %v\n", err)
}

if len(pulls) > 0 {
return "", errors.New("a pr is already open for this namespace, skipping opening another")
}

checkCmd := exec.Command("/bin/sh", "-c", "git checkout -b "+branchName)
checkCmd.Start() //nolint:errcheck
checkCmd.Wait() //nolint:errcheck
Expand All @@ -48,15 +57,6 @@ func createPR(description, namespace, ghToken, repo string) func(github.GithubIf
pushCmd.Start() //nolint:errcheck
pushCmd.Wait() //nolint:errcheck

pulls, err := gh.ListOpenPRs(namespace)
if err != nil {
fmt.Printf("warning: Error listing open prs: %v\n", err)
}

if len(pulls) > 0 {
return "", errors.New("a pr is already open for this namespace, skipping opening another")
}

return gh.CreatePR(branchName, namespace, description)
}
}
Expand Down

0 comments on commit e8a218f

Please sign in to comment.