Skip to content

Commit 3727b00

Browse files
authored
Fix empty changesets being uploaded (#313)
1 parent 7f6cbd1 commit 3727b00

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

internal/campaigns/executor.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -203,27 +203,25 @@ func (x *executor) do(ctx context.Context, task *Task) (err error) {
203203
return
204204
}
205205

206+
// If the steps didn't result in any diff, we don't need to add it to the
207+
// list of specs that are displayed to the user and send to the server.
208+
if len(diff) == 0 {
209+
x.updateTaskStatus(task, status)
210+
return
211+
}
212+
206213
// Build the changeset spec.
207214
spec := createChangesetSpec(task, string(diff))
208215

209216
status.ChangesetSpec = spec
210217
x.updateTaskStatus(task, status)
211218

212-
// Add it to the status
213-
status.ChangesetSpec = spec
214-
215219
// Add to the cache. We don't use runCtx here because we want to write to
216220
// the cache even if we've now reached the timeout.
217221
if err = x.cache.Set(ctx, cacheKey, spec); err != nil {
218222
err = errors.Wrapf(err, "caching result for %q", task.Repository.Name)
219223
}
220224

221-
// If the steps didn't result in any diff, we don't need to add it to the
222-
// list of specs that are displayed to the user and send to the server.
223-
if len(diff) == 0 {
224-
return
225-
}
226-
227225
// Add the spec to the executor's list of completed specs.
228226
x.specsMu.Lock()
229227
x.specs = append(x.specs, spec)

0 commit comments

Comments
 (0)