Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get the Default Branch #28

Merged
merged 1 commit into from
Jun 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion pkg/action/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,12 +255,19 @@ func (fa *FrizbeeAction) createPR(ctx context.Context) error {
}
// either the PR doesn't exist or was merged and it's time for another one

// Get defaultBranch
repository, _, err := fa.Client.Repositories.Get(ctx, fa.RepoOwner, fa.RepoName)
if err != nil {
log.Fatalf("Error getting repository details: %v", err)
}
defaultBranch := repository.GetDefaultBranch()

// Create a new PR
pr, _, err := fa.Client.PullRequests.Create(ctx, fa.RepoOwner, fa.RepoName, &github.NewPullRequest{
Title: github.String("Frizbee: Pin images and actions to commit hash"),
Body: github.String("The following PR pins images and actions to their commit hash"),
Head: github.String(branchName),
Base: github.String("main"),
Base: github.String(defaultBranch),
MaintainerCanModify: github.Bool(true),
})
if err != nil {
Expand Down