Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ All notable changes to `src-cli` are documented in this file.

### Fixed

- `src campaign [apply|preview]` now caches the result of running steps in a repository even if they didn't produce changes.

## 3.21.8

### Fixed
Expand Down
18 changes: 9 additions & 9 deletions internal/campaigns/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,25 +261,25 @@ func (x *executor) do(ctx context.Context, task *Task) (err error) {
return
}

// Build the changeset spec.
spec := createChangesetSpec(task, string(diff), x.features)

// Add to the cache. We don't use runCtx here because we want to write to
// the cache even if we've now reached the timeout.
if err = x.cache.Set(ctx, cacheKey, spec); err != nil {
err = errors.Wrapf(err, "caching result for %q", task.Repository.Name)
}

// If the steps didn't result in any diff, we don't need to add it to the
// list of specs that are displayed to the user and send to the server.
if len(diff) == 0 {
x.updateTaskStatus(task, status)
return
}

// Build the changeset spec.
spec := createChangesetSpec(task, string(diff), x.features)

status.ChangesetSpec = spec
x.updateTaskStatus(task, status)

// Add to the cache. We don't use runCtx here because we want to write to
// the cache even if we've now reached the timeout.
if err = x.cache.Set(ctx, cacheKey, spec); err != nil {
err = errors.Wrapf(err, "caching result for %q", task.Repository.Name)
}

// Add the spec to the executor's list of completed specs.
x.specsMu.Lock()
x.specs = append(x.specs, spec)
Expand Down