Skip to content

Commit

Permalink
Create fork for autobumper when it does not exists
Browse files Browse the repository at this point in the history
  • Loading branch information
kyma-bot committed Oct 11, 2024
1 parent a106d7a commit a8f7bb7
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkg/github/bumper/bumper.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ type Options struct {
HeadBranchName string `json:"headBranchName" yaml:"headBranchName"`
// Optional list of labels to add to the bump PR
Labels []string `json:"labels" yaml:"labels"`
// Ensure fork exists and create it if doesn't exists
EnsureFork bool `json:"ensureFork" yaml:"ensureFork"`
}

const (
Expand Down Expand Up @@ -280,6 +282,17 @@ func processGitHub(o *Options, prh PRHandler) error {
}
}

if o.EnsureFork {
// Ensure the forked repository exists
repo, err := gc.EnsureFork(o.GitHubLogin, o.GitHubOrg, o.GitHubRepo)
if err != nil {
return fmt.Errorf("ensure fork: %w", err)
}

// Set the remote name to the forked repository
o.RemoteName = repo
}

for i, changeFunc := range prh.Changes() {
commitMsg, filesToBeAdded, err := changeFunc(context.Background())
if err != nil {
Expand Down

0 comments on commit a8f7bb7

Please sign in to comment.