[ci] Handle the case when everything is up to date

This commit is contained in:
JAremko 2021-07-06 02:45:49 +03:00 committed by Eugene Yaremenko
parent 284f56a397
commit d78d8282f5
6 changed files with 23 additions and 32 deletions

View File

@ -10,10 +10,7 @@
##
## License: GPLv3
if [ ! -f "/tmp/${PUBLISH}.patch" ]; then
echo "No \"/tmp/${PUBLISH}.patch\" file. Aborting."
exit 0
fi
exit_if_no_changes
echo_headline "Cloning target repository"
target_URL="https://github.com/${prj_owner}/${prj_repo}.git"

View File

@ -77,7 +77,7 @@ jobs:
command: .circleci/push
- run:
name: Open PR if built in files must be updated
command: .circleci/built_in/maybe_pr
command: .circleci/maybe_pr
"Update documentation files":
docker:
- image: jare/spacemacs-circleci:latest
@ -111,7 +111,7 @@ jobs:
command: .circleci/push
- run:
name: Open PR if documentation needs fixes
command: .circleci/org/maybe_pr
command: .circleci/maybe_pr
workflows:
version: 2.1
@ -124,7 +124,9 @@ workflows:
- "Validate Documentation"
update-documentation:
when:
equal: [ << pipeline.parameters.is_branch_update >>, "yes"]
and:
- equal: [ << pipeline.parameters.is_branch_update >>, "yes"]
- equal: [ << pipeline.git.branch >>, "develop"]
jobs:
- "Update documentation files"
update-built-in:

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash
## open_pr Opens PR to Spacemacs repository with built-in updates
## open_pr Opens PR to Spacemacs repository with updates (if any)
##
## Copyright (c) 2014-2021 Sylvain Benner & Contributors
##
@ -10,11 +10,13 @@
##
## License: GPLv3
exit_if_no_changes
cd "/tmp/${PUBLISH}"
export GITHUB_TOKEN=$UPD_BOT_GIT_TK
echo_headline "Opening PR to ${UPD_BOT_LOGIN}/${UPD_BOT_REPO} repo"
echo "[bot] Built-in auto-update" > msg
echo "[bot] ${PUBLISH} updates" > msg
echo >> msg
echo "Merge with care - I'm just a stupid bot. Beep boop." >> msg
hub pull-request -h "${PUBLISH}" -b "${CIRCLE_BRANCH}" -F msg

View File

@ -1,23 +0,0 @@
#!/usr/bin/env bash
## open_pr Opens PR to Spacemacs repository with documentation updates
##
## Copyright (c) 2014-2021 Sylvain Benner & Contributors
##
## Author: Eugene Yaremenko
## URL: https://github.com/syl20bnr/spacemacs
##
## This file is not part of GNU Emacs.
##
## License: GPLv3
cd "/tmp/${PUBLISH}"
export GITHUB_TOKEN=$UPD_BOT_GIT_TK
echo_headline "Opening PR to ${UPD_BOT_LOGIN}/${UPD_BOT_REPO} repo"
echo "[bot] Documentation fixes" > msg
echo >> msg
echo "Merge with care - I'm just a stupid bot. Beep boop." >> msg
hub pull-request -h "${PUBLISH}" -b "${CIRCLE_BRANCH}" -F msg
if [ $? -ne 0 ]; then
echo "Seems like PR already exists (not a problem)"
fi

View File

@ -10,6 +10,8 @@
##
## License: GPLv3
exit_if_no_changes
cd "/tmp/${PUBLISH}"
echo_headline "Creating fork under bot account"

View File

@ -41,6 +41,17 @@ echo_headline () {
echo
}
exit_if_no_changes () {
if [ ! -f "/tmp/${PUBLISH}.patch" ]; then
echo "\"/tmp/${PUBLISH}.patch\" file doesn't exists. Exiting."
exit 0
fi
if [[ -z $(grep '[^[:space:]]' "/tmp/${PUBLISH}.patch") ]]; then
echo "\"/tmp/${PUBLISH}.patch\" patch file is empty. Exiting."
exit 0
fi
}
select_changed_orgs () {
changed_f_as_args=()
while read p