Fixed uploader to not commit if there are no changes.
This commit is contained in:
parent
c21a04f575
commit
3501680189
1 changed files with 35 additions and 31 deletions
66
.github/actions/build-docs/upload.ros
vendored
66
.github/actions/build-docs/upload.ros
vendored
|
@ -155,44 +155,48 @@ behaviour could be overriden by keyword argument ``:raise t``."
|
||||||
can update README file as well. In this case, we need
|
can update README file as well. In this case, we need
|
||||||
to push the file into the current branch of the repository."
|
to push the file into the current branch of the repository."
|
||||||
(let ((*current-dir* (probe-file #P"")))
|
(let ((*current-dir* (probe-file #P"")))
|
||||||
(cond
|
(macrolet ((if-there-are-changes (&body body)
|
||||||
((git-repository-was-changed-p)
|
`(cond
|
||||||
(log:info "Pushing local changes to the repository")
|
((git-repository-was-changed-p)
|
||||||
|
(log:info "Pushing local changes to the repository")
|
||||||
(flet ((make-commit ()
|
,@body)
|
||||||
(git "add -u")
|
(t
|
||||||
|
(log:info "There is no local changes.")))))
|
||||||
|
(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
|
(cond
|
||||||
((uiop:getenv "GITHUB_HEAD_REF")
|
((uiop:getenv "GITHUB_HEAD_REF")
|
||||||
(let ((ref (uiop:getenv "GITHUB_HEAD_REF")))
|
(let ((ref (uiop:getenv "GITHUB_HEAD_REF")))
|
||||||
|
|
||||||
;; Inside github action we are running on
|
;; Inside github action we are running on
|
||||||
;; detached commit. Github takes last commit
|
;; detached commit. Github takes last commit
|
||||||
;; from the "master" branch and merges
|
;; from the "master" branch and merges
|
||||||
;; a branch from pull-request settings.
|
;; a branch from pull-request settings.
|
||||||
;;
|
;;
|
||||||
;; To push changes back, we need to change
|
;; To push changes back, we need to change
|
||||||
;; our HEAD back to the pull-request's reference:
|
;; our HEAD back to the pull-request's reference:
|
||||||
(git "checkout " ref)
|
(git "checkout " ref)
|
||||||
|
;; Here we need to check again if
|
||||||
|
(if-there-are-changes
|
||||||
(make-commit)
|
(make-commit)
|
||||||
(git "remote add upstream "
|
(git "remote add upstream "
|
||||||
(get-origin-to-push))
|
(get-origin-to-push))
|
||||||
(git "push upstream HEAD:" ref)))
|
(git "push upstream HEAD:" ref))))
|
||||||
(t
|
(t
|
||||||
|
(if-there-are-changes
|
||||||
(make-commit)
|
(make-commit)
|
||||||
(git "push")))))
|
(git "push"))))))))
|
||||||
;; or
|
|
||||||
(t (log:info "There is no local changes.")))))
|
|
||||||
|
|
||||||
|
|
||||||
(defun main (&rest argv)
|
(defun main (&rest argv)
|
||||||
|
|
Loading…
Reference in a new issue