Prefer GH actions data when constructing upstream URL.

This commit is contained in:
Alexander Artemenko 2021-02-07 02:32:16 +03:00
parent 18f481aa61
commit 6fb3662ee6

View file

@ -92,12 +92,7 @@ behaviour could be overriden by keyword argument ``:raise t``."
(defun get-origin-to-push () (defun get-origin-to-push ()
(let ((upstream (get-git-upstream)))
(cond (cond
(upstream
;; If there is already some remote upstream, then use it
(run (concatenate 'string "git remote get-url " upstream)))
;; If we are running inside github actions ;; If we are running inside github actions
((uiop:getenv "GITHUB_ACTIONS") ((uiop:getenv "GITHUB_ACTIONS")
(unless (uiop:getenv "GITHUB_TOKEN") (unless (uiop:getenv "GITHUB_TOKEN")
@ -108,7 +103,7 @@ behaviour could be overriden by keyword argument ``:raise t``."
(uiop:getenv "GITHUB_TOKEN") (uiop:getenv "GITHUB_TOKEN")
(uiop:getenv "GITHUB_REPOSITORY"))) (uiop:getenv "GITHUB_REPOSITORY")))
;; otherwise make it from travis secret token and repo slug ;; otherwise make it from travis secret token and repo slug
(t ((uiop:getenv "TRAVIS_REPO_SLUG")
(let ((repo-slug (uiop:getenv "TRAVIS_REPO_SLUG")) (let ((repo-slug (uiop:getenv "TRAVIS_REPO_SLUG"))
(repo-token (uiop:getenv "GH_REPO_TOKEN"))) (repo-token (uiop:getenv "GH_REPO_TOKEN")))
@ -118,7 +113,16 @@ behaviour could be overriden by keyword argument ``:raise t``."
(format nil "https://~A@github.com/~A" (format nil "https://~A@github.com/~A"
repo-token repo-token
repo-slug)))))) repo-slug)))
;; If there is already some remote upstream, then use it
(t
(let ((upstream (get-git-upstream)))
(cond
(upstream
(run (concatenate 'string "git remote get-url " upstream)))
(t
(log:error "Unable to guess correct upstream URL")
(values nil)))))))
(defun push-gh-pages (docs-dir) (defun push-gh-pages (docs-dir)