Revert breaking change

This commit is contained in:
Azeem Sajid 2025-02-05 11:22:54 +05:00
parent 7cca07b699
commit b95e6b2ae4

View file

@ -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}