 (def ^:private organisation
   (env :github-organisation))
 
+(def ^:private github-options
+  {:oauth-token (env :github-auth-token)})
+
+(defn merge-options
+  [options]
+  (merge github-options
+         options))
+
 (defn- busted?
   [response]
   (if-let [status (:status response)]

(defn all-repositories
  "Gets all repositories in the organisation in Github."
  []
  (let [response (repos/org-repos organisation {:all_pages true})]
    (when-not (busted? response)
      (doall (map extract-repo-info (remove empty? response))))))


  [environment application]
  (try
    (let [repo-name (repo-name application environment)
          commits (repos/commits organisation repo-name github-options)]
      (map extract-commit-info (remove empty? commits)))
    (catch Exception e
      (with-logging-context {:application application
