From 182adbde03cf78d5a21b696ed2023a2c3d7197c7 Mon Sep 17 00:00:00 2001 From: dessant Date: Sun, 4 Jul 2021 13:49:23 +0300 Subject: [PATCH] fix: lock temporarily unlocked issues even after an error --- src/index.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 3cd0972..faf2a49 100644 --- a/src/index.js +++ b/src/index.js @@ -126,7 +126,14 @@ class App { lock.reason = issueData.active_lock_reason; } await this.client.issues.unlock(issue); - await action(); + + let actionError; + try { + await action(); + } catch (err) { + actionError = err; + } + if (lock.reason) { issue = { ...issue, @@ -137,6 +144,10 @@ class App { }; } await this.client.issues.lock(issue); + + if (actionError) { + throw actionError; + } } else { await action(); }