-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
CircleCI
committed
Jul 31, 2019
1 parent
7f00663
commit 88e1662
Showing
2 changed files
with
60 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
CYAN="\033[0;36m" | ||
YELLOW="\033[0;33m" | ||
RED="\033[0;31m" | ||
GREEN="\033[0;32m" | ||
NONE="\033[0m" | ||
|
||
output() { | ||
printf "\n${1}${2}${NONE}\n\n" | ||
} | ||
|
||
output "${CYAN}" "Checking Translations" | ||
|
||
# Quit as success if not on the branch to be synced | ||
if ! git branch --list | grep --silent "^* ${TRANSLATION_BRANCH}$"; then | ||
output "${GREEN}" "Skipping: Not on TRANSLATION_BRANCH: ${TRANSLATION_BRANCH}" | ||
exit 0 | ||
fi | ||
|
||
echo bundle exec rake translation:sync | ||
bundle exec rake translation:sync | ||
echo changes >> Gemfile # TODO: Kill this line | ||
|
||
if [[ -z `git status --porcelain --short` ]]; then | ||
output "${GREEN}" "No uncommitted translations. Done." | ||
exit 0 | ||
else | ||
output "${RED}" "Uncommitted Translations" | ||
git --no-pager diff | ||
|
||
output "${YELLOW}" "Creating Update PR" | ||
git config user.email "ci@bikeindex.org" | ||
git config user.name "CircleCI" | ||
|
||
BRANCH="translation-update-${CIRCLE_BUILD_NUM}" | ||
set -x | ||
echo git stash | ||
echo git clean -df | ||
echo git checkout -b ${BRANCH} | ||
echo git reset --hard origin/master | ||
echo git stash pop | ||
echo git add . | ||
echo git commit -m "Translation update [ci skip]" | ||
echo git push -u origin ${BRANCH} | ||
set +x | ||
|
||
hub pull-request \ | ||
-m "[i18n] Translation update | ||
Merge to unblock CI job ${CIRCLE_BUILD_NUM}: ${CIRCLE_BUILD_URL} | ||
Related: PR ${CIRCLE_PULL_REQUEST}" | ||
|
||
output "${GREEN}" "Translation update PR Created: " | ||
output "${GREEN}" "https://github.com/bikeindex/bike_index/pull/new/${BRANCH}" | ||
exit 1 | ||
fi |