@@ -11,7 +11,7 @@ import (
1111 "slices"
1212 "time"
1313
14- "github.com/google/go-github/v69 /github"
14+ "github.com/google/go-github/v88 /github"
1515
1616 "github.com/slsa-framework/source-tool/pkg/slsa"
1717 "github.com/slsa-framework/source-tool/pkg/sourcetool/models"
@@ -38,13 +38,13 @@ type activity struct {
3838func (ghc * GitHubConnection ) commitActivity (ctx context.Context , commit , targetRef string ) (* activity , error ) {
3939 // Unfortunately the gh_client doesn't have native support for this...'
4040 reqUrl := fmt .Sprintf ("repos/%s/%s/activity" , ghc .Owner (), ghc .Repo ())
41- req , err := ghc .Client ().NewRequest ("GET" , reqUrl , nil )
41+ req , err := ghc .Client ().NewRequest (ctx , "GET" , reqUrl , nil )
4242 if err != nil {
4343 return nil , err
4444 }
4545
4646 var result []* activity
47- _ , err = ghc .Client ().Do (ctx , req , & result )
47+ _ , err = ghc .Client ().Do (req , & result )
4848 if err != nil {
4949 return nil , err
5050 }
@@ -234,8 +234,8 @@ func (ghc *GitHubConnection) computeRequiredChecks(ctx context.Context, ghCheckR
234234// protection if one of them is missing. We check first so if other rules
235235// already protect the branch, this function noops.
236236func (ghc * GitHubConnection ) EnableBranchRules (ctx context.Context ) error {
237- branchRules , _ , err := ghc .Client ().Repositories .GetRulesForBranch (
238- ctx , ghc .Owner (), ghc .Repo (), GetBranchFromRef (ghc .ref ),
237+ branchRules , _ , err := ghc .Client ().Repositories .ListRulesForBranch (
238+ ctx , ghc .Owner (), ghc .Repo (), GetBranchFromRef (ghc .ref ), nil ,
239239 )
240240 if err != nil {
241241 return fmt .Errorf ("fetching branch rules: %w" , err )
@@ -286,7 +286,7 @@ func (ghc *GitHubConnection) EnableBranchRules(ctx context.Context) error {
286286// protection on all branches.
287287func (ghc * GitHubConnection ) EnableTagRules (ctx context.Context ) error {
288288 allRules , _ , err := ghc .Client ().Repositories .GetAllRulesets (
289- ctx , ghc .Owner (), ghc .Repo (), true ,
289+ ctx , ghc .Owner (), ghc .Repo (), & github. RepositoryListRulesetsOptions { IncludesParents : github . Ptr ( true )} ,
290290 )
291291 if err != nil {
292292 return fmt .Errorf ("fetching tag rules: %w" , err )
@@ -357,7 +357,7 @@ func (ghc *GitHubConnection) GetBranchControls(ctx context.Context, ref string)
357357 controls := & slsa.ControlSet {}
358358
359359 // Do the branch specific stuff.
360- branchRules , _ , err := ghc .Client ().Repositories .GetRulesForBranch (ctx , ghc .Owner (), ghc .Repo (), branch )
360+ branchRules , _ , err := ghc .Client ().Repositories .ListRulesForBranch (ctx , ghc .Owner (), ghc .Repo (), branch , nil )
361361 if err != nil {
362362 return nil , err
363363 }
@@ -382,7 +382,7 @@ func (ghc *GitHubConnection) GetBranchControls(ctx context.Context, ref string)
382382 controls .AddControl (requiredCheckControls ... )
383383
384384 // Check the tag rules.
385- allRulesets , _ , err := ghc .Client ().Repositories .GetAllRulesets (ctx , ghc .Owner (), ghc .Repo (), true )
385+ allRulesets , _ , err := ghc .Client ().Repositories .GetAllRulesets (ctx , ghc .Owner (), ghc .Repo (), & github. RepositoryListRulesetsOptions { IncludesParents : github . Ptr ( true )} )
386386 if err != nil {
387387 return nil , err
388388 }
@@ -432,7 +432,7 @@ func (ghc *GitHubConnection) GetTagControls(ctx context.Context, commit, ref str
432432 Controls : & slsa.ControlSet {},
433433 }
434434
435- allRulesets , _ , err := ghc .Client ().Repositories .GetAllRulesets (ctx , ghc .Owner (), ghc .Repo (), true )
435+ allRulesets , _ , err := ghc .Client ().Repositories .GetAllRulesets (ctx , ghc .Owner (), ghc .Repo (), & github. RepositoryListRulesetsOptions { IncludesParents : github . Ptr ( true )} )
436436 if err != nil {
437437 return nil , fmt .Errorf ("getting repository rules from API: %w" , err )
438438 }
0 commit comments