From 7ffc9741de82b086c93fe721c36910756ff61461 Mon Sep 17 00:00:00 2001 From: kagel Date: Thu, 15 Sep 2016 17:39:50 +0300 Subject: [PATCH] Bugfix in handle-issue-closed --- .gitignore | 2 +- src/clj/commiteth/routes/webhooks.clj | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 60c4042..4ec2ff4 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,7 @@ pom.xml *.jar *.class -/.lein-* +/*.lein-* profiles.clj /.env .nrepl-port diff --git a/src/clj/commiteth/routes/webhooks.clj b/src/clj/commiteth/routes/webhooks.clj index a25e080..4f20bdf 100644 --- a/src/clj/commiteth/routes/webhooks.clj +++ b/src/clj/commiteth/routes/webhooks.clj @@ -20,11 +20,12 @@ events))) (defn find-commit-id - [user repo issue-number event-type] - (-> - (github/get-issue-events user repo issue-number) - (find-issue-event event-type user) - (:commit_id))) + [user repo issue-number event-types] + (some identity (map #(-> + (github/get-issue-events user repo issue-number) + (find-issue-event % user) + :commit_id) + event-types))) (defn handle-issue-labeled [issue] @@ -43,7 +44,7 @@ [{{{user :login} :owner repo :name} :repository {issue-id :id issue-number :number} :issue}] (future - (when-let [commit-id (find-commit-id user repo issue-number "referenced")] + (when-let [commit-id (find-commit-id user repo issue-number ["referenced" "closed"])] (log/debug (format "Issue %s/%s/%s closed with commit %s" user repo issue-number commit-id)) (issues/close commit-id issue-id))))