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

View File

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

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/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 ## Copyright (c) 2014-2021 Sylvain Benner & Contributors
## ##
@ -10,11 +10,13 @@
## ##
## License: GPLv3 ## License: GPLv3
exit_if_no_changes
cd "/tmp/${PUBLISH}" cd "/tmp/${PUBLISH}"
export GITHUB_TOKEN=$UPD_BOT_GIT_TK export GITHUB_TOKEN=$UPD_BOT_GIT_TK
echo_headline "Opening PR to ${UPD_BOT_LOGIN}/${UPD_BOT_REPO} repo" 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 >> msg
echo "Merge with care - I'm just a stupid bot. Beep boop." >> msg echo "Merge with care - I'm just a stupid bot. Beep boop." >> msg
hub pull-request -h "${PUBLISH}" -b "${CIRCLE_BRANCH}" -F 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 ## License: GPLv3
exit_if_no_changes
cd "/tmp/${PUBLISH}" cd "/tmp/${PUBLISH}"
echo_headline "Creating fork under bot account" echo_headline "Creating fork under bot account"

View File

@ -41,6 +41,17 @@ echo_headline () {
echo 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 () { select_changed_orgs () {
changed_f_as_args=() changed_f_as_args=()
while read p while read p