Commit after checkout.

This commit is contained in:
Alexander Artemenko 2021-02-07 03:06:14 +03:00
parent 4a1261cd8a
commit 3ebc39835f

View file

@ -159,36 +159,38 @@ behaviour could be overriden by keyword argument ``:raise t``."
((git-repository-was-changed-p) ((git-repository-was-changed-p)
(log:info "Pushing local changes to the repository") (log:info "Pushing local changes to the repository")
(git "add -u") (flet ((make-commit ()
(git "add -u")
;; We don't want to commit changes to qlfile, ;; We don't want to commit changes to qlfile,
;; because documentation builders might change them: ;; because documentation builders might change them:
(git "reset qlfile*") (git "reset qlfile*")
(when (uiop:getenv "GITHUB_ACTIONS") (when (uiop:getenv "GITHUB_ACTIONS")
(git "config --global user.name \"github-actions[bot]\"") (git "config --global user.name \"github-actions[bot]\"")
(git "config --global user.email \"actions@github.com\"")) (git "config --global user.email \"actions@github.com\""))
(git "commit -m 'Update docs'") (git "commit -m 'Update docs'")))
(cond
((uiop:getenv "GITHUB_HEAD_REF")
(let ((ref (uiop:getenv "GITHUB_HEAD_REF")))
(cond ;; Inside github action we are running on
((uiop:getenv "GITHUB_HEAD_REF") ;; detached commit. Github takes last commit
(let ((ref (uiop:getenv "GITHUB_HEAD_REF"))) ;; from the "master" branch and merges
;; a branch from pull-request settings.
;; Inside github action we are running on ;;
;; detached commit. Github takes last commit ;; To push changes back, we need to change
;; from the "master" branch and merges ;; our HEAD back to the pull-request's reference:
;; a branch from pull-request settings. (git "checkout " ref)
;; (make-commit)
;; To push changes back, we need to change (git "remote add upstream "
;; our HEAD back to the pull-request's reference: (get-origin-to-push))
(git "checkout " ref) (git "push upstream HEAD:" ref)))
(git "remote add upstream " (t
(get-origin-to-push)) (make-commit)
(git "push upstream HEAD:" ref))) (git "push")))))
(t
(git "push"))))
;; or ;; or
(t (log:info "There is no local changes."))))) (t (log:info "There is no local changes.")))))