diff --git a/src/wrike_ist/core.cljs b/src/wrike_ist/core.cljs index f07720d..db29a68 100644 --- a/src/wrike_ist/core.cljs +++ b/src/wrike_ist/core.cljs @@ -38,30 +38,31 @@ (if-let [pr (.-pull_request payload)] (loop [links (extract-details pr)] (when-let [{:keys [state] :as details} (first links)] - (-> (case state - :draft - (js/Promise.all - [(wrike/check-valid-task details) - (wrike/link-pr details)]) + (let [check-valid-task-promise (wrike/check-valid-task details)] + (-> (case state + :draft + (js/Promise.all + [(wrike/link-pr details) + check-valid-task-promise]) - :open - (js/Promise.all - [(wrike/check-valid-task details) - (wrike/link-pr details) - (wrike/progress-task details (core/getInput "opened"))]) + :open + (js/Promise.all + [(wrike/link-pr details) + (wrike/progress-task details (core/getInput "opened")) + check-valid-task-promise]) - :merged - (js/Promise.all - [(wrike/check-valid-task details) - (wrike/complete-task details (core/getInput "merged"))]) + :merged + (js/Promise.all + [(wrike/complete-task details (core/getInput "merged")) + check-valid-task-promise]) - :closed - (js/Promise.all - [(wrike/check-valid-task details) - (wrike/cancel-task details (core/getInput "closed"))]) + :closed + (js/Promise.all + [(wrike/cancel-task details (core/getInput "closed")) + check-valid-task-promise]) - ;; else ignore - (js/Promise.resolve)) - (.catch #(core/setFailed (.-message %)))) + ;; else ignore + check-valid-task-promise) + (.catch #(core/setFailed (.-message %))))) (recur (rest links)))) (js/console.log "No pull_request in payload")))) diff --git a/src/wrike_ist/wrike.cljs b/src/wrike_ist/wrike.cljs index 2370565..e8927a7 100644 --- a/src/wrike_ist/wrike.cljs +++ b/src/wrike_ist/wrike.cljs @@ -52,8 +52,7 @@ (.then (fn [response] (let [title (-> response (get-in ["data" 0 "title"]))] - (.info js/console (str "Folder ID: " folder-id)) - (.info js/console (str "Folder Title: " title)) + (.info js/console (str "Folder ID: " folder-id " Title: " title)) (let [lowercase-folder-names (map clojure.string/lower-case folder-names) parent-ids (-> response (get-in ["data" 0 "parentIds"]) @@ -73,10 +72,7 @@ (.then (find-task permalink) (fn [{:strs [id parentIds superParentIds title]}] - (.info js/console (str "is-wrike-task-in-folder?: Task Name: " title)) - (.info js/console (str "is-wrike-task-in-folder?: Task ID: " id)) - (.info js/console (str "is-wrike-task-in-folder?: Parent IDs: " parentIds)) - (.info js/console (str "is-wrike-task-in-folder?: Super Parent IDs: " superParentIds)) + (.info js/console (str "is-wrike-task-in-folder?: Task Name: " title " id: " id " parentIds: " parentIds " superParentIds: " superParentIds)) (.info js/console (str "is-wrike-task-in-folder?: Folder names to match: " folder-names)) (let [all-parent-ids (concat parentIds superParentIds) matching-folders-promises (for [parent-id all-parent-ids