diff --git a/db/Task.go b/db/Task.go index 9a578dbb..0bdb1ef3 100644 --- a/db/Task.go +++ b/db/Task.go @@ -27,7 +27,7 @@ type Task struct { Limit string `db:"hosts_limit" json:"limit"` Secret string `db:"-" json:"secret"` Arguments *string `db:"arguments" json:"arguments"` - GitBranch string `db:"git_branch" json:"git_branch"` + GitBranch *string `db:"git_branch" json:"git_branch"` UserID *int `db:"user_id" json:"user_id"` IntegrationID *int `db:"integration_id" json:"integration_id"` diff --git a/services/tasks/LocalJob.go b/services/tasks/LocalJob.go index 2744f907..0d0192d2 100644 --- a/services/tasks/LocalJob.go +++ b/services/tasks/LocalJob.go @@ -471,8 +471,8 @@ func (t *LocalJob) prepareRun() error { } // Override git branch from task if set - if t.Task.GitBranch != "" { - t.Repository.GitBranch = t.Task.GitBranch + if t.Task.GitBranch != nil && *t.Task.GitBranch != "" { + t.Repository.GitBranch = *t.Task.GitBranch } if t.Repository.GetType() == db.RepositoryLocal {