Skip to content

Commit

Permalink
Fix pre workflow hook
Browse files Browse the repository at this point in the history
  • Loading branch information
ddumitrache committed Sep 27, 2022
1 parent 15cf038 commit 267277b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion server/events/pre_workflow_hooks_command_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,15 @@ func (w *DefaultPreWorkflowHooksCommandRunner) RunPreHooks(
log.Debug("got workspace lock")
defer unlockFn()

repoDir, _, err := w.WorkingDir.Clone(log, headRepo, pull, DefaultWorkspace)
_, _, _, _, _, configSourceBranch := w.GlobalCfg.GetMatchingCfg(ctx.Log, ctx.Pull.BaseRepo.ID())

// If we need to access another branch, ensure we fetch it during our initial clone
additionalBranches := []string{}
if configSourceBranch != nil {
additionalBranches = append(additionalBranches, *configSourceBranch)
}

repoDir, _, err := w.WorkingDir.Clone(log, headRepo, pull, DefaultWorkspace, additionalBranches)
if err != nil {
return err
}
Expand Down

0 comments on commit 267277b

Please sign in to comment.