diff --git a/internal/batches/executor/run_steps.go b/internal/batches/executor/run_steps.go index 848362a3b3..3d3bbd9d60 100644 --- a/internal/batches/executor/run_steps.go +++ b/internal/batches/executor/run_steps.go @@ -141,8 +141,12 @@ func RunSteps(ctx context.Context, opts *RunStepsOpts) (stepResults []execution. stepContext := template.StepContext{ BatchChange: *opts.Task.BatchChangeAttributes, - Repository: util.NewTemplatingRepo(opts.Task.Repository.Name, opts.Task.Repository.FileMatches), - Outputs: lastOutputs, + Repository: util.NewTemplatingRepo( + opts.Task.Repository.Name, + opts.Task.Repository.Branch.Name, + opts.Task.Repository.FileMatches, + ), + Outputs: lastOutputs, Steps: template.StepsContext{ Path: opts.Task.Path, Changes: previousStepResult.ChangedFiles, diff --git a/internal/batches/util/repo.go b/internal/batches/util/repo.go index 705784a972..cdd6cc7271 100644 --- a/internal/batches/util/repo.go +++ b/internal/batches/util/repo.go @@ -10,13 +10,14 @@ import ( // NewTemplatingRepo transforms a given *graphql.Repository into a // template.Repository. -func NewTemplatingRepo(repoName string, fileMatches map[string]bool) template.Repository { +func NewTemplatingRepo(repoName string, branch string, fileMatches map[string]bool) template.Repository { matches := make([]string, 0, len(fileMatches)) for path := range fileMatches { matches = append(matches, path) } return template.Repository{ Name: repoName, + Branch: branch, FileMatches: matches, } }