@@ -105,12 +105,29 @@ func (impl *defaultToolImplementation) CreatePolicyPR(a *auth.Authenticator, opt
105105
106106 // Create a pull request manager
107107 prManager := repo .NewPullRequestManager (repo .WithAuthenticator (a ))
108+ prManager .Options .UseFork = true
108109
109- // TODO(puerco): Honor forks settings, etc
110+ // Define the policy repo...
111+ policyRepoOwner := policy .SourcePolicyRepoOwner
112+ policyRepoName := policy .SourcePolicyRepo
113+ // ... but honor if there is one in the options
114+ if opts .PolicyRepo != "" {
115+ var ok bool
116+ policyRepoOwner , policyRepoName , ok = strings .Cut (opts .PolicyRepo , "/" )
117+ if ! ok {
118+ return nil , fmt .Errorf ("invalid policy repository" )
119+ }
120+ }
121+
122+ policyRepo := & models.Repository {
123+ Hostname : "github.com" ,
124+ Path : fmt .Sprintf ("%s/%s" , policyRepoOwner , policyRepoName ),
125+ DefaultBranch : "main" ,
126+ }
110127
111128 // Open the pull request
112129 pr , err := prManager .PullRequestFileList (
113- r ,
130+ policyRepo ,
114131 & roptions.PullRequestFileListOptions {
115132 Title : fmt .Sprintf ("Add %s/%s SLSA Source policy file" , repoOwner , repoName ),
116133 Body : fmt .Sprintf (`This pull request adds the SLSA source policy for github.com/%s/%s` , repoOwner , repoName ),
0 commit comments