From b95e6b2ae4a4bedcd10c4aa380bb7e4ccc5df248 Mon Sep 17 00:00:00 2001 From: Azeem Sajid Date: Wed, 5 Feb 2025 11:22:54 +0500 Subject: [PATCH] Revert breaking change --- pkg/cmd/workflow/run/run.go | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/pkg/cmd/workflow/run/run.go b/pkg/cmd/workflow/run/run.go index 3ba64ad4a..b7ab53098 100644 --- a/pkg/cmd/workflow/run/run.go +++ b/pkg/cmd/workflow/run/run.go @@ -262,15 +262,11 @@ func runRun(opts *RunOptions) error { ref := opts.Ref - defaultBranch, err := api.RepoDefaultBranch(client, repo) - if err != nil { - return fmt.Errorf("unable to determine default branch for %s: %w", ghrepo.FullName(repo), err) - } - - if ref != "" && ref != defaultBranch { - return fmt.Errorf("ref %s is not the default branch, and workflows must be on the default branch to be triggered by workflow_dispatch", ref) - } else { - ref = defaultBranch + if ref == "" { + ref, err = api.RepoDefaultBranch(client, repo) + if err != nil { + return fmt.Errorf("unable to determine default branch for %s: %w", ghrepo.FullName(repo), err) + } } states := []shared.WorkflowState{shared.Active}