Skip to content

Commit 7b155e6

Browse files
committed
refactor: use noChange variable
Signed-off-by: t-kikuc <[email protected]>
1 parent 723393b commit 7b155e6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pkg/app/piped/eventwatcher/eventwatcher.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,8 @@ func (w *watcher) execute(ctx context.Context, repo git.Repo, repoID string, eve
391391
switch handler.Type {
392392
case config.EventWatcherHandlerTypeGitUpdate:
393393
branchName, err := w.commitFiles(ctx, latestEvent, matcher.Name, handler.Config.CommitMessage, e.GitPath, handler.Config.Replacements, tmpRepo, handler.Config.MakePullRequest)
394-
if err != nil && !errors.Is(err, errNoChanges) {
394+
noChange := errors.Is(err, errNoChanges)
395+
if err != nil && !noChange {
395396
w.logger.Error("failed to commit outdated files", zap.Error(err))
396397
handledEvent := &pipedservice.ReportEventStatusesRequest_Event{
397398
Id: latestEvent.Id,
@@ -406,7 +407,7 @@ func (w *watcher) execute(ctx context.Context, repo git.Repo, repoID string, eve
406407
Id: latestEvent.Id,
407408
Status: model.EventStatus_EVENT_SUCCESS,
408409
}
409-
if errors.Is(err, errNoChanges) {
410+
if noChange {
410411
handledEvent.StatusDescription = "Nothing to commit"
411412
gitNoChangeEvents = append(gitNoChangeEvents, handledEvent)
412413
} else {

0 commit comments

Comments
 (0)