Skip to content

Commit 4bdc731

Browse files
authored
fix: don't unlock project if apply has failed (#132)
1 parent 71d82fb commit 4bdc731

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pkg/digger/digger.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,12 @@ func (d DiggerExecutor) Apply(prNumber int) {
261261
applyOutput := cleanupTerraformApply(true, err, stdout, stderr)
262262
comment := "Apply for **" + d.LockId() + "**\n" + applyOutput
263263
d.prManager.PublishComment(prNumber, comment)
264-
d.lock.Unlock(d.LockId(), prNumber)
264+
if err == nil {
265+
_, err := d.lock.Unlock(d.LockId(), prNumber)
266+
fmt.Errorf("error unlocking project: %v", err)
267+
} else {
268+
d.prManager.PublishComment(prNumber, "Error during applying. Project lock will persist")
269+
}
265270
}
266271

267272
}

0 commit comments

Comments
 (0)