Automatically add the "bounty" label to a repository

fixes #2
This commit is contained in:
kagel 2016-09-14 02:29:39 +03:00
parent 7fb0f9ddae
commit 51b8fa87ff
3 changed files with 8 additions and 4 deletions

View File

@ -255,7 +255,7 @@ SELECT balance
FROM issues FROM issues
WHERE contract_address = :contract_address; WHERE contract_address = :contract_address;
-- :name update-banlance :! :n -- :name update-balance :! :n
-- :doc updates balance of a wallet attached to a given issue -- :doc updates balance of a wallet attached to a given issue
UPDATE issues UPDATE issues
SET balance = :balance SET balance = :balance

View File

@ -24,7 +24,7 @@
(defn authorize-url [] (defn authorize-url []
(let [params (codec/form-encode {:client_id (client-id) (let [params (codec/form-encode {:client_id (client-id)
:redirect_uri (redirect-uri) :redirect_uri (redirect-uri)
:scope "admin:repo_hook" :scope "admin:repo_hook repo"
:allow_signup allow-signup :allow_signup allow-signup
:state (str (UUID/randomUUID))})] :state (str (UUID/randomUUID))})]
(str "https://github.com/login/oauth/authorize" "?" params))) (str "https://github.com/login/oauth/authorize" "?" params)))
@ -139,3 +139,7 @@
(defn get-issue-events (defn get-issue-events
[user repo issue-id] [user repo issue-id]
(issues/issue-events user repo issue-id (self-auth-params))) (issues/issue-events user repo issue-id (self-auth-params)))
(defn create-label
[user repo token]
(issues/create-label user repo "bounty" "00ff00" (auth-params token)))

View File

@ -71,12 +71,12 @@
user-id :id} user user-id :id} user
result (or result (or
(repositories/create (merge params {:user_id user-id})) (repositories/create (merge params {:user_id user-id}))
(repositories/toggle repo-id)) (repositories/toggle repo-id))]
]
(if (:enabled result) (if (:enabled result)
;; @todo: do we really want to make this call at this moment? ;; @todo: do we really want to make this call at this moment?
(let [created-hook (github/add-webhook token login repo)] (let [created-hook (github/add-webhook token login repo)]
(println created-hook) (println created-hook)
(github/create-label login repo token)
(repositories/update-hook-id repo-id (:id created-hook))) (repositories/update-hook-id repo-id (:id created-hook)))
(github/remove-webhook token login repo (:hook_id result))) (github/remove-webhook token login repo (:hook_id result)))
result))))) result)))))