Skip to content

Commit

Permalink
add more logs
Browse files Browse the repository at this point in the history
  • Loading branch information
ayushgaud committed Nov 15, 2023
1 parent e1981b2 commit 0fc4679
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions src/wrike_ist/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -38,27 +38,29 @@
(loop [links (extract-details pr)]
(when-let [{:keys [state] :as details} (first links)]
(let [link-pr-promise (wrike/link-pr details)]
(-> (case state
:draft
link-pr-promise
(.then link-pr-promise
(fn [link-pr-result]
(.log js/console (str "Result of link-pr: " link-pr-result))
(condp = state
:draft link-pr-result
:open (-> (wrike/progress-task details (core/getInput "opened"))
(.then
(fn [progress-result]
(.log js/console (str "Result of progress-task: " progress-result))
(js/Promise.resolve progress-result))))
:merged (-> (wrike/complete-task details (core/getInput "merged"))
(.then
(fn [complete-result]
(.log js/console (str "Result of complete-task: " complete-result))
(js/Promise.resolve complete-result))))
:closed (-> (wrike/cancel-task details (core/getInput "closed"))
(.then
(fn [cancel-result]
(.log js/console (str "Result of cancel-task: " cancel-result))
(js/Promise.resolve cancel-result))))
:else (js/Promise.resolve)))))

:open
(js/Promise.all
[link-pr-promise
(wrike/progress-task details (core/getInput "opened"))])

:merged
(wrike/complete-task details (core/getInput "merged"))

:closed
(wrike/cancel-task details (core/getInput "closed"))

;; else ignore
(js/Promise.resolve))
(.then
(fn [result]
(.log js/console (str "Result of link-pr: " result)))
(.catch #(core/setFailed (.-message %))))))
(.catch #(core/setFailed (.-message %)))
(recur (rest links))))
(js/console.log "No pull_request in payload"))))

0 comments on commit 0fc4679

Please sign in to comment.