Skip to content

Commit fab1826

Browse files
committed
allow short branch name
1 parent b6f7ce6 commit fab1826

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

services/actions/workflow.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ func DispatchActionWorkflow(ctx *context.APIContext, workflowID string, opt *api
164164
case refName.IsBranch():
165165
runTargetCommit, err = ctx.Repo.GitRepo.GetBranchCommit(refName.BranchName())
166166
default:
167-
ctx.Error(http.StatusInternalServerError, "WorkflowRefNameError", fmt.Sprintf("%s must be a well-formed Git reference name.", opt.Ref))
168-
return
167+
refName = git.RefNameFromBranch(opt.Ref)
168+
runTargetCommit, err = ctx.Repo.GitRepo.GetBranchCommit(opt.Ref)
169169
}
170170

171171
if err != nil {
@@ -234,7 +234,7 @@ func DispatchActionWorkflow(ctx *context.APIContext, workflowID string, opt *api
234234
OwnerID: ctx.Repo.Repository.Owner.ID,
235235
WorkflowID: workflowID,
236236
TriggerUserID: ctx.Doer.ID,
237-
Ref: opt.Ref,
237+
Ref: string(refName),
238238
CommitSHA: runTargetCommit.ID.String(),
239239
IsForkPullRequest: false,
240240
Event: "workflow_dispatch",

0 commit comments

Comments
 (0)