@@ -447,7 +447,39 @@ func createDraftPR(tag string, result *releaseNotesResult) (err error) {
447
447
return errors .Wrapf (err , "pushing %v to remote" , userForkName )
448
448
}
449
449
450
- // TODO: Call github API and create PR against k/sig-release
450
+ // Create a PR against k/sig-release using the github API
451
+ gh := github .New ()
452
+
453
+ // TODO: Maybe read and parse the PR template from sig-release?
454
+ prBody := fmt .Sprintln (
455
+ "**What type of PR is this?**" ,
456
+ "/kind documentation" ,
457
+ "**What this PR does / why we need it**:" ,
458
+ fmt .Sprintf ("This PR updates the release notes draft to k/k %s" , tag ),
459
+ "**Which issue(s) this PR fixes**:" ,
460
+ "**Special notes for your reviewer**:" ,
461
+ "This is an automated PR generated from `krel The Kubernetes Release Toolbox`" ,
462
+ )
463
+
464
+ // Create the pull request
465
+ logrus .Debugf (
466
+ "PR params: org: %s, repo: %s, headBranch: %s baseBranch: %s" ,
467
+ defaultKubernetesSigReleaseOrg , defaultKubernetesSigReleaseRepo , "master" ,
468
+ fmt .Sprintf ("%s:%s" , releaseNotesOpts .draftOrg , branchname ),
469
+ )
470
+ pr , err := gh .CreatePullRequest (
471
+ defaultKubernetesSigReleaseOrg , defaultKubernetesSigReleaseRepo , "master" ,
472
+ fmt .Sprintf ("%s:%s" , releaseNotesOpts .draftOrg , branchname ),
473
+ fmt .Sprintf ("Update release notes draft to version %s" , tag ), prBody ,
474
+ )
475
+
476
+ if err != nil {
477
+ logrus .Warnf ("An error has occurred while creating the pull request for %s" , tag )
478
+ logrus .Warn ("While the PR failed, the release notes draft was generated and submitted to your fork" )
479
+ return errors .Wrap (err , "creating the pull request" )
480
+ }
481
+
482
+ logrus .Infof ("Successfully created PR #%d" , pr .GetNumber ())
451
483
return nil
452
484
}
453
485
@@ -629,7 +661,7 @@ func createWebsitePR(tag, jsonStr string) (err error) {
629
661
)
630
662
631
663
if err != nil {
632
- logrus .Warnf ("An error ocurred while creating the pull request for %s" , tag )
664
+ logrus .Warnf ("An error has occurred while creating the pull request for %s" , tag )
633
665
logrus .Warn ("While the PR failed, the release notes where generated and submitted to your fork" )
634
666
return errors .Wrap (err , "creating the pull request" )
635
667
}
0 commit comments